All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Phil Yang (Arm Technology China)" <Phil.Yang@arm.com>
To: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>,
	"dev@dpdk.org" <dev@dpdk.org>,
	"thomas@monjalon.net" <thomas@monjalon.net>
Cc: "david.hunt@intel.com" <david.hunt@intel.com>,
	"reshma.pattan@intel.com" <reshma.pattan@intel.com>,
	"Gavin Hu (Arm Technology China)" <Gavin.Hu@arm.com>,
	nd <nd@arm.com>, nd <nd@arm.com>, nd <nd@arm.com>
Subject: Re: [PATCH v2 2/3] test/distributor: replace sync builtins with atomic builtins
Date: Tue, 2 Apr 2019 03:43:14 +0000	[thread overview]
Message-ID: <DB7PR08MB338537708BF43E6807050352E9560@DB7PR08MB3385.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <VE1PR08MB5149660EBE4A3584B002198D98550@VE1PR08MB5149.eurprd08.prod.outlook.com>

> -----Original Message-----
> From: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
> Sent: Tuesday, April 2, 2019 12:24 AM
> To: Phil Yang (Arm Technology China) <Phil.Yang@arm.com>; dev@dpdk.org;
> thomas@monjalon.net
> Cc: david.hunt@intel.com; reshma.pattan@intel.com; Gavin Hu (Arm
> Technology China) <Gavin.Hu@arm.com>; Phil Yang (Arm Technology China)
> <Phil.Yang@arm.com>; nd <nd@arm.com>; Honnappa Nagarahalli
> <Honnappa.Nagarahalli@arm.com>; nd <nd@arm.com>
> Subject: RE: [PATCH v2 2/3] test/distributor: replace sync builtins with atomic
> builtins
> 
> >
> > diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c
> > index 98919ec..ddab08d 100644
> > --- a/app/test/test_distributor.c
> > +++ b/app/test/test_distributor.c
> > @@ -62,9 +62,14 @@ handle_work(void *arg)
> >  	struct worker_params *wp = arg;
> >  	struct rte_distributor *db = wp->dist;
> >  	unsigned int count = 0, num = 0;
> > -	unsigned int id = __sync_fetch_and_add(&worker_idx, 1);
> >  	int i;
> >
> > +#ifdef RTE_USE_C11_MEM_MODEL
> > +	unsigned int id = __atomic_fetch_add(&worker_idx, 1,
> > +__ATOMIC_RELAXED); #else
> > +	unsigned int id = __sync_fetch_and_add(&worker_idx, 1); #endif
> > +
> I suggest we remove the conditional compilation and just keep the
> __atomic_xxx calls as this is test code. More over the distributor library does
> not have a C11 version of the library (assuming that using __atomic_xxx does
> not impact performance on other platforms negatively). This applies to other
> instances in this patch.
Hi Honnappa,

Thanks for your comments.
Agree. I don't think __atomic_xxx will cause performance degradation on other platforms.  Remove the conditional compilation will make the code more clear.

Thanks,
Phil Yang

