Thread (49 messages) 49 messages, 8 authors, 2021-07-30

Re: [dpdk-dev] [PATCH v3 8/8] test/rcu: use compiler atomics for data sync

From: Andrew Rybchenko <hidden>
Date: 2021-07-23 19:52:06

On 7/20/21 6:51 AM, Joyce Kong wrote:
quoted hunk ↗ jump to hunk
Covert rte_atomic usages to compiler atomic built-ins in
rcu_perf testcases.

Signed-off-by: Joyce Kong <redacted>
Reviewed-by: Ruifeng Wang <redacted>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
---
  app/test/test_rcu_qsbr_perf.c | 98 +++++++++++++++++------------------
  1 file changed, 49 insertions(+), 49 deletions(-)
diff --git a/app/test/test_rcu_qsbr_perf.c b/app/test/test_rcu_qsbr_perf.c
index 3017e71120..cf7b158d22 100644
--- a/app/test/test_rcu_qsbr_perf.c
+++ b/app/test/test_rcu_qsbr_perf.c
@@ -30,8 +30,8 @@ static volatile uint32_t thr_id;
  static struct rte_rcu_qsbr *t[RTE_MAX_LCORE];
  static struct rte_hash *h;
  static char hash_name[8];
-static rte_atomic64_t updates, checks;
-static rte_atomic64_t update_cycles, check_cycles;
+static uint64_t updates, checks;
+static uint64_t update_cycles, check_cycles;
  
  /* Scale down results to 1000 operations to support lower
   * granularity clocks.
@@ -81,8 +81,8 @@ test_rcu_qsbr_reader_perf(void *arg)
  	}
  
  	cycles = rte_rdtsc_precise() - begin;
-	rte_atomic64_add(&update_cycles, cycles);
-	rte_atomic64_add(&updates, loop_cnt);
+	__atomic_fetch_add(&update_cycles, cycles, __ATOMIC_RELAXED);
+	__atomic_fetch_add(&updates, loop_cnt, __ATOMIC_RELAXED);
Shouldn't __atomic_add_fetch() be used instead since it pseudo-code is
a bit simpler. What is the best option if return value is not actually
used?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help