eal: warn if no lcore is available

Message ID 20250508051915.226465-2-david.marchand@redhat.com (mailing list archive)
State New
Delegated to: Thomas Monjalon
Headers
Series eal: warn if no lcore is available |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Functional success Functional PASS
ci/iol-marvell-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/aws-unit-testing success Unit Testing PASS
ci/iol-sample-apps-testing success Testing PASS

Commit Message

David Marchand May 8, 2025, 5:19 a.m. UTC
On systems with more cpu than RTE_MAX_LCORE, starting DPDK with
cores >= RTE_MAX_LCORE ends up with an ambiguous error log.

Example with RTE_MAX_LCORE=8:
$ taskset -c 8 ./build/app/dpdk-testpmd
EAL: Detected CPU lcores: 8
EAL: Detected NUMA nodes: 1
EAL: Invalid 'command line' arguments.
EAL: Error - exiting with code: 1
Cannot init EAL: Invalid argument

Add a better hint to help the user.

Fixes: 2eba8d21f3c9 ("eal: restrict cores auto detection")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 lib/eal/common/eal_common_options.c | 5 +++++
 1 file changed, 5 insertions(+)
  

Comments

Burakov, Anatoly May 8, 2025, 11:23 a.m. UTC | #1
On 5/8/2025 7:19 AM, David Marchand wrote:
> On systems with more cpu than RTE_MAX_LCORE, starting DPDK with
> cores >= RTE_MAX_LCORE ends up with an ambiguous error log.
> 
> Example with RTE_MAX_LCORE=8:
> $ taskset -c 8 ./build/app/dpdk-testpmd
> EAL: Detected CPU lcores: 8
> EAL: Detected NUMA nodes: 1
> EAL: Invalid 'command line' arguments.
> EAL: Error - exiting with code: 1
> Cannot init EAL: Invalid argument
> 
> Add a better hint to help the user.
> 
> Fixes: 2eba8d21f3c9 ("eal: restrict cores auto detection")
> Cc: stable@dpdk.org
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---

Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
  

Patch

diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c
index c77654c365..23c0c75932 100644
--- a/lib/eal/common/eal_common_options.c
+++ b/lib/eal/common/eal_common_options.c
@@ -2001,6 +2001,11 @@  eal_adjust_config(struct internal_config *internal_cfg)
 	if (!core_parsed)
 		eal_auto_detect_cores(cfg);
 
+	if (cfg->lcore_count == 0) {
+		EAL_LOG(ERR, "No detected lcore is enabled, please check the core list");
+		return -1;
+	}
+
 	if (internal_conf->process_type == RTE_PROC_AUTO)
 		internal_conf->process_type = eal_proc_type_detect();