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 5B0B0A0C41; Mon, 2 Aug 2021 12:20:02 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 45EA441139; Mon, 2 Aug 2021 12:20:02 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id 9599441134 for ; Mon, 2 Aug 2021 12:20:01 +0200 (CEST) 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 E99B8D6E; Mon, 2 Aug 2021 03:20:00 -0700 (PDT) Received: from net-arm-n1sdp.shanghai.arm.com (net-arm-n1sdp.shanghai.arm.com [10.169.208.222]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 3BFF13F70D; Mon, 2 Aug 2021 03:19:53 -0700 (PDT) From: Joyce Kong To: thomas@monjalon.net, david.marchand@redhat.com, honnappa.nagarahalli@arm.com, ruifeng.wang@arm.com, konstantin.ananyev@intel.com, rsanford@akamai.com, erik.g.carrillo@intel.com, olivier.matz@6wind.com, yipeng1.wang@intel.com, sameh.gobriel@intel.com, bruce.richardson@intel.com, vladimir.medvedkin@intel.com, anatoly.burakov@intel.com, andrew.rybchenko@oktetlabs.ru, jerinj@marvell.com, declan.doherty@intel.com, ciara.power@intel.com, xiaoyun.li@intel.com, nicolas.chautru@intel.com, maryam.tahhan@intel.com, reshma.pattan@intel.com, cristian.dumitrescu@intel.com Cc: dev@dpdk.org, nd@arm.com Date: Mon, 2 Aug 2021 05:18:36 -0500 Message-Id: <20210802101847.3462-2-joyce.kong@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210802101847.3462-1-joyce.kong@arm.com> References: <20210802101847.3462-1-joyce.kong@arm.com> Subject: [dpdk-dev] [PATCH v1 01/12] test/pmd_perf: use compiler atomic builtins for polling sync 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 Sender: "dev" 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 | 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 #include #include -#include #include #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); 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); /* 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); /* wait for polling finished */ diff_tsc = rte_eal_wait_lcore(lcore); -- 2.17.1