[v3,1/2] service: fix wrong lcore indices

Message ID 1594118726-8421-1-git-send-email-arybchenko@solarflare.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series [v3,1/2] service: fix wrong lcore indices |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS

Commit Message

Andrew Rybchenko July 7, 2020, 10:45 a.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

Van Haaren, Harry July 7, 2020, 1:14 p.m. UTC | #1
> -----Original Message-----
> From: Andrew Rybchenko <arybchenko@solarflare.com>
> Sent: Tuesday, July 7, 2020 11:45 AM
> To: dev@dpdk.org
> Cc: Igor Romanov <igor.romanov@oktetlabs.ru>; stable@dpdk.org; Van Haaren,
> Harry <harry.van.haaren@intel.com>
> Subject: [PATCH v3 1/2] service: fix wrong lcore indices
> 
> 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: e30d d318 47d2 ("service: add mechanism for quiescing")
> Cc: stable@dpdk.org

I believe the original adding of quiescing did not have this exact bug (ids[] was used)?
It seems to have been introduced when reworking to avoid false sharing, so fixes is:
Fixes: e484ccddbe1b ("services: avoid false sharing on core state")


> Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>

Code change itself: 
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>

<snip patch>
  
Honnappa Nagarahalli July 7, 2020, 7:33 p.m. UTC | #2
<snip>

> Subject: [dpdk-dev] [PATCH v3 1/2] service: fix wrong lcore indices
> 
> 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>

LGTM
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.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
  
Thomas Monjalon July 7, 2020, 9:56 p.m. UTC | #3
07/07/2020 15:14, Van Haaren, Harry:
> From: Andrew Rybchenko <arybchenko@solarflare.com>
> > 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: e30d d318 47d2 ("service: add mechanism for quiescing")
> > Cc: stable@dpdk.org
> 
> I believe the original adding of quiescing did not have this exact bug (ids[] was used)?
> It seems to have been introduced when reworking to avoid false sharing, so fixes is:
> Fixes: e484ccddbe1b ("services: avoid false sharing on core state")
> 
> 
> > Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
> > Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
> 
> Code change itself: 
> Acked-by: Harry van Haaren <harry.van.haaren@intel.com>

Series applied, thanks
  

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;
 	}