> 
> >  	for (i = 0; i < 8; i++)
> >  		buf[i] = NULL;
> >  	num = rte_distributor_get_pkt(db, id, buf, buf, num); @@ -270,7
> > +275,12 @@ handle_work_with_free_mbufs(void *arg)
> >  	unsigned int count = 0;
> >  	unsigned int i;
> >  	unsigned int num = 0;
> > +
> > +#ifdef RTE_USE_C11_MEM_MODEL
> > +	unsigned int id = __atomic_fetch_add(&worker_idx, 1,
> > +__ATOMIC_RELAXED); #else
> >  	unsigned int id = __sync_fetch_and_add(&worker_idx, 1);
> > +#endif
> >
> >  	for (i = 0; i < 8; i++)
> >  		buf[i] = NULL;
> > @@ -343,7 +353,13 @@ handle_work_for_shutdown_test(void *arg)
> >  	unsigned int total = 0;
> >  	unsigned int i;
> >  	unsigned int returned = 0;
> > +
> > +#ifdef RTE_USE_C11_MEM_MODEL
> > +	const unsigned int id = __atomic_fetch_add(&worker_idx, 1,
> > +			__ATOMIC_RELAXED);
> > +#else
> >  	const unsigned int id = __sync_fetch_and_add(&worker_idx, 1);
> > +#endif
> >
> >  	num = rte_distributor_get_pkt(d, id, buf, buf, num);
> >
> > diff --git a/app/test/test_distributor_perf.c
> > b/app/test/test_distributor_perf.c
> > index edf1998..9367460 100644
> > --- a/app/test/test_distributor_perf.c
> > +++ b/app/test/test_distributor_perf.c
> > @@ -111,9 +111,14 @@ handle_work(void *arg)
> >  	unsigned int count = 0;
> >  	unsigned int num = 0;
> >  	int i;
> > -	unsigned int id = __sync_fetch_and_add(&worker_idx, 1);
> >  	struct rte_mbuf *buf[8] __rte_cache_aligned;
> >
> > +#ifdef RTE_USE_C11_MEM_MODEL
> > +	unsigned int id = __atomic_fetch_add(&worker_idx, 1,
> > +__ATOMIC_RELAXED); #else
> > +	unsigned int id = __sync_fetch_and_add(&worker_idx, 1); #endif
> > +
> >  	for (i = 0; i < 8; i++)
> >  		buf[i] = NULL;
> >
> > --
> > 2.7.4

  reply	other threads:[~2019-04-02  3:43 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-03  9:49 [PATCH] packet_ordering: replace sync builtins with atomic builtins Phil Yang
2019-03-28 18:42 ` Thomas Monjalon
2019-03-29  1:34   ` Phil Yang (Arm Technology China)
2019-03-29 10:56 ` [PATCH v2 0/3] example and test cases optimizations Phil Yang
2019-03-29 10:56 ` [PATCH v2 1/3] packet_ordering: add statistics for each worker thread Phil Yang
2019-03-29 16:39   ` Pattan, Reshma
2019-03-30 16:55     ` Phil Yang (Arm Technology China)
2019-04-01 12:58       ` Pattan, Reshma
2019-04-02  3:33         ` Phil Yang (Arm Technology China)
2019-03-29 10:56 ` [PATCH v2 2/3] test/distributor: replace sync builtins with atomic builtins Phil Yang
2019-04-01 16:24   ` Honnappa Nagarahalli
2019-04-02  3:43     ` Phil Yang (Arm Technology China) [this message]
2019-03-29 10:56 ` [PATCH v2 3/3] test/ring_perf: " Phil Yang
2019-04-01 16:24   ` Honnappa Nagarahalli
2019-04-03  6:59 ` [PATCH v3 0/3] example and test cases optimizations Phil Yang
2019-04-03  6:59   ` [PATCH v3 1/3] packet_ordering: add statistics for each worker thread Phil Yang
2019-04-04 23:24     ` [dpdk-dev] " Thomas Monjalon
2019-04-08  4:04       ` Phil Yang (Arm Technology China)
2019-04-03  6:59   ` [PATCH v3 2/3] test/distributor: replace sync builtins with atomic builtins Phil Yang
2019-04-04 15:30     ` Honnappa Nagarahalli
2019-04-03  6:59   ` [PATCH v3 3/3] test/ring_perf: " Phil Yang
2019-04-08  3:02 ` [dpdk-dev] [PATCH v4 0/3] example and test cases optimizations Phil Yang
2019-07-04 20:15   ` Thomas Monjalon
2019-07-05  3:19     ` Phil Yang (Arm Technology China)
2019-07-08 14:38   ` Thomas Monjalon
2019-04-08  3:02 ` [dpdk-dev] [PATCH v4 1/3] packet_ordering: add statistics for each worker thread Phil Yang
2019-04-08  3:02 ` [dpdk-dev] [PATCH v4 2/3] test/distributor: replace sync builtins with atomic builtins Phil Yang
2019-04-10 14:05   ` Hunt, David
2019-04-11 11:31     ` Phil Yang (Arm Technology China)
2019-04-08  3:02 ` [dpdk-dev] [PATCH v4 3/3] test/ring_perf: " Phil Yang

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=DB7PR08MB338537708BF43E6807050352E9560@DB7PR08MB3385.eurprd08.prod.outlook.com \
    --to=phil.yang@arm.com \
    --cc=Gavin.Hu@arm.com \
    --cc=Honnappa.Nagarahalli@arm.com \
    --cc=david.hunt@intel.com \
    --cc=dev@dpdk.org \
    --cc=nd@arm.com \
    --cc=reshma.pattan@intel.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.