examples/service_cores: fix lcore count check

Message ID 20210830080412.1548336-1-ruifeng.wang@arm.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series examples/service_cores: fix lcore count check |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/github-robot: build success github build: passed
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-aarch64-unit-testing fail Testing issues

Commit Message

Ruifeng Wang Aug. 30, 2021, 8:04 a.m. UTC
  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@dpdk.org
Cc: vipin.varghese@intel.com

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

Comments

Van Haaren, Harry Aug. 31, 2021, 4:09 p.m. UTC | #1
> -----Original Message-----
> From: Ruifeng Wang <ruifeng.wang@arm.com>
> Sent: Monday, August 30, 2021 9:04 AM
> To: Van Haaren, Harry <harry.van.haaren@intel.com>; Varghese, Vipin
> <vipin.varghese@intel.com>
> Cc: dev@dpdk.org; thomas@monjalon.net; david.marchand@redhat.com;
> nd@arm.com; honnappa.nagarahalli@arm.com; Ruifeng Wang
> <ruifeng.wang@arm.com>; stable@dpdk.org
> 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.
> 
> Max available number of service cores is all detected lcores
> excluding main core.
> 
> Fixes: 7f6ee6aee717 ("examples/service_cores: check cores before run")
> Cc: stable@dpdk.org
> Cc: vipin.varghese@intel.com
> 
> Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>

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

Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
  
David Marchand Sept. 16, 2021, 3:30 p.m. UTC | #2
On Tue, Aug 31, 2021 at 6:12 PM Van Haaren, Harry
<harry.van.haaren@intel.com> wrote:
> > 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@dpdk.org
> >
> > Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>
> Acked-by: Harry van Haaren <harry.van.haaren@intel.com>

Applied, thanks.
  
Thomas Monjalon Sept. 16, 2021, 3:36 p.m. UTC | #3
31/08/2021 18:09, Van Haaren, Harry:
> From: Ruifeng Wang <ruifeng.wang@arm.com>
> > Fixes: 7f6ee6aee717 ("examples/service_cores: check cores before run")
> > Cc: stable@dpdk.org
> > Cc: vipin.varghese@intel.com
> > 
> > Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>
> 
> 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.
  

Patch

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;