[dpdk-dev] [PATCH] examples/service_cores: fix lcore count check

Ruifeng Wang ruifeng.wang at arm.com
Mon Aug 30 10:04:12 CEST 2021


The example has various profiles to run services on specified
number of lcores. Due to incorrect boundary condition, service
can be dispatched to a core that does not exist. This puts main
core into endless wait.

Max available number of service cores is all detected lcores
excluding main core.

Fixes: 7f6ee6aee717 ("examples/service_cores: check cores before run")
Cc: stable at dpdk.org
Cc: vipin.varghese at intel.com

Signed-off-by: Ruifeng Wang <ruifeng.wang at arm.com>
---
 examples/service_cores/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/service_cores/main.c b/examples/service_cores/main.c
index 83915b9a53..9f52082254 100644
--- a/examples/service_cores/main.c
+++ b/examples/service_cores/main.c
@@ -118,7 +118,7 @@ apply_profile(int profile_id)
 	struct profile *p = &profiles[profile_id];
 	const uint8_t core_off = 1;
 
-	if (p->num_cores > rte_lcore_count() + 1) {
+	if (p->num_cores > rte_lcore_count() - 1) {
 		printf("insufficent cores to run (%s)",
 			p->name);
 		return;
-- 
2.25.1



More information about the dev mailing list