patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] mem: fix division by zero in no-NUMA mode
@ 2018-11-26 10:57 Anatoly Burakov
  2018-11-26 11:14 ` [dpdk-stable] [dpdk-dev] " Hunt, David
  0 siblings, 1 reply; 3+ messages in thread
From: Anatoly Burakov @ 2018-11-26 10:57 UTC (permalink / raw)
  To: dev; +Cc: thomas, stable

When RTE_EAL_NUMA_AWARE_HUGEPAGES is set to "n", not all memtypes
will be valid, because we skip some due to not supporting other
NUMA nodes, leading to a division by zero error down the line
because the necessary memtype fields weren't populated.

Fix it by limiting number of memtypes to number of memtypes we
have actually created.

Fixes: 1dd342d0fdc4 ("mem: improve segment list preallocation")
Cc: stable@dpdk.org

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 lib/librte_eal/linuxapp/eal/eal_memory.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c
index 6f94621d4..32feb415d 100644
--- a/lib/librte_eal/linuxapp/eal/eal_memory.c
+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
@@ -2230,6 +2230,8 @@ memseg_primary_init(void)
 				socket_id, hugepage_sz);
 		}
 	}
+	/* number of memtypes could have been lower due to no NUMA support */
+	n_memtypes = cur_type;
 
 	/* set up limits for types */
 	max_mem = (uint64_t)RTE_MAX_MEM_MB << 20;
-- 
2.17.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH] mem: fix division by zero in no-NUMA mode
  2018-11-26 10:57 [dpdk-stable] [PATCH] mem: fix division by zero in no-NUMA mode Anatoly Burakov
@ 2018-11-26 11:14 ` Hunt, David
  2018-11-26 14:37   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Hunt, David @ 2018-11-26 11:14 UTC (permalink / raw)
  To: Anatoly Burakov, dev; +Cc: thomas, stable

Hi Anatoly,

On 26/11/2018 10:57 AM, Anatoly Burakov wrote:
> When RTE_EAL_NUMA_AWARE_HUGEPAGES is set to "n", not all memtypes
> will be valid, because we skip some due to not supporting other
> NUMA nodes, leading to a division by zero error down the line
> because the necessary memtype fields weren't populated.
>
> Fix it by limiting number of memtypes to number of memtypes we
> have actually created.
>
> Fixes: 1dd342d0fdc4 ("mem: improve segment list preallocation")
> Cc: stable@dpdk.org
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
>   lib/librte_eal/linuxapp/eal/eal_memory.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c
> index 6f94621d4..32feb415d 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_memory.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
> @@ -2230,6 +2230,8 @@ memseg_primary_init(void)
>   				socket_id, hugepage_sz);
>   		}
>   	}
> +	/* number of memtypes could have been lower due to no NUMA support */
> +	n_memtypes = cur_type;
>   
>   	/* set up limits for types */
>   	max_mem = (uint64_t)RTE_MAX_MEM_MB << 20;

Fixes the issue on my machine. vm_power_manager crashes with floating point
exception without patch, starts successfully with patch.

Tested-by: David Hunt <david.hunt@intel.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH] mem: fix division by zero in no-NUMA mode
  2018-11-26 11:14 ` [dpdk-stable] [dpdk-dev] " Hunt, David
@ 2018-11-26 14:37   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2018-11-26 14:37 UTC (permalink / raw)
  To: Anatoly Burakov; +Cc: dev, Hunt, David, stable

26/11/2018 12:14, Hunt, David:
> Hi Anatoly,
> 
> On 26/11/2018 10:57 AM, Anatoly Burakov wrote:
> > When RTE_EAL_NUMA_AWARE_HUGEPAGES is set to "n", not all memtypes
> > will be valid, because we skip some due to not supporting other
> > NUMA nodes, leading to a division by zero error down the line
> > because the necessary memtype fields weren't populated.
> >
> > Fix it by limiting number of memtypes to number of memtypes we
> > have actually created.
> >
> > Fixes: 1dd342d0fdc4 ("mem: improve segment list preallocation")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> 
> Fixes the issue on my machine. vm_power_manager crashes with floating point
> exception without patch, starts successfully with patch.
> 
> Tested-by: David Hunt <david.hunt@intel.com>

Applied (in last minute), thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-11-26 14:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-26 10:57 [dpdk-stable] [PATCH] mem: fix division by zero in no-NUMA mode Anatoly Burakov
2018-11-26 11:14 ` [dpdk-stable] [dpdk-dev] " Hunt, David
2018-11-26 14:37   ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).