From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EF927A0C43; Tue, 16 Nov 2021 10:42:56 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 88DFA4117D; Tue, 16 Nov 2021 10:42:55 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id 9CACF41157 for ; Tue, 16 Nov 2021 10:42:54 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 207B1ED1; Tue, 16 Nov 2021 01:42:54 -0800 (PST) Received: from net-arm-n1amp-02.shanghai.arm.com (net-arm-n1amp-02.shanghai.arm.com [10.169.210.110]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 0B0DF3F5A1; Tue, 16 Nov 2021 01:42:51 -0800 (PST) From: Joyce Kong To: Honnappa Nagarahalli , Konstantin Ananyev Cc: dev@dpdk.org, nd@arm.com, Joyce Kong , Ruifeng Wang Subject: [PATCH v2 02/12] test/ring_perf: use compiler atomic builtins for lcores sync Date: Tue, 16 Nov 2021 09:41:55 +0000 Message-Id: <20211116094205.750359-3-joyce.kong@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211116094205.750359-1-joyce.kong@arm.com> References: <20211116094205.750359-1-joyce.kong@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Convert rte_atomic usages to compiler atomic built-ins for lcores sync in ring_perf test cases. Signed-off-by: Joyce Kong Reviewed-by: Ruifeng Wang Reviewed-by: Honnappa Nagarahalli --- 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, ¶m, 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(¶m); rte_eal_mp_wait_lcore(); -- 2.25.1