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 6E7BDA0C50; Fri, 23 Jul 2021 21:52:05 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DF57840DDA; Fri, 23 Jul 2021 21:52:04 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 42ACA406A3 for ; Fri, 23 Jul 2021 21:52:04 +0200 (CEST) Received: from [192.168.100.116] (unknown [37.139.99.76]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id 2F8ED7F510; Fri, 23 Jul 2021 22:52:03 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 2F8ED7F510 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1627069923; bh=+MeQDcsdKSr6eGwFth4n8+T14hro0RBcjtBqlfO62+A=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=dbmPcY7qU+MKz7E8J9iJ0SeoDUvMFh/GuyaZ7oK9KKIUSsljmt5f7zX742xyu5JUb t2tUuQ61A9L809QC7N702pdKoMPMul4uEPc+OW7xPjz5YlATSt84wT2PG24NfhAcrj dQFK5VTQnowmlu4pieE8Ns4txPq/z9xOJqgx2s24= To: Joyce Kong , thomas@monjalon.net, david.marchand@redhat.com, roretzla@linux.microsoft.com, stephen@networkplumber.org, olivier.matz@6wind.com, harry.van.haaren@intel.com, honnappa.nagarahalli@arm.com, ruifeng.wang@arm.com Cc: dev@dpdk.org, nd@arm.com References: <20210616025459.22717-1-joyce.kong@arm.com> <20210720035125.14214-1-joyce.kong@arm.com> <20210720035125.14214-9-joyce.kong@arm.com> From: Andrew Rybchenko Message-ID: <1eda5308-51b7-c9d2-4837-5bdb43586641@oktetlabs.ru> Date: Fri, 23 Jul 2021 22:52:02 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <20210720035125.14214-9-joyce.kong@arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v3 8/8] test/rcu: use compiler atomics for data 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" On 7/20/21 6:51 AM, Joyce Kong wrote: > Covert rte_atomic usages to compiler atomic built-ins in > rcu_perf testcases. > > Signed-off-by: Joyce Kong > Reviewed-by: Ruifeng Wang > Acked-by: Stephen Hemminger > --- > 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?