From: Joyce Kong <Joyce.Kong@arm.com>
To: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
"thomas@monjalon.net" <thomas@monjalon.net>,
"david.marchand@redhat.com" <david.marchand@redhat.com>,
"roretzla@linux.microsoft.com" <roretzla@linux.microsoft.com>,
"stephen@networkplumber.org" <stephen@networkplumber.org>,
"olivier.matz@6wind.com" <olivier.matz@6wind.com>,
"harry.van.haaren@intel.com" <harry.van.haaren@intel.com>,
Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>,
Ruifeng Wang <Ruifeng.Wang@arm.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, nd <nd@arm.com>
Subject: Re: [dpdk-dev] [PATCH v3 8/8] test/rcu: use compiler atomics for data sync
Date: Wed, 28 Jul 2021 07:07:08 +0000 [thread overview]
Message-ID: <AS8PR08MB693577C24523958332E30B5E92EA9@AS8PR08MB6935.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <1eda5308-51b7-c9d2-4837-5bdb43586641@oktetlabs.ru>
> -----Original Message-----
> From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> Sent: Saturday, July 24, 2021 3:52 AM
> To: Joyce Kong <Joyce.Kong@arm.com>; 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
> <Honnappa.Nagarahalli@arm.com>; Ruifeng Wang
> <Ruifeng.Wang@arm.com>
> Cc: dev@dpdk.org; nd <nd@arm.com>
> Subject: Re: [PATCH v3 8/8] test/rcu: use compiler atomics for data sync
>
> 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 <joyce.kong@arm.com>
> > Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> > Acked-by: Stephen Hemminger <stephen@networkplumber.org>
> > ---
> > 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?
If the return value is not used, like the situations here, the instructions for __atomic_fetch_add() and __atomic_add_fetch() would be the same on X86 and Arm for gcc and clang that I have tried.
If the return value is used, __atomic_add_fetch() would do two more instructions('mov' 'add') than __atomic_fetch_add() to return the calculation result.
Based on experiments here: https://godbolt.org/ .
next prev parent reply other threads:[~2021-07-28 7:07 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-04 9:46 [dpdk-dev] [PATCH v1 0/8] use GCC's C11 atomic builtins for test Joyce Kong
2021-06-04 9:46 ` [dpdk-dev] [PATCH v1 1/8] test/ticketlock: use GCC atomic builtins for lcores sync Joyce Kong
2021-06-04 9:46 ` [dpdk-dev] [PATCH v1 2/8] test/spinlock: " Joyce Kong
2021-06-04 9:46 ` [dpdk-dev] [PATCH v1 3/8] test/rwlock: " Joyce Kong
2021-06-04 9:46 ` [dpdk-dev] [PATCH v1 4/8] test/mcslock: " Joyce Kong
2021-06-04 9:46 ` [dpdk-dev] [PATCH v1 5/8] test/mempool: remove unused variable " Joyce Kong
2021-06-04 9:46 ` [dpdk-dev] [PATCH v1 6/8] test/mempool_perf: use GCC atomic builtins " Joyce Kong
2021-06-04 9:46 ` [dpdk-dev] [PATCH v1 7/8] test/service_cores: use GCC atomic builtins for lock sync Joyce Kong
2021-06-04 9:46 ` [dpdk-dev] [PATCH v1 8/8] test/rcu_perf: use GCC atomic builtins for data sync Joyce Kong
2021-06-04 19:57 ` [dpdk-dev] [PATCH v1 0/8] use GCC's C11 atomic builtins for test Stephen Hemminger
2021-06-11 8:40 ` David Marchand
2021-06-11 10:45 ` Joyce Kong
2021-06-16 2:54 ` [dpdk-dev] [PATCH v2 " Joyce Kong
2021-06-16 2:54 ` [dpdk-dev] [PATCH v2 1/8] test/ticketlock: use GCC atomic builtins for lcores sync Joyce Kong
2021-06-16 2:54 ` [dpdk-dev] [PATCH v2 2/8] test/spinlock: " Joyce Kong
2021-06-16 2:54 ` [dpdk-dev] [PATCH v2 3/8] test/rwlock: " Joyce Kong
2021-06-16 2:54 ` [dpdk-dev] [PATCH v2 4/8] test/mcslock: " Joyce Kong
2021-06-16 2:54 ` [dpdk-dev] [PATCH v2 5/8] test/mempool: remove unused variable " Joyce Kong
2021-06-16 2:54 ` [dpdk-dev] [PATCH v2 6/8] test/mempool_perf: use GCC atomic builtins " Joyce Kong
2021-06-16 2:54 ` [dpdk-dev] [PATCH v2 7/8] test/service_cores: use GCC atomic builtins for lock sync Joyce Kong
2021-06-16 2:54 ` [dpdk-dev] [PATCH v2 8/8] test/rcu: use GCC atomic builtins for data sync Joyce Kong
2021-06-17 15:21 ` [dpdk-dev] [PATCH v2 0/8] use GCC's C11 atomic builtins for test Tyler Retzlaff
2021-06-17 23:26 ` Honnappa Nagarahalli
2021-06-23 10:24 ` Thomas Monjalon
2021-06-23 16:02 ` Tyler Retzlaff
2021-06-29 17:04 ` Honnappa Nagarahalli
2021-06-30 18:51 ` Tyler Retzlaff
2021-06-30 19:06 ` Honnappa Nagarahalli
2021-06-30 19:38 ` Tyler Retzlaff
2021-06-30 20:25 ` Honnappa Nagarahalli
2021-06-30 21:49 ` Tyler Retzlaff
2021-06-30 22:41 ` Honnappa Nagarahalli
2021-07-13 7:28 ` Joyce Kong
2021-07-14 11:44 ` Thomas Monjalon
2021-07-20 3:51 ` [dpdk-dev] [PATCH v3 0/8] use compiler " Joyce Kong
2021-07-20 3:51 ` [dpdk-dev] [PATCH v3 1/8] test/ticketlock: use compiler atomics for lcores sync Joyce Kong
2021-07-20 3:51 ` [dpdk-dev] [PATCH v3 2/8] test/spinlock: use compile " Joyce Kong
2021-07-20 3:51 ` [dpdk-dev] [PATCH v3 3/8] test/rwlock: use compiler " Joyce Kong
2021-07-20 3:51 ` [dpdk-dev] [PATCH v3 4/8] test/mcslock: " Joyce Kong
2021-07-28 9:56 ` Olivier Matz
2021-07-29 7:19 ` Joyce Kong
2021-07-29 7:58 ` Olivier Matz
2021-07-20 3:51 ` [dpdk-dev] [PATCH v3 5/8] test/mempool: remove unused variable " Joyce Kong
2021-07-20 3:51 ` [dpdk-dev] [PATCH v3 6/8] test/mempool_perf: use compiler atomics " Joyce Kong
2021-07-20 3:51 ` [dpdk-dev] [PATCH v3 7/8] test/service_cores: use compiler atomics for lock sync Joyce Kong
2021-07-20 3:51 ` [dpdk-dev] [PATCH v3 8/8] test/rcu: use compiler atomics for data sync Joyce Kong
2021-07-23 19:52 ` Andrew Rybchenko
2021-07-28 7:07 ` Joyce Kong [this message]
2021-07-30 21:58 ` [dpdk-dev] [PATCH v3 0/8] use compiler atomic builtins for test Thomas Monjalon
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=AS8PR08MB693577C24523958332E30B5E92EA9@AS8PR08MB6935.eurprd08.prod.outlook.com \
--to=joyce.kong@arm.com \
--cc=Honnappa.Nagarahalli@arm.com \
--cc=Ruifeng.Wang@arm.com \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=harry.van.haaren@intel.com \
--cc=nd@arm.com \
--cc=olivier.matz@6wind.com \
--cc=roretzla@linux.microsoft.com \
--cc=stephen@networkplumber.org \
--cc=thomas@monjalon.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).