From patchwork Fri Mar 29 12:30:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Burakov, Anatoly" X-Patchwork-Id: 51906 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CD1D31DB8; Fri, 29 Mar 2019 13:31:02 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 61ECF1B05; Fri, 29 Mar 2019 13:31:01 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Mar 2019 05:31:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,284,1549958400"; d="scan'208";a="286995289" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga004.jf.intel.com with ESMTP; 29 Mar 2019 05:30:59 -0700 Received: from sivswdev05.ir.intel.com (sivswdev05.ir.intel.com [10.243.17.64]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id x2TCUwKN010660; Fri, 29 Mar 2019 12:30:58 GMT Received: from sivswdev05.ir.intel.com (localhost [127.0.0.1]) by sivswdev05.ir.intel.com with ESMTP id x2TCUwR0020439; Fri, 29 Mar 2019 12:30:58 GMT Received: (from aburakov@localhost) by sivswdev05.ir.intel.com with LOCAL id x2TCUrWt020431; Fri, 29 Mar 2019 12:30:54 GMT From: Anatoly Burakov To: dev@dpdk.org Cc: thomas@monjalon.net, stable@dpdk.org Date: Fri, 29 Mar 2019 12:30:53 +0000 Message-Id: X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <1eaac2264febd5c36654a90b0cc13ba43a0b28ca.1553693720.git.anatoly.burakov@intel.com> References: <1eaac2264febd5c36654a90b0cc13ba43a0b28ca.1553693720.git.anatoly.burakov@intel.com> Subject: [dpdk-dev] [PATCH v3] mem: warn user when running without NUMA support 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 in non-legacy mode on a NUMA-enabled system without libnuma is unsupported, so explicitly print out a warning when trying to do so. Running in legacy mode without libnuma is still supported whether or not we are running with libnuma support enabled, so also fix init to allow that scenario. Cc: stable@dpdk.org Signed-off-by: Anatoly Burakov --- Notes: v3: - Fix ill-conceived v2 "fix" by adding getopt header to eal_options.h instead of removing the include lib/librte_eal/common/eal_options.h | 2 ++ lib/librte_eal/linux/eal/eal_memalloc.c | 3 +++ lib/librte_eal/linux/eal/eal_memory.c | 14 ++++++++++++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/lib/librte_eal/common/eal_options.h b/lib/librte_eal/common/eal_options.h index 58ee9ae33..9855429e5 100644 --- a/lib/librte_eal/common/eal_options.h +++ b/lib/librte_eal/common/eal_options.h @@ -5,6 +5,8 @@ #ifndef EAL_OPTIONS_H #define EAL_OPTIONS_H +#include "getopt.h" + enum { /* long options mapped to a short option */ #define OPT_HELP "help" diff --git a/lib/librte_eal/linux/eal/eal_memalloc.c b/lib/librte_eal/linux/eal/eal_memalloc.c index b6fb183db..4e83a1a19 100644 --- a/lib/librte_eal/linux/eal/eal_memalloc.c +++ b/lib/librte_eal/linux/eal/eal_memalloc.c @@ -725,6 +725,9 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id, __func__, socket_id, cur_socket_id); goto mapped; } +#else + if (rte_socket_count() > 1) + RTE_LOG(DEBUG, EAL, "%s(): not checking hugepage NUMA node.\n"); #endif ms->addr = addr; diff --git a/lib/librte_eal/linux/eal/eal_memory.c b/lib/librte_eal/linux/eal/eal_memory.c index 1b96b576e..e5a0e57ff 100644 --- a/lib/librte_eal/linux/eal/eal_memory.c +++ b/lib/librte_eal/linux/eal/eal_memory.c @@ -50,6 +50,7 @@ #include "eal_internal_cfg.h" #include "eal_filesystem.h" #include "eal_hugepages.h" +#include "eal_options.h" #define PFN_MASK_SIZE 8 @@ -2088,7 +2089,8 @@ memseg_primary_init_32(void) socket_id = rte_socket_id_by_idx(i); #ifndef RTE_EAL_NUMA_AWARE_HUGEPAGES - if (socket_id > 0) + /* we can still sort pages by socket in legacy mode */ + if (!internal_config.legacy_mem && socket_id > 0) break; #endif @@ -2269,7 +2271,8 @@ memseg_primary_init(void) int socket_id = rte_socket_id_by_idx(i); #ifndef RTE_EAL_NUMA_AWARE_HUGEPAGES - if (socket_id > 0) + /* we can still sort pages by socket in legacy mode */ + if (!internal_config.legacy_mem && socket_id > 0) break; #endif memtypes[cur_type].page_sz = hugepage_sz; @@ -2428,6 +2431,13 @@ rte_eal_memseg_init(void) } else { RTE_LOG(ERR, EAL, "Cannot get current resource limits\n"); } +#ifndef RTE_EAL_NUMA_AWARE_HUGEPAGES + if (!internal_config.legacy_mem && rte_socket_count() > 1) { + RTE_LOG(WARNING, EAL, "DPDK is running on a NUMA system, but is compiled without NUMA support.\n"); + RTE_LOG(WARNING, EAL, "This will have adverse consequences for performance and usability.\n"); + RTE_LOG(WARNING, EAL, "Please use --"OPT_LEGACY_MEM" option, or recompile with NUMA support.\n"); + } +#endif return rte_eal_process_type() == RTE_PROC_PRIMARY ? #ifndef RTE_ARCH_64