Skip to contentSkip to conversation

examples/service_cores: fix lcore count check

PATCH Applied Ruifeng Wang 4 participants 4 messages Aug 30, 2021 – Sep 16, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 examples/service_cores: fix lcore count check

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")
---
 examples/service_cores/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
examples/service_cores/main.c +1 -1
index 83915b9a53..9f52082254 100644
@@ -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;
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#1 lore raw
Quoted 15 lines

-----Original Message-----
From: Ruifeng Wang <[email protected]>
Sent: Monday, August 30, 2021 9:04 AM
To: Van Haaren, Harry <[email protected]>; Varghese, Vipin <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Ruifeng Wang <[email protected]>; [email protected]
Subject: [PATCH] examples/service_cores: fix lcore count check

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.

Quoted 8 lines

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

Fixes 7f6ee6aee717 ("examples/service_cores: check cores before run")

Change makes sense to me, this was introduced in Oct 2020 so a backport to 20.11 LTS makes sense I think.

#2 lore raw
Quoted 5 lines · Harry
Quoted 5 lines

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.

Quoted 8 lines
Quoted 7 lines

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

Fixes 7f6ee6aee717 ("examples/service_cores: check cores before run")

Applied, thanks.

Signature · 1 line
David Marchand
#3 lore raw
In reply to Van Haaren, Harry

31/08/2021 18:09, Van Haaren, Harry:

Quoted 9 lines

From: Ruifeng Wang <[email protected]>

Quoted 5 lines
Fixes 7f6ee6aee717 ("examples/service_cores: check cores before run")

Change makes sense to me, this was introduced in Oct 2020 so a backport to 20.11 LTS makes sense I think.

Backport is not only for official announced branches.
The backport mark may be used to maintain some private branches as well.