From: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>
To: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>,
"dev@dpdk.org" <dev@dpdk.org>,
"david.marchand@redhat.com" <david.marchand@redhat.com>,
"feifei.wang2@arm.com" <feifei.wang2@arm.com>
Cc: "ruifeng.wang@arm.com" <ruifeng.wang@arm.com>,
"nd@arm.com" <nd@arm.com>, Ola Liljedahl <ola.liljedahl@arm.com>,
Feifei Wang <feifei.wang@arm.com>
Subject: Re: [dpdk-dev] [PATCH v2 6/6] test/ring: use relaxed barriers for ring stress test
Date: Thu, 7 Oct 2021 11:55:02 +0000 [thread overview]
Message-ID: <DM6PR11MB449169A0EFAE7B24076120E59AB19@DM6PR11MB4491.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20210909231312.2572006-7-honnappa.nagarahalli@arm.com>
> wrk_cmd variable is used to signal the worker thread to start
> or stop the stress test loop. Relaxed barriers are used
> to achieve the same.
>
> Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> Reviewed-by: Ola Liljedahl <ola.liljedahl@arm.com>
> Reviewed-by: Feifei Wang <feifei.wang@arm.com>
> ---
> app/test/test_ring_stress_impl.h | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/app/test/test_ring_stress_impl.h b/app/test/test_ring_stress_impl.h
> index f9ca63b908..ee8293bb04 100644
> --- a/app/test/test_ring_stress_impl.h
> +++ b/app/test/test_ring_stress_impl.h
> @@ -22,7 +22,7 @@ enum {
> WRK_CMD_RUN,
> };
>
> -static volatile uint32_t wrk_cmd __rte_cache_aligned;
> +static volatile uint32_t wrk_cmd __rte_cache_aligned = WRK_CMD_STOP;
If we switch to using atomic load/store for 'wrk_cmd',
then we can get remove 'volatile' classifier in the 'wrk_cmd' definition above?
>
> /* test run-time in seconds */
> static const uint32_t run_time = 60;
> @@ -197,10 +197,12 @@ test_worker(void *arg, const char *fname, int32_t prcs)
> fill_ring_elm(&def_elm, UINT32_MAX);
> fill_ring_elm(&loc_elm, lc);
>
> - while (wrk_cmd != WRK_CMD_RUN) {
> - rte_smp_rmb();
> + /* Acquire ordering is not required as the main is not
> + * really releasing any data through 'wrk_cmd' to
> + * the worker.
> + */
> + while (__atomic_load_n(&wrk_cmd, __ATOMIC_RELAXED) != WRK_CMD_RUN)
> rte_pause();
> - }
>
> cl = rte_rdtsc_precise();
>
> @@ -242,7 +244,7 @@ test_worker(void *arg, const char *fname, int32_t prcs)
>
> lcore_stat_update(&la->stats, 1, num, tm0 + tm1, prcs);
>
> - } while (wrk_cmd == WRK_CMD_RUN);
> + } while (__atomic_load_n(&wrk_cmd, __ATOMIC_RELAXED) == WRK_CMD_RUN);
>
> cl = rte_rdtsc_precise() - cl;
> if (prcs == 0)
> @@ -356,14 +358,12 @@ test_mt1(int (*test)(void *))
> }
>
> /* signal worker to start test */
> - wrk_cmd = WRK_CMD_RUN;
> - rte_smp_wmb();
> + __atomic_store_n(&wrk_cmd, WRK_CMD_RUN, __ATOMIC_RELEASE);
>
> usleep(run_time * US_PER_S);
>
> /* signal worker to start test */
> - wrk_cmd = WRK_CMD_STOP;
> - rte_smp_wmb();
> + __atomic_store_n(&wrk_cmd, WRK_CMD_STOP, __ATOMIC_RELEASE);
>
> /* wait for workers and collect stats. */
> mc = rte_lcore_id();
> --
> 2.25.1
next prev parent reply other threads:[~2021-10-07 11:55 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-24 21:20 [dpdk-dev] [RFC 0/5] Use correct memory ordering in eal functions Honnappa Nagarahalli
2021-02-24 21:20 ` [dpdk-dev] [RFC 1/5] eal: reset lcore function pointer and argument Honnappa Nagarahalli
2021-02-24 21:20 ` [dpdk-dev] [RFC 2/5] eal: ensure memory operations are visible to worker Honnappa Nagarahalli
2021-02-24 21:20 ` [dpdk-dev] [RFC 3/5] eal: lcore state FINISHED is not required Honnappa Nagarahalli
[not found] ` <AM5PR0802MB2465B62994239817E0AC46C59E9E9@AM5PR0802MB2465.eurprd08.prod.outlook.com>
2021-02-25 8:44 ` [dpdk-dev] 回复: " Feifei Wang
2021-02-25 23:33 ` [dpdk-dev] " Honnappa Nagarahalli
2021-02-26 8:26 ` Thomas Monjalon
2021-03-02 3:13 ` Honnappa Nagarahalli
2021-03-19 13:42 ` Ananyev, Konstantin
2021-03-30 2:54 ` Honnappa Nagarahalli
2021-03-01 5:55 ` [dpdk-dev] 回复: " Feifei Wang
2021-02-24 21:20 ` [dpdk-dev] [RFC 4/5] eal: ensure memory operations are visible to main Honnappa Nagarahalli
2021-02-24 21:20 ` [dpdk-dev] [RFC 5/5] test/ring: use relaxed barriers for ring stress test Honnappa Nagarahalli
2021-03-01 16:41 ` [dpdk-dev] [RFC 0/5] Use correct memory ordering in eal functions Stephen Hemminger
2021-03-02 16:06 ` Honnappa Nagarahalli
2021-09-09 23:13 ` [dpdk-dev] [PATCH v2 0/6] " Honnappa Nagarahalli
2021-09-09 23:13 ` [dpdk-dev] [PATCH v2 1/6] eal: reset lcore function pointer and argument Honnappa Nagarahalli
2021-09-10 7:49 ` Bruce Richardson
2021-09-10 8:12 ` David Marchand
2021-09-11 22:19 ` Honnappa Nagarahalli
2021-09-09 23:13 ` [dpdk-dev] [PATCH v2 2/6] eal: ensure memory operations are visible to worker Honnappa Nagarahalli
2021-09-09 23:13 ` [dpdk-dev] [PATCH v2 3/6] eal: lcore state FINISHED is not required Honnappa Nagarahalli
2021-09-09 23:13 ` [dpdk-dev] [PATCH v2 4/6] eal: update rte_eal_wait_lcore definition Honnappa Nagarahalli
2021-09-09 23:37 ` Honnappa Nagarahalli
2021-09-09 23:13 ` [dpdk-dev] [PATCH v2 5/6] eal: ensure memory operations are visible to main Honnappa Nagarahalli
2021-09-09 23:13 ` [dpdk-dev] [PATCH v2 6/6] test/ring: use relaxed barriers for ring stress test Honnappa Nagarahalli
2021-10-07 11:55 ` Ananyev, Konstantin [this message]
2021-10-07 23:40 ` Honnappa Nagarahalli
2021-10-25 4:52 ` [dpdk-dev] [PATCH v3 0/4] Use correct memory ordering in eal functions Honnappa Nagarahalli
2021-10-25 4:52 ` [dpdk-dev] [PATCH v3 1/4] eal: reset lcore function pointer and argument Honnappa Nagarahalli
2021-10-25 4:52 ` [dpdk-dev] [PATCH v3 2/4] eal: lcore state FINISHED is not required Honnappa Nagarahalli
2021-10-25 4:52 ` [dpdk-dev] [PATCH v3 3/4] eal: use correct memory ordering Honnappa Nagarahalli
2021-10-25 4:52 ` [dpdk-dev] [PATCH v3 4/4] test/ring: use relaxed barriers for ring stress test Honnappa Nagarahalli
2021-10-25 16:23 ` [dpdk-dev] [PATCH v3 0/4] Use correct memory ordering in eal functions David Marchand
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=DM6PR11MB449169A0EFAE7B24076120E59AB19@DM6PR11MB4491.namprd11.prod.outlook.com \
--to=konstantin.ananyev@intel.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=feifei.wang2@arm.com \
--cc=feifei.wang@arm.com \
--cc=honnappa.nagarahalli@arm.com \
--cc=nd@arm.com \
--cc=ola.liljedahl@arm.com \
--cc=ruifeng.wang@arm.com \
/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).