[PATCH v5 08/10] test-pmd: declare lcore_count atomic
Andre Muezerie
andremue at linux.microsoft.com
Mon Feb 24 17:22:36 CET 2025
On Fri, Feb 21, 2025 at 09:58:28PM +0100, Morten Brørup wrote:
> > 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.
Makes sense. I'll send an updated series.
More information about the dev
mailing list