> <snip> > > > > > Convert rte_atomic usages to compiler atomic built-ins for polling > > sync in pmd_perf test cases. > > > > Signed-off-by: Joyce Kong <joyce.k...@arm.com> > > Reviewed-by: Ruifeng Wang <ruifeng.w...@arm.com> > > --- > > app/test/test_pmd_perf.c | 12 +++++------- > > 1 file changed, 5 insertions(+), 7 deletions(-) > > > > diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c index > > 3a248d512c..41ef001b90 100644 > > --- a/app/test/test_pmd_perf.c > > +++ b/app/test/test_pmd_perf.c > > @@ -10,7 +10,6 @@ > > #include <rte_cycles.h> > > #include <rte_ethdev.h> > > #include <rte_byteorder.h> > > -#include <rte_atomic.h> > > #include <rte_malloc.h> > > #include "packet_burst_generator.h" > > #include "test.h" > > @@ -526,7 +525,7 @@ main_loop(__rte_unused void *args) > > return 0; > > } > > > > -static rte_atomic64_t start; > > +static uint64_t start; > > > > static inline int > > poll_burst(void *args) > > @@ -564,8 +563,7 @@ poll_burst(void *args) > > num[portid] = pkt_per_port; > > } > > > > - while (!rte_atomic64_read(&start)) > > - ; > > + rte_wait_until_equal_64(&start, 1, __ATOMIC_RELAXED); > This needs to be ACQUIRE. Please see comments below for function > 'exec_burst'. > > > > > cur_tsc = rte_rdtsc(); > > while (total) { > > @@ -617,7 +615,7 @@ exec_burst(uint32_t flags, int lcore) > > pkt_per_port = MAX_TRAFFIC_BURST; > > num = pkt_per_port * conf->nb_ports; > > > > - rte_atomic64_init(&start); > > + __atomic_store_n(&start, 0, __ATOMIC_RELAXED); > > > > /* start polling thread, but not actually poll yet */ > > rte_eal_remote_launch(poll_burst, > > @@ -625,7 +623,7 @@ exec_burst(uint32_t flags, int lcore) > > > > /* Only when polling first */ > > if (flags == SC_BURST_POLL_FIRST) > > - rte_atomic64_set(&start, 1); > > + __atomic_store_n(&start, 1, __ATOMIC_RELAXED); > This line can be combined with initialization of 'start'. i.e. > if (flags == SC_BURST_POLL_FIRST) { > __atomic_store_n(&start, 1, __ATOMIC_RELAXED); } else { > __atomic_store_n(&start, 0, __ATOMIC_RELAXED); } It is ok to use > RELAXED here as it is part of initialization and 'rte_eal_remote_launch' will > ensure that the store to 'start' is visible to the worker thread. > > > > > /* start xmit */ > > i = 0; > > @@ -642,7 +640,7 @@ exec_burst(uint32_t flags, int lcore) > > > > /* only when polling second */ > > if (flags == SC_BURST_XMIT_FIRST) > > - rte_atomic64_set(&start, 1); > > + __atomic_store_n(&start, 1, __ATOMIC_RELAXED); > This store should happen after transmitting the packets. It is better to use > RELEASE here.
Thanks, Honnappa, will make the changes in next version. Joyce > > > > > /* wait for polling finished */ > > diff_tsc = rte_eal_wait_lcore(lcore); > > -- > > 2.17.1