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 25B7DA04B1; Tue, 25 Aug 2020 23:14:02 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1B16ADE3; Tue, 25 Aug 2020 23:14:01 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id E657BDE3 for ; Tue, 25 Aug 2020 23:13:58 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3A9171045; Tue, 25 Aug 2020 14:13:58 -0700 (PDT) Received: from localhost.localdomain (2p2660v4-1.austin.arm.com [10.118.12.95]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 350293F71F; Tue, 25 Aug 2020 14:13:58 -0700 (PDT) From: Dharmik Thakkar To: Thomas Monjalon Cc: dev@dpdk.org, nd@arm.com, Dharmik Thakkar Date: Tue, 25 Aug 2020 16:13:17 -0500 Message-Id: <20200825211317.8358-2-dharmik.thakkar@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200825211317.8358-1-dharmik.thakkar@arm.com> References: <20200825211317.8358-1-dharmik.thakkar@arm.com> Subject: [dpdk-dev] [PATCH 2/2] build: find max lcore programmatically 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" For Arm, RTE_MAX_LCORE is hard-coded into the config. It leads to incorrect RTE_MAX_LCORE when machines have same Implemener and part number but different number of CPUs. For x86, RTE_MAX_LCORE is always set to 128 (using the value set in meson_options.txt) Use python script to find max lcore when using native build to correctly set RTE_MAX_LCORE. Signed-off-by: Dharmik Thakkar Reviewed-by: Ruifeng Wang --- config/get_max_lcores.py | 13 +++++++++++++ config/meson.build | 13 ++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100755 config/get_max_lcores.py diff --git a/config/get_max_lcores.py b/config/get_max_lcores.py new file mode 100755 index 000000000000..ebf1c7efdadd --- /dev/null +++ b/config/get_max_lcores.py @@ -0,0 +1,13 @@ +#!/usr/bin/python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2020 Arm Limited + +import os + +max_lcores = [] + +nCPU = os.cpu_count() + +max_lcores.append(str(nCPU & 0xFFF)) # Number of CPUs + +print(' '.join(max_lcores)) diff --git a/config/meson.build b/config/meson.build index 6996e5cbeaa5..80c05bc15d2f 100644 --- a/config/meson.build +++ b/config/meson.build @@ -237,11 +237,22 @@ else # for 32-bit we need smaller reserved memory areas dpdk_conf.set('RTE_MAX_MEM_MB', 2048) endif - compile_time_cpuflags = [] subdir(arch_subdir) dpdk_conf.set('RTE_COMPILE_TIME_CPUFLAGS', ','.join(compile_time_cpuflags)) +# set max lcores +if machine != 'default' and not meson.is_cross_build() + # The script returns max lcores + params = files('get_max_lcores.py') + cmd_out = run_command(params) + if cmd_out.returncode() == 0 + cmd_lcore = cmd_out.stdout().to_lower().strip().split(' ') + endif + max_lcore = cmd_lcore[0].to_int() + dpdk_conf.set('RTE_MAX_LCORE', max_lcore) +endif + # set the install path for the drivers dpdk_conf.set_quoted('RTE_EAL_PMD_PATH', eal_pmd_path) -- 2.17.1