From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id DF84DA04AF for ; Thu, 17 Sep 2020 13:32:08 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9F4871D627; Thu, 17 Sep 2020 13:32:08 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id D61481D605; Thu, 17 Sep 2020 13:32:05 +0200 (CEST) IronPort-SDR: 485K3Q/r0FDyxEAiaqHSi3FINYZ8g++tYPfO4qVI/nehVXQTHrhvP96DVdVNCNw+AapjxQat/q g/tVvogRzoDQ== X-IronPort-AV: E=McAfee;i="6000,8403,9746"; a="139182671" X-IronPort-AV: E=Sophos;i="5.76,436,1592895600"; d="scan'208";a="139182671" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Sep 2020 04:32:01 -0700 IronPort-SDR: U5zSEPlDlUhOC1HAD9f1F/swh5vLMbxltTlueUSCcFKhJOYGnSOENkz3EEkqpul4bWdnphaMo5 fiKDXsEonyTw== X-IronPort-AV: E=Sophos;i="5.76,436,1592895600"; d="scan'208";a="483711765" Received: from aburakov-mobl.ger.corp.intel.com (HELO [10.213.206.43]) ([10.213.206.43]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Sep 2020 04:31:59 -0700 To: Nick Connolly Cc: dev@dpdk.org, nicolas.dichtel@6wind.com, stable@dpdk.org References: <20200805122640.13884-1-nick.connolly@mayadata.io> From: "Burakov, Anatoly" Message-ID: Date: Thu, 17 Sep 2020 12:31:57 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <20200805122640.13884-1-nick.connolly@mayadata.io> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-stable] [PATCH] mem: fix allocation failure on non-NUMA kernel X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" On 05-Aug-20 1:26 PM, Nick Connolly wrote: > Running dpdk-helloworld on Linux with lib numa present, > but no kernel support for NUMA (CONFIG_NUMA=n) causes > ret_service_init() to fail with EAL: error allocating > rte services array. > > alloc_seg() calls get_mempolicy to verify that the allocation > has happened on the correct socket, but receives ENOSYS from > the kernel and fails the allocation. > > The allocated socket should only be verified if check_numa() is true. > > Fixes: 2a96c88be83e ("mem: ease init in a docker container") > Cc: nicolas.dichtel@6wind.com > Cc: stable@dpdk.org > Signed-off-by: Nick Connolly > --- > lib/librte_eal/linux/eal_memalloc.c | 28 +++++++++++++++++----------- > 1 file changed, 17 insertions(+), 11 deletions(-) > > diff --git a/lib/librte_eal/linux/eal_memalloc.c b/lib/librte_eal/linux/eal_memalloc.c > index db60e7997..179757809 100644 > --- a/lib/librte_eal/linux/eal_memalloc.c > +++ b/lib/librte_eal/linux/eal_memalloc.c > @@ -610,17 +610,23 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id, > } > > #ifdef RTE_EAL_NUMA_AWARE_HUGEPAGES > - ret = get_mempolicy(&cur_socket_id, NULL, 0, addr, > - MPOL_F_NODE | MPOL_F_ADDR); > - if (ret < 0) { > - RTE_LOG(DEBUG, EAL, "%s(): get_mempolicy: %s\n", > - __func__, strerror(errno)); > - goto mapped; > - } else if (cur_socket_id != socket_id) { > - RTE_LOG(DEBUG, EAL, > - "%s(): allocation happened on wrong socket (wanted %d, got %d)\n", > - __func__, socket_id, cur_socket_id); > - goto mapped; > + if (check_numa()) { > + ret = get_mempolicy(&cur_socket_id, NULL, 0, addr, > + MPOL_F_NODE | MPOL_F_ADDR); > + if (ret < 0) { > + RTE_LOG(DEBUG, EAL, "%s(): get_mempolicy: %s\n", > + __func__, strerror(errno)); > + goto mapped; > + } else if (cur_socket_id != socket_id) { > + RTE_LOG(DEBUG, EAL, > + "%s(): allocation happened on wrong socket (wanted %d, got %d)\n", > + __func__, socket_id, cur_socket_id); > + goto mapped; > + } > + } else { > + if (rte_socket_count() > 1) > + RTE_LOG(DEBUG, EAL, "%s(): not checking socket for allocation (wanted %d)\n", > + __func__, socket_id); > } If there is no kernel support for NUMA, how would we end up with >1 socket count? > #else > if (rte_socket_count() > 1) > -- Thanks, Anatoly