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 7BBD9A0C41; Wed, 17 Nov 2021 09:22:34 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2A2C64111C; Wed, 17 Nov 2021 09:22:29 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id 2371341147 for ; Wed, 17 Nov 2021 09:22:28 +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 6EA026D; Wed, 17 Nov 2021 00:22:27 -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 987583F5A1; Wed, 17 Nov 2021 00:22:25 -0800 (PST) From: Joyce Kong To: Cc: dev@dpdk.org, honnappa.nagarahalli@arm.com, nd@arm.com, Joyce Kong , Ruifeng Wang Subject: [PATCH v3 01/12] test/pmd_perf: use compiler atomic builtins for polling sync Date: Wed, 17 Nov 2021 08:21:49 +0000 Message-Id: <20211117082200.1029621-2-joyce.kong@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211117082200.1029621-1-joyce.kong@arm.com> References: <20211116094205.750359-1-joyce.kong@arm.com> <20211117082200.1029621-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 polling sync in pmd_perf test cases. Signed-off-by: Joyce Kong Reviewed-by: Ruifeng Wang --- app/test/test_pmd_perf.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c index 1df86ce080..a6bac9d45e 100644 --- a/app/test/test_pmd_perf.c +++ b/app/test/test_pmd_perf.c @@ -10,7 +10,6 @@ #include #include #include -#include #include #include "packet_burst_generator.h" #include "test.h" @@ -525,7 +524,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) @@ -563,8 +562,7 @@ poll_burst(void *args) num[portid] = pkt_per_port; } - while (!rte_atomic64_read(&start)) - ; + rte_wait_until_equal_64(&start, 1, __ATOMIC_ACQUIRE); cur_tsc = rte_rdtsc(); while (total) { @@ -616,16 +614,19 @@ exec_burst(uint32_t flags, int lcore) pkt_per_port = MAX_TRAFFIC_BURST; num = pkt_per_port * conf->nb_ports; - rte_atomic64_init(&start); + /* only when polling first */ + if (flags == SC_BURST_POLL_FIRST) + __atomic_store_n(&start, 1, __ATOMIC_RELAXED); + else + __atomic_store_n(&start, 0, __ATOMIC_RELAXED); - /* start polling thread, but not actually poll yet */ + /* start polling thread + * if in POLL_FIRST mode, poll once launched; + * otherwise, not actually poll yet + */ rte_eal_remote_launch(poll_burst, (void *)&pkt_per_port, lcore); - /* Only when polling first */ - if (flags == SC_BURST_POLL_FIRST) - rte_atomic64_set(&start, 1); - /* start xmit */ i = 0; while (num) { @@ -641,7 +642,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_RELEASE); /* wait for polling finished */ diff_tsc = rte_eal_wait_lcore(lcore); -- 2.25.1