eal: stop iteration after lcore info is processed

Message ID 20231101072053.1319697-1-ruifeng.wang@arm.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series eal: stop iteration after lcore info is processed |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Functional success Functional PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS

Commit Message

Ruifeng Wang Nov. 1, 2023, 7:20 a.m. UTC
  Telemetry iterates on lcore ID to collect info of a specific lcore.
Since only one lcore is processed at a time, the iteration can stop
when a matching lcore is found.

Fixes: f2b852d909f9 ("eal: add lcore info in telemetry")
Cc: rjarry@redhat.com
Cc: stable@dpdk.org

Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 lib/eal/common/eal_common_lcore.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Stephen Hemminger Nov. 1, 2023, 6:13 p.m. UTC | #1
On Wed,  1 Nov 2023 15:20:53 +0800
Ruifeng Wang <ruifeng.wang@arm.com> wrote:

> From: Ruifeng Wang <ruifeng.wang@arm.com>
> To: Kevin Laatz <kevin.laatz@intel.com>, Robin Jarry <rjarry@redhat.com>,  Morten Brørup <mb@smartsharesystems.com>
> Cc: dev@dpdk.org, honnappa.nagarahalli@arm.com, nd@arm.com,  Ruifeng Wang <ruifeng.wang@arm.com>, stable@dpdk.org
> Subject: [PATCH] eal: stop iteration after lcore info is processed
> Date: Wed,  1 Nov 2023 15:20:53 +0800
> X-Mailer: git-send-email 2.25.1
> 
> Telemetry iterates on lcore ID to collect info of a specific lcore.
> Since only one lcore is processed at a time, the iteration can stop
> when a matching lcore is found.
> 
> Fixes: f2b852d909f9 ("eal: add lcore info in telemetry")
> Cc: rjarry@redhat.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>

Looks like a good optimization. Not sure it needs to go to stable.

Acked-by: Stephen Hemminger <stephen@networkplumber.org>
  
Robin Jarry Nov. 2, 2023, 9:57 a.m. UTC | #2
Ruifeng Wang, Nov 01, 2023 at 08:20:
> Telemetry iterates on lcore ID to collect info of a specific lcore.
> Since only one lcore is processed at a time, the iteration can stop
> when a matching lcore is found.
>
> Fixes: f2b852d909f9 ("eal: add lcore info in telemetry")
> Cc: rjarry@redhat.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>
> ---
>  lib/eal/common/eal_common_lcore.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/lib/eal/common/eal_common_lcore.c b/lib/eal/common/eal_common_lcore.c
> index ceda714ca5..0d6812ec75 100644
> --- a/lib/eal/common/eal_common_lcore.c
> +++ b/lib/eal/common/eal_common_lcore.c
> @@ -546,7 +546,8 @@ lcore_telemetry_info_cb(unsigned int lcore_id, void *arg)
>  		rte_tel_data_add_dict_uint(info->d, "busy_cycles", usage.busy_cycles);
>  	}
>  
> -	return 0;
> +	/* Return non-zero positive value to stop iterating over lcore_id. */
> +	return 1;
>  }

Hi Ruifeng, Nice catch.

Reviewed-by: Robin Jarry <rjarry@redhat.com>
  
Thomas Monjalon Nov. 6, 2023, 5:04 p.m. UTC | #3
> > Telemetry iterates on lcore ID to collect info of a specific lcore.
> > Since only one lcore is processed at a time, the iteration can stop
> > when a matching lcore is found.
> > 
> > Fixes: f2b852d909f9 ("eal: add lcore info in telemetry")
> > Cc: rjarry@redhat.com
> > Cc: stable@dpdk.org
> > 
> > Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>
> 
> Looks like a good optimization. Not sure it needs to go to stable.
> 
> Acked-by: Stephen Hemminger <stephen@networkplumber.org>

Applied without "Cc:stable", thanks.
  

Patch

diff --git a/lib/eal/common/eal_common_lcore.c b/lib/eal/common/eal_common_lcore.c
index ceda714ca5..0d6812ec75 100644
--- a/lib/eal/common/eal_common_lcore.c
+++ b/lib/eal/common/eal_common_lcore.c
@@ -546,7 +546,8 @@  lcore_telemetry_info_cb(unsigned int lcore_id, void *arg)
 		rte_tel_data_add_dict_uint(info->d, "busy_cycles", usage.busy_cycles);
 	}
 
-	return 0;
+	/* Return non-zero positive value to stop iterating over lcore_id. */
+	return 1;
 }
 
 static int