From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Hunt, David" Subject: Re: [PATCH] mem: fix division by zero in no-NUMA mode Date: Mon, 26 Nov 2018 11:14:49 +0000 Message-ID: <73443011-2b32-ce73-ef0d-896858f7503d@intel.com> References: <294f089848bf803ff134979c612bbf28e0e2e6b9.1543229588.git.anatoly.burakov@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: thomas@monjalon.net, stable@dpdk.org To: Anatoly Burakov , dev@dpdk.org Return-path: In-Reply-To: <294f089848bf803ff134979c612bbf28e0e2e6b9.1543229588.git.anatoly.burakov@intel.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 > --- > 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