From 73293d73eb192d857c3e092d5ed568c300e9a8a8 Mon Sep 17 00:00:00 2001 From: Marcin Spiewak Date: Wed, 12 Apr 2023 13:01:41 +0000 Subject: [PATCH] ./configure: add 'detect' value to --max-lcores This patch adds suport for 'detect' option in SPDK's ./configure, allowing configuring of DPDK to detect current number of cores during SPDK compilation. This is done by providing --max-lcores=detect as a parameter to ./configure, which triggers setting of '-Dmax_lcores=detect' in DPDK_OPTS passed to dpdkbuild/Makefile. DPDK then do detection of number of cores in the system during compilation, and sets RTE_MAX_LCORE to that value. Meson build system also generates a message displaying information about number of cores detected. E.g. for my system: " Message: Found 72 cores " Example usages: 1) use default value for RTE_MAX_LCORE: ./configure 2) detect the core number: ./configure --max-lcores=detect 3) Set RTE_MAX_LCORE to 256: ./configure --max-lcores=256 Change-Id: I2103c2d917f210aee4d1ef43584b1bd40dbfe43b Signed-off-by: Marcin Spiewak Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17555 Community-CI: Mellanox Build Bot Reviewed-by: Konrad Sztyber Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris --- configure | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 392f13757..bb69b85dd 100755 --- a/configure +++ b/configure @@ -28,8 +28,10 @@ function usage() { echo " --cross-prefix=prefix Prefix for cross compilation (default: none)" echo " example: aarch64-linux-gnu" echo " --libdir=path Configure installation path for the libraries (default: \$prefix/lib)" - echo " --max-lcores=VAL DPDK configuration. Maximum number of lcores supported by EAL." - echo "" + echo " --max-lcores=VAL DPDK configuration. VAL defines maximum number of lcores supported" + echo " by EAL, or enables autodetection if set to 'detect'. When 'detect'" + echo " is specified, DPDK will detect number of cores in the system during" + echo " compilation, and will set maximum number of lcores to this value" echo " --enable-debug Configure for debug builds" echo " --enable-werror Treat compiler warnings as errors" echo " --enable-asan Enable address sanitizer" @@ -659,6 +661,7 @@ for i in "$@"; do ;; --max-lcores=*) CONFIG[MAX_LCORES]="${i#*=}" + CONFIG["MAX_LCORES"]=${CONFIG["MAX_LCORES"],,} ;; --) break @@ -1260,8 +1263,8 @@ if [[ "${CONFIG[AVAHI]}" = "y" ]]; then fi if [[ -n ${CONFIG[MAX_LCORES]} ]]; then - if [[ ! ${CONFIG[MAX_LCORES]} =~ ^[1-9][0-9]*$ ]] || ((CONFIG[MAX_LCORES] > 1024)); then - echo "ERROR: Max number of lcores must be a decimal number in range [1..1024] (given: ${CONFIG[MAX_LCORES]})" + if [[ ! ${CONFIG[MAX_LCORES]} =~ ^([1-9][0-9]*|detect)$ ]] || ((CONFIG[MAX_LCORES] > 1024)); then + echo "ERROR: Max number of lcores must be a decimal number in range [1..1024] or 'detect' (given: ${CONFIG[MAX_LCORES]})" exit 1 fi fi