service: fix wrong lcore indexes

Message ID 1593873347-13686-1-git-send-email-arybchenko@solarflare.com (mailing list archive)
State Superseded, archived
Delegated to: David Marchand
Headers
Series service: fix wrong lcore indexes |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/Intel-compilation success Compilation OK

Commit Message

Andrew Rybchenko July 4, 2020, 2:35 p.m. UTC
  From: Igor Romanov <igor.romanov@oktetlabs.ru>

The service core list is populated, but not used. Incorrect
lcore states are examined for a service.

Use the populated list to iterate over service cores.

Fixes: e30dd31847d2 ("service: add mechanism for quiescing")
Cc: stable@dpdk.org

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 lib/librte_eal/common/rte_service.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Honnappa Nagarahalli July 4, 2020, 3:06 p.m. UTC | #1
Hi Andrew/Igor,
	A effective test case is missing for this, can you please add a test case? Otherwise it looks good.

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Andrew Rybchenko
> Sent: Saturday, July 4, 2020 9:36 AM
> To: dev@dpdk.org
> Cc: Igor Romanov <igor.romanov@oktetlabs.ru>; stable@dpdk.org; Harry van
> Haaren <harry.van.haaren@intel.com>
> Subject: [dpdk-dev] [PATCH] service: fix wrong lcore indexes
Nit, 'indices' would be better?                                           ^^^^^^^

> 
> From: Igor Romanov <igor.romanov@oktetlabs.ru>
> 
> The service core list is populated, but not used. Incorrect lcore states are
> examined for a service.
> 
> Use the populated list to iterate over service cores.
> 
> Fixes: e30dd31847d2 ("service: add mechanism for quiescing")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
> ---
>  lib/librte_eal/common/rte_service.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/librte_eal/common/rte_service.c
> b/lib/librte_eal/common/rte_service.c
> index 6123a2124d..e2795f857e 100644
> --- a/lib/librte_eal/common/rte_service.c
> +++ b/lib/librte_eal/common/rte_service.c
> @@ -422,7 +422,7 @@ rte_service_may_be_active(uint32_t id)
>  		return -EINVAL;
> 
>  	for (i = 0; i < lcore_count; i++) {
> -		if (lcore_states[i].service_active_on_lcore[id])
> +		if (lcore_states[ids[i]].service_active_on_lcore[id])
>  			return 1;
>  	}
> 
> --
> 2.17.1
  
David Marchand July 4, 2020, 3:10 p.m. UTC | #2
On Sat, Jul 4, 2020 at 5:07 PM Honnappa Nagarahalli
<Honnappa.Nagarahalli@arm.com> wrote:
>
> Hi Andrew/Igor,
>         A effective test case is missing for this, can you please add a test case? Otherwise it looks good.

+1, I was about to reply this.
  
Andrew Rybchenko July 6, 2020, 11:09 a.m. UTC | #3
On 7/4/20 6:10 PM, David Marchand wrote:
> On Sat, Jul 4, 2020 at 5:07 PM Honnappa Nagarahalli
> <Honnappa.Nagarahalli@arm.com> wrote:
>>
>> Hi Andrew/Igor,
>>         A effective test case is missing for this, can you please add a test case? Otherwise it looks good.
> 
> +1, I was about to reply this.

Done in v2
  

Patch

diff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/rte_service.c
index 6123a2124d..e2795f857e 100644
--- a/lib/librte_eal/common/rte_service.c
+++ b/lib/librte_eal/common/rte_service.c
@@ -422,7 +422,7 @@  rte_service_may_be_active(uint32_t id)
 		return -EINVAL;
 
 	for (i = 0; i < lcore_count; i++) {
-		if (lcore_states[i].service_active_on_lcore[id])
+		if (lcore_states[ids[i]].service_active_on_lcore[id])
 			return 1;
 	}