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 46B48A04DD for ; Wed, 28 Oct 2020 11:53:30 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3B768C9C0; Wed, 28 Oct 2020 11:53:29 +0100 (CET) Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) by dpdk.org (Postfix) with ESMTP id 81381C9C0 for ; Wed, 28 Oct 2020 11:53:28 +0100 (CET) Received: by mail-wm1-f46.google.com with SMTP id 13so4106336wmf.0 for ; Wed, 28 Oct 2020 03:53:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=APBA0Oouosqh3vA3Ts5PAHD1u99aAsbthPXoEak0+ko=; b=la+8HkISyo2Y8XTBE77hDmxSjPtz05hvBQI5+b91tjZkMZS6DHzNKSJoByjNXDyO2l JxNPnigPeqaDQgM6UQilaY0dYNlDB9ussU9JdQXT8vUnhEpufwS1E8n8nH846kNMPLu8 GCdF/S16mwcgZMaSR5wqEPeV4uxhxyuMzFHW2JgtDB7kGCGUCRUsP8OLlCwZFrk2gu5c qkLt/lMv6XO5+v0mb3ibkFb1bDEcJ7PyEmG+B/3U7q0vNnqKLf92UzrAzCRfRE32de7Q bnkJo/QjkzQUojrq7T/TzKOEcs6Cm75i1sRqyADzg5baTUs212g0F+okBjauNufcYO1t BAwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=APBA0Oouosqh3vA3Ts5PAHD1u99aAsbthPXoEak0+ko=; b=F6Pfp7ugU2wjnmWQU0/2qvigHKWzUeC8ZQy5xhEtJPbUzy+aNaQGplGLti7ZRQmBfK jGwAjANjlqQDZwk8pMbHZQUv6flYNiNviMhWN+BCdrZBqoxDT9JOHlQgerPweO+hPaZl xEmZ8O5cudwnxzv7jbypV1/hVXxjux0xS1BRj7HuDPJZLD+u3rzHyu5yeNvf7wgWjHyY vq4q56IkHqoWfWC42Wdk8p/pWcjijPfrJuzqiLdE9TfliRZ+tFF24hd1cYlhp8xNjtgl 9AuWImehSmaVXkpXWcn2iMWXINamhgn0ztY9TGiGRbZURm1N1t7FPR04DvuTlSnTztAU DyLQ== X-Gm-Message-State: AOAM533PEYW2rOg5S3duiZNmPqTFmxa7tR4AZZ0Nn/v35d5jr0Tuf997 lTC6SvrfnS7qNoKN4No7eu4= X-Google-Smtp-Source: ABdhPJxJk0C9wF7ujUHmYNUpEGQuLHor8ue3L/h2PbWPkb3qxNHudFr0oB/ATX32PCCpEgRAAh7/Ig== X-Received: by 2002:a05:600c:2302:: with SMTP id 2mr7362360wmo.111.1603882407290; Wed, 28 Oct 2020 03:53:27 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id 30sm6565138wrr.35.2020.10.28.03.53.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2020 03:53:26 -0700 (PDT) From: luca.boccassi@gmail.com To: Nick Connolly Cc: Nicolas Dichtel , Anatoly Burakov , dpdk stable Date: Wed, 28 Oct 2020 10:44:56 +0000 Message-Id: <20201028104606.3504127-137-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201028104606.3504127-1-luca.boccassi@gmail.com> References: <20201028104606.3504127-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'mem: fix allocation failure on non-NUMA kernel' has been queued to stable release 19.11.6 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" Hi, FYI, your patch has been queued to stable release 19.11.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 10/30/20. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Thanks. Luca Boccassi --- >From a6877eb98ed273677fbe0cdccbd731444b2e065b Mon Sep 17 00:00:00 2001 From: Nick Connolly Date: Mon, 12 Oct 2020 20:28:03 +0100 Subject: [PATCH] mem: fix allocation failure on non-NUMA kernel [ upstream commit 9d42642e866ea100b190ad8de4c8b27d1b310a13 ] Running dpdk-helloworld on Linux with lib numa present, but no kernel support for NUMA (CONFIG_NUMA=n) causes rte_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") Signed-off-by: Nick Connolly Reviewed-by: Nicolas Dichtel Acked-by: Anatoly Burakov --- lib/librte_eal/linux/eal/eal_memalloc.c | 30 ++++++++++++++++--------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/lib/librte_eal/linux/eal/eal_memalloc.c b/lib/librte_eal/linux/eal/eal_memalloc.c index 08b9888b07..51d239de37 100644 --- a/lib/librte_eal/linux/eal/eal_memalloc.c +++ b/lib/librte_eal/linux/eal/eal_memalloc.c @@ -614,17 +614,25 @@ 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 the kernel has been built without NUMA support, get_mempolicy() + * will return an error. If check_numa() returns false, memory + * allocation is not NUMA aware and the socket_id should not be + * checked. + */ + 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) -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-10-28 10:35:15.992883919 +0000 +++ 0137-mem-fix-allocation-failure-on-non-NUMA-kernel.patch 2020-10-28 10:35:11.708833026 +0000 @@ -1,8 +1,10 @@ -From 9d42642e866ea100b190ad8de4c8b27d1b310a13 Mon Sep 17 00:00:00 2001 +From a6877eb98ed273677fbe0cdccbd731444b2e065b Mon Sep 17 00:00:00 2001 From: Nick Connolly Date: Mon, 12 Oct 2020 20:28:03 +0100 Subject: [PATCH] mem: fix allocation failure on non-NUMA kernel +[ upstream commit 9d42642e866ea100b190ad8de4c8b27d1b310a13 ] + Running dpdk-helloworld on Linux with lib numa present, but no kernel support for NUMA (CONFIG_NUMA=n) causes rte_service_init() to fail with EAL: error allocating rte services array. @@ -14,20 +16,19 @@ The allocated socket should only be verified if check_numa() is true. Fixes: 2a96c88be83e ("mem: ease init in a docker container") -Cc: stable@dpdk.org Signed-off-by: Nick Connolly Reviewed-by: Nicolas Dichtel Acked-by: Anatoly Burakov --- - lib/librte_eal/linux/eal_memalloc.c | 30 ++++++++++++++++++----------- + lib/librte_eal/linux/eal/eal_memalloc.c | 30 ++++++++++++++++--------- 1 file changed, 19 insertions(+), 11 deletions(-) -diff --git a/lib/librte_eal/linux/eal_memalloc.c b/lib/librte_eal/linux/eal_memalloc.c -index 40a5c4aa1d..6dc1b2baec 100644 ---- a/lib/librte_eal/linux/eal_memalloc.c -+++ b/lib/librte_eal/linux/eal_memalloc.c -@@ -625,17 +625,25 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id, +diff --git a/lib/librte_eal/linux/eal/eal_memalloc.c b/lib/librte_eal/linux/eal/eal_memalloc.c +index 08b9888b07..51d239de37 100644 +--- a/lib/librte_eal/linux/eal/eal_memalloc.c ++++ b/lib/librte_eal/linux/eal/eal_memalloc.c +@@ -614,17 +614,25 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id, } #ifdef RTE_EAL_NUMA_AWARE_HUGEPAGES