[PATCH v5 08/10] test-pmd: declare lcore_count atomic

Morten Brørup mb at smartsharesystems.com
Fri Feb 21 21:58:28 CET 2025


> From: Andre Muezerie [mailto:andremue at linux.microsoft.com]
> Sent: Friday, 21 February 2025 20.53
> 
> Compiling with MSVC results in the error below:
> 
> app/test/test_ring_perf.c(197): error C7712: address argument to atomic
>     operation must be a pointer to an atomic integer,
>     'volatile unsigned int *' is not valid
> 
> The fix is to mark lcore_count as atomic.
> 
> Signed-off-by: Andre Muezerie <andremue at linux.microsoft.com>
> Signed-off-by: Chengwen Feng <fengchengwen at huawei.com>
> ---
>  app/test/test_ring_perf.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/app/test/test_ring_perf.c b/app/test/test_ring_perf.c
> index 57cd04a124..921aa902c5 100644
> --- a/app/test/test_ring_perf.c
> +++ b/app/test/test_ring_perf.c
> @@ -34,7 +34,7 @@ struct lcore_pair {
>  	unsigned c1, c2;
>  };
> 
> -static volatile unsigned lcore_count = 0;
> +static volatile RTE_ATOMIC(unsigned int) lcore_count;

Using rte_atomic_xxx to access the RTE_ATOMIC qualified lcore_count seems more clean than making it volatile and sometimes access it non-atomically.
It is only accessed two more times, so not a big change.

Anyway, this could just be my personal preference. No change required if you disagree.



More information about the dev mailing list