DPDK patches and discussions
 help / color / mirror / Atom feed
From: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
To: Joyce Kong <Joyce.Kong@arm.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, nd <nd@arm.com>,
	Joyce Kong <Joyce.Kong@arm.com>,
	Ruifeng Wang <Ruifeng.Wang@arm.com>, nd <nd@arm.com>
Subject: RE: [PATCH v2 01/12] test/pmd_perf: use compiler atomic builtins for polling sync
Date: Tue, 16 Nov 2021 21:30:01 +0000	[thread overview]
Message-ID: <DBAPR08MB5814EF57F471D9D2657F04D798999@DBAPR08MB5814.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <20211116094205.750359-2-joyce.kong@arm.com>

<snip>

> 
> Convert rte_atomic usages to compiler atomic built-ins for polling sync in
> pmd_perf test cases.
> 
> Signed-off-by: Joyce Kong <joyce.kong@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> ---
>  app/test/test_pmd_perf.c | 14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c index
> 1df86ce080..546384a50d 100644
> --- a/app/test/test_pmd_perf.c
> +++ b/app/test/test_pmd_perf.c
> @@ -10,7 +10,6 @@
>  #include <rte_cycles.h>
>  #include <rte_ethdev.h>
>  #include <rte_byteorder.h>
> -#include <rte_atomic.h>
>  #include <rte_malloc.h>
>  #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,15 +614,15 @@ exec_burst(uint32_t flags, int lcore)
>  	pkt_per_port = MAX_TRAFFIC_BURST;
>  	num = pkt_per_port * conf->nb_ports;
> 
> -	rte_atomic64_init(&start);
> -
>  	/* start polling thread, but 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);
> +		__atomic_store_n(&start, 1, __ATOMIC_RELAXED);
> +	else
> +		__atomic_store_n(&start, 0, __ATOMIC_RELAXED);
These lines need to be moved up before calling rte_eal_remote_launch, so that update to start is visible to the worker threads.

> 
>  	/* start xmit */
>  	i = 0;
> @@ -641,7 +639,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


  reply	other threads:[~2021-11-16 21:30 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-16  9:41 [PATCH v2 00/12] use compiler atomic builtins for app modules Joyce Kong
2021-11-16  9:41 ` [PATCH v2 01/12] test/pmd_perf: use compiler atomic builtins for polling sync Joyce Kong
2021-11-16 21:30   ` Honnappa Nagarahalli [this message]
2021-11-16  9:41 ` [PATCH v2 02/12] test/ring_perf: use compiler atomic builtins for lcores sync Joyce Kong
2021-11-16  9:41 ` [PATCH v2 03/12] test/timer: use compiler atomic builtins for sync Joyce Kong
2021-11-16 19:52   ` Honnappa Nagarahalli
2021-11-16 20:20   ` David Marchand
2021-11-16 21:21     ` Honnappa Nagarahalli
2021-11-17  9:29       ` David Marchand
2021-11-16  9:41 ` [PATCH v2 04/12] test/stack_perf: use compiler atomics for lcore sync Joyce Kong
2021-11-16  9:41 ` [PATCH v2 05/12] test/bpf: use compiler atomics for calculation Joyce Kong
2021-11-16  9:41 ` [PATCH v2 06/12] test/func_reentrancy: use compiler atomics for data sync Joyce Kong
2021-11-16  9:42 ` [PATCH v2 07/12] app/eventdev: use compiler atomics for shared " Joyce Kong
2021-11-16  9:42 ` [PATCH v2 08/12] app/crypto: use compiler atomic builtins for display sync Joyce Kong
2021-11-16  9:42 ` [PATCH v2 09/12] app/compress: " Joyce Kong
2021-11-16 20:15   ` Honnappa Nagarahalli
2021-11-16  9:42 ` [PATCH v2 10/12] app/testpmd: remove atomic operations for port status Joyce Kong
2021-11-16 21:34   ` Honnappa Nagarahalli
2021-11-16  9:42 ` [PATCH v2 11/12] app/bbdev: use compiler atomics for shared data sync Joyce Kong
2021-11-16  9:42 ` [PATCH v2 12/12] app: remove unnecessary include of atomic header file Joyce Kong
2021-11-16 20:23   ` David Marchand
2021-11-17  7:05     ` Joyce Kong
2021-11-17  8:21 ` [PATCH v3 00/12] use compiler atomic builtins for app modules Joyce Kong
2021-11-17  8:21   ` [PATCH v3 01/12] test/pmd_perf: use compiler atomic builtins for polling sync Joyce Kong
2021-11-17  8:21   ` [PATCH v3 02/12] test/ring_perf: use compiler atomic builtins for lcores sync Joyce Kong
2021-11-17  8:21   ` [PATCH v3 03/12] test/timer: use compiler atomic builtins for sync Joyce Kong
2021-11-17  8:21   ` [PATCH v3 04/12] test/stack_perf: use compiler atomics for lcore sync Joyce Kong
2021-11-17  8:21   ` [PATCH v3 05/12] test/bpf: use compiler atomics for calculation Joyce Kong
2021-11-17  8:21   ` [PATCH v3 06/12] test/func_reentrancy: use compiler atomics for data sync Joyce Kong
2021-11-17  8:21   ` [PATCH v3 07/12] app/eventdev: use compiler atomics for shared " Joyce Kong
2021-11-17  8:21   ` [PATCH v3 08/12] app/crypto: use compiler atomic builtins for display sync Joyce Kong
2021-11-17  8:21   ` [PATCH v3 09/12] app/compress: " Joyce Kong
2021-11-17  8:21   ` [PATCH v3 10/12] app/testpmd: remove atomic operations for port status Joyce Kong
2021-11-17  8:21   ` [PATCH v3 11/12] app/bbdev: use compiler atomics for shared data sync Joyce Kong
2021-11-17  8:22   ` [PATCH v3 12/12] app: remove unnecessary include of atomic header file Joyce Kong
2021-11-17 10:02   ` [PATCH v3 00/12] use compiler atomic builtins for app modules 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=DBAPR08MB5814EF57F471D9D2657F04D798999@DBAPR08MB5814.eurprd08.prod.outlook.com \
    --to=honnappa.nagarahalli@arm.com \
    --cc=Joyce.Kong@arm.com \
    --cc=Ruifeng.Wang@arm.com \
    --cc=dev@dpdk.org \
    --cc=nd@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).