DPDK patches and discussions
 help / color / Atom feed
From: Dharmik Thakkar <dharmik.thakkar@arm.com>
To: Thomas Monjalon <thomas@monjalon.net>
Cc: dev@dpdk.org, nd@arm.com, Dharmik Thakkar <dharmik.thakkar@arm.com>
Subject: [dpdk-dev] [PATCH 2/2] build: find max lcore programmatically
Date: Tue, 25 Aug 2020 16:13:17 -0500
Message-ID: <20200825211317.8358-2-dharmik.thakkar@arm.com> (raw)
In-Reply-To: <20200825211317.8358-1-dharmik.thakkar@arm.com>

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 <dharmik.thakkar@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 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


  reply index

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-25 21:13 [dpdk-dev] [PATCH 1/2] config/arm: avoid variable reuse Dharmik Thakkar
2020-08-25 21:13 ` Dharmik Thakkar [this message]
2020-08-26  4:47   ` [dpdk-dev] [PATCH 2/2] build: find max lcore programmatically Jerin Jacob
2020-08-26  4:55     ` Dharmik Thakkar
2020-09-03  6:20       ` Juraj Linkeš
2020-09-03 22:52         ` Stephen Hemminger
2020-09-04  5:43           ` Dharmik Thakkar
2020-09-17  9:56             ` Juraj Linkeš
2020-09-18  5:47               ` Dharmik Thakkar
2020-10-13 14:31                 ` Thomas Monjalon
2020-10-13 14:58                   ` Juraj Linkeš
2020-10-13 15:14                     ` Dharmik Thakkar
2020-10-14  6:53                       ` Juraj Linkeš
2020-10-14 13:28                         ` Dharmik Thakkar
2020-09-04  5:26         ` Dharmik Thakkar
2020-09-17  9:33 ` [dpdk-dev] [PATCH 1/2] config/arm: avoid variable reuse Juraj Linkeš
2020-09-18  5:26   ` Dharmik Thakkar
2020-09-18  8:40     ` Juraj Linkeš

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200825211317.8358-2-dharmik.thakkar@arm.com \
    --to=dharmik.thakkar@arm.com \
    --cc=dev@dpdk.org \
    --cc=nd@arm.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

DPDK patches and discussions

Archives are clonable:
	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/ public-inbox