All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joyce Kong <joyce.kong@arm.com>
To: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>,
	Konstantin Ananyev <konstantin.ananyev@intel.com>
Cc: dev@dpdk.org, nd@arm.com, Joyce Kong <joyce.kong@arm.com>,
	Ruifeng Wang <ruifeng.wang@arm.com>
Subject: [PATCH v2 02/12] test/ring_perf: use compiler atomic builtins for lcores sync
Date: Tue, 16 Nov 2021 09:41:55 +0000	[thread overview]
Message-ID: <20211116094205.750359-3-joyce.kong@arm.com> (raw)
In-Reply-To: <20211116094205.750359-1-joyce.kong@arm.com>

Convert rte_atomic usages to compiler atomic built-ins
for lcores sync in ring_perf test cases.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
---
 app/test/test_ring_perf.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/app/test/test_ring_perf.c b/app/test/test_ring_perf.c
index fd82e20412..2d8bb675a3 100644
--- a/app/test/test_ring_perf.c
+++ b/app/test/test_ring_perf.c
@@ -320,7 +320,7 @@ run_on_core_pair(struct lcore_pair *cores, struct rte_ring *r, const int esize)
 	return 0;
 }
 
-static rte_atomic32_t synchro;
+static uint32_t synchro;
 static uint64_t queue_count[RTE_MAX_LCORE];
 
 #define TIME_MS 100
@@ -342,8 +342,7 @@ load_loop_fn_helper(struct thread_params *p, const int esize)
 
 	/* wait synchro for workers */
 	if (lcore != rte_get_main_lcore())
-		while (rte_atomic32_read(&synchro) == 0)
-			rte_pause();
+		rte_wait_until_equal_32(&synchro, 1, __ATOMIC_RELAXED);
 
 	begin = rte_get_timer_cycles();
 	while (time_diff < hz * TIME_MS / 1000) {
@@ -398,12 +397,12 @@ run_on_all_cores(struct rte_ring *r, const int esize)
 		param.r = r;
 
 		/* clear synchro and start workers */
-		rte_atomic32_set(&synchro, 0);
+		__atomic_store_n(&synchro, 0, __ATOMIC_RELAXED);
 		if (rte_eal_mp_remote_launch(lcore_f, &param, SKIP_MAIN) < 0)
 			return -1;
 
 		/* start synchro and launch test on main */
-		rte_atomic32_set(&synchro, 1);
+		__atomic_store_n(&synchro, 1, __ATOMIC_RELAXED);
 		lcore_f(&param);
 
 		rte_eal_mp_wait_lcore();
-- 
2.25.1


  parent reply	other threads:[~2021-11-16  9:42 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-16  9:41 [PATCH v2 00/12] use compiler atomic builtins for app modules Joyce Kong
2021-11-16  9:41 ` [PATCH v2 01/12] test/pmd_perf: use compiler atomic builtins for polling sync Joyce Kong
2021-11-16 21:30   ` Honnappa Nagarahalli
2021-11-16  9:41 ` Joyce Kong [this message]
2021-11-16  9:41 ` [PATCH v2 03/12] test/timer: use compiler atomic builtins for sync Joyce Kong
2021-11-16 19:52   ` Honnappa Nagarahalli
2021-11-16 20:20   ` David Marchand
2021-11-16 21:21     ` Honnappa Nagarahalli
2021-11-17  9:29       ` David Marchand
2021-11-16  9:41 ` [PATCH v2 04/12] test/stack_perf: use compiler atomics for lcore sync Joyce Kong
2021-11-16  9:41 ` [PATCH v2 05/12] test/bpf: use compiler atomics for calculation Joyce Kong
2021-11-16  9:41 ` [PATCH v2 06/12] test/func_reentrancy: use compiler atomics for data sync Joyce Kong
2021-11-16  9:42 ` [PATCH v2 07/12] app/eventdev: use compiler atomics for shared " Joyce Kong
2021-11-16  9:42 ` [PATCH v2 08/12] app/crypto: use compiler atomic builtins for display sync Joyce Kong
2021-11-16  9:42 ` [PATCH v2 09/12] app/compress: " Joyce Kong
2021-11-16 20:15   ` Honnappa Nagarahalli
2021-11-16  9:42 ` [PATCH v2 10/12] app/testpmd: remove atomic operations for port status Joyce Kong
2021-11-16 21:34   ` Honnappa Nagarahalli
2021-11-16  9:42 ` [PATCH v2 11/12] app/bbdev: use compiler atomics for shared data sync Joyce Kong
2021-11-16  9:42 ` [PATCH v2 12/12] app: remove unnecessary include of atomic header file Joyce Kong
2021-11-16 20:23   ` David Marchand
2021-11-17  7:05     ` Joyce Kong
2021-11-17  8:21 ` [PATCH v3 00/12] use compiler atomic builtins for app modules Joyce Kong
2021-11-17  8:21   ` [PATCH v3 01/12] test/pmd_perf: use compiler atomic builtins for polling sync Joyce Kong
2021-11-17  8:21   ` [PATCH v3 02/12] test/ring_perf: use compiler atomic builtins for lcores sync Joyce Kong
2021-11-17  8:21   ` [PATCH v3 03/12] test/timer: use compiler atomic builtins for sync Joyce Kong
2021-11-17  8:21   ` [PATCH v3 04/12] test/stack_perf: use compiler atomics for lcore sync Joyce Kong
2021-11-17  8:21   ` [PATCH v3 05/12] test/bpf: use compiler atomics for calculation Joyce Kong
2021-11-17  8:21   ` [PATCH v3 06/12] test/func_reentrancy: use compiler atomics for data sync Joyce Kong
2021-11-17  8:21   ` [PATCH v3 07/12] app/eventdev: use compiler atomics for shared " Joyce Kong
2021-11-17  8:21   ` [PATCH v3 08/12] app/crypto: use compiler atomic builtins for display sync Joyce Kong
2021-11-17  8:21   ` [PATCH v3 09/12] app/compress: " Joyce Kong
2021-11-17  8:21   ` [PATCH v3 10/12] app/testpmd: remove atomic operations for port status Joyce Kong
2021-11-17  8:21   ` [PATCH v3 11/12] app/bbdev: use compiler atomics for shared data sync Joyce Kong
2021-11-17  8:22   ` [PATCH v3 12/12] app: remove unnecessary include of atomic header file Joyce Kong
2021-11-17 10:02   ` [PATCH v3 00/12] use compiler atomic builtins for app modules David Marchand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211116094205.750359-3-joyce.kong@arm.com \
    --to=joyce.kong@arm.com \
    --cc=dev@dpdk.org \
    --cc=honnappa.nagarahalli@arm.com \
    --cc=konstantin.ananyev@intel.com \
    --cc=nd@arm.com \
    --cc=ruifeng.wang@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.