From patchwork Wed Aug 5 12:26:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Connolly X-Patchwork-Id: 75208 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5C634A053A; Wed, 5 Aug 2020 14:26:55 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 194B71B203; Wed, 5 Aug 2020 14:26:54 +0200 (CEST) Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by dpdk.org (Postfix) with ESMTP id B06FE2C23 for ; Wed, 5 Aug 2020 14:26:52 +0200 (CEST) Received: by mail-wm1-f66.google.com with SMTP id c80so5651296wme.0 for ; Wed, 05 Aug 2020 05:26:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mayadata-io.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=p7nud6LynIvreSolgzYXfKouiBJ/A2mnG14ov0g0aOU=; b=f0gmS1lrLO/leeJugegomLdrPt0Hluw1WWQtSrYOxgkNhTHNqBdPwWsLVzXYVDrdtZ EDkK3oSpN7SyMlqz2uD8mLpwQYi5WineX0mha1mmGeh0ce5ygCGr+Pt9xwtxs2PoX0fK vSvLbMIGOpgLStBPZyyitoZ/p61s5EQh4OX2kgfjtPHyHbKxCGc5McUnYJtz36P66HIa +jwBg2ssEi0bOzj/Raymo8SiuICMEj245lGyO3DdAEDI2jBudTnc96KHqVVPYCk15hp9 GKFnV11TdvTb91v1Bgxw7nzIjMT5Ji4fChpP+GZ3K6fOdJhx1ofqBR8d+2BVWb03m0Nb IYvw== 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:mime-version :content-transfer-encoding; bh=p7nud6LynIvreSolgzYXfKouiBJ/A2mnG14ov0g0aOU=; b=QnDr8iq89Ely6IG07515ZCJIQj32+PK7WpwfH5yC22bYUkl7Kd/OaTkEZn0vRwe0CZ m+BOKzZAA2Ywp6nzdx/6ye2f/MV53wplqYVdUhOdt3p+vrJa3ht4YxAoA1wt4glpJHp2 txlZALeMLqzyHRMlanTMV5ZPSybnLP8f5URktXAsud1MJfFCw+EI1iVQaz1Gv0ANOVvA Tfp2qn+vMqksOIqCtV7l3oBdEQwT3dDTXuJW32fbOcqkly4lIqvXXukTxLxSguyrFsYV fq++11suYX0pthq4i3oWUFDJcCZOuOrw7jb57Tyg4MGS8IxwBXGBSIjKnOBWzAG8qlgM g/rQ== X-Gm-Message-State: AOAM5317t7sLCveEa7V2w6dqMYT5GebO8NeoGHN/bCvMvvQ0wpo4CZkq jJ4pW8b2tOEgaQprufbVDW8Vqw== X-Google-Smtp-Source: ABdhPJwAIIFu0yPCJb76XW2/BLg0xhkhaa/QO6NLn6hqQ5UNMzjaOR850tyspCuvWUuP6gkJnBen4g== X-Received: by 2002:a7b:ce0e:: with SMTP id m14mr3266629wmc.160.1596630412290; Wed, 05 Aug 2020 05:26:52 -0700 (PDT) Received: from FENIX.datacoresoftware.com (cpc98324-croy25-2-0-cust73.19-2.cable.virginm.net. [82.38.60.74]) by smtp.gmail.com with ESMTPSA id x204sm12840560wmg.2.2020.08.05.05.26.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2020 05:26:51 -0700 (PDT) From: Nick Connolly To: Anatoly Burakov Cc: dev@dpdk.org, Nick Connolly , nicolas.dichtel@6wind.com, stable@dpdk.org Date: Wed, 5 Aug 2020 13:26:40 +0100 Message-Id: <20200805122640.13884-1-nick.connolly@mayadata.io> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH] mem: fix allocation failure on non-NUMA kernel X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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); } #else if (rte_socket_count() > 1)