DPDK patches and discussions
 help / color / mirror / Atom feed
From: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
To: Olivier Matz <olivier.matz@6wind.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	"lucp.at.work@gmail.com" <lucp.at.work@gmail.com>,
	"stephen@networkplumber.org" <stephen@networkplumber.org>,
	"david.marchand@redhat.com" <david.marchand@redhat.com>,
	"thomas@monjalon.net" <thomas@monjalon.net>,
	Ruifeng Wang <Ruifeng.Wang@arm.com>, nd <nd@arm.com>,
	nd <nd@arm.com>
Subject: Re: [dpdk-dev] [PATCH v4 1/2] eal: simplify the implementation of rte_ctrl_thread_create
Date: Thu, 21 Oct 2021 20:49:05 +0000	[thread overview]
Message-ID: <DBAPR08MB58140F220ED4A6CFFFE7588898BF9@DBAPR08MB5814.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <YXGLQoC5RQ1JS+QI@platinum>

<snip>

> 
> Hi Honnappa,
> 
> On Wed, Oct 13, 2021 at 03:18:10PM -0500, Honnappa Nagarahalli wrote:
> > Remove the usage of pthread barrier and replace it with
> > synchronization using atomic variable. This also removes the use of
> > reference count required to synchronize freeing the memory.
> >
> > Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> 
> Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
> 
> Few cosmetics comments below.
> 
> (...)
> 
> > +enum __rte_ctrl_thread_status {
> > +	__RTE_CTRL_THREAD_LAUNCHING, /* Yet to call pthread_create
> function */
> > +	__RTE_CTRL_THREAD_RUNNING, /* Control thread is running
> successfully */
> > +	__RTE_CTRL_THREAD_ERROR /* Control thread encountered an error
> */ };
> > +
> 
> Are there double underscores needed?
> I think even the rte_ prefix could be removed since this is not exposed.
I am fine to change this, just want to be consistent with the rest of the code. Looks like a lot of code does not use __RTE.

> 
> (...)
> 
> > @@ -236,24 +239,22 @@ rte_ctrl_thread_create(pthread_t *thread, const
> char *name,
> >  				"Cannot set name for ctrl thread\n");
> >  	}
> >
> > -	ret = pthread_setaffinity_np(*thread, sizeof(*cpuset), cpuset);
> > -	if (ret != 0)
> > -		params->start_routine = NULL;
> > -
> > -	pthread_barrier_wait(&params->configured);
> > -	ctrl_params_free(params);
> > -
> > -	if (ret != 0)
> > -		/* start_routine has been set to NULL above; */
> > -		/* ctrl thread will exit immediately */
> > +	/* Wait for the control thread to initialize successfully */
> > +	while ((ctrl_thread_status =
> > +		__atomic_load_n(&params->ctrl_thread_status,
> __ATOMIC_ACQUIRE))
> > +		== __RTE_CTRL_THREAD_LAUNCHING)
> > +		/* Yield the CPU. Using sched_yield call requires maintaining
> > +		 * another implementation for Windows as sched_yield is not
> > +		 * supported on Windows.
> > +		 */
> > +		rte_delay_us_sleep(1);
> > +
> > +	/* Check if the control thread encountered an error */
> > +	if (ctrl_thread_status == __RTE_CTRL_THREAD_ERROR)
> > +		/* ctrl thread is exiting */
> >  		pthread_join(*thread, NULL);
> 
> While not required, I suggest to use curly brackets when the number of lines in
> the body of the loop or test (including comments).
ok
> 
> 
> Thanks
> Olivier

  reply	other threads:[~2021-10-21 20:49 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-30 21:37 [dpdk-dev] [RFC] " Honnappa Nagarahalli
2021-08-02  5:16 ` [dpdk-dev] [RFC v2] " Honnappa Nagarahalli
2021-08-23 10:16   ` Olivier Matz
2021-08-24 20:03     ` Honnappa Nagarahalli
2021-08-24 21:30       ` Stephen Hemminger
2021-08-25  1:26         ` Honnappa Nagarahalli
2021-08-25 15:19         ` Mattias Rönnblom
2021-08-25 15:31           ` Honnappa Nagarahalli
2021-09-01 20:04             ` Mattias Rönnblom
2021-09-01 22:21               ` Honnappa Nagarahalli
2021-08-30 22:30         ` Honnappa Nagarahalli
2021-08-25 15:12   ` Mattias Rönnblom
2021-08-25 15:23     ` Honnappa Nagarahalli
2021-08-25 21:57       ` Stephen Hemminger
2021-08-25 18:48 ` [dpdk-dev] [RFC] " Luc Pelletier
2021-08-25 19:26   ` Honnappa Nagarahalli
2021-08-30 16:34 ` [dpdk-dev] [PATCH v3 1/2] " Honnappa Nagarahalli
2021-08-30 16:34   ` [dpdk-dev] [PATCH v3 2/2] test/eal: add a test for rte_ctrl_thread_create Honnappa Nagarahalli
2021-08-30 16:41     ` Stephen Hemminger
2021-08-30 16:42       ` Honnappa Nagarahalli
2021-08-30 16:44   ` [dpdk-dev] [PATCH v3 1/2] eal: simplify the implementation of rte_ctrl_thread_create Stephen Hemminger
2021-08-30 22:12     ` Honnappa Nagarahalli
2021-10-13 20:18 ` [dpdk-dev] [PATCH v4 " Honnappa Nagarahalli
2021-10-13 20:18   ` [dpdk-dev] [PATCH v4 2/2] test/eal: add a test for rte_ctrl_thread_create Honnappa Nagarahalli
2021-10-21 15:46   ` [dpdk-dev] [PATCH v4 1/2] eal: simplify the implementation of rte_ctrl_thread_create Olivier Matz
2021-10-21 20:49     ` Honnappa Nagarahalli [this message]
2021-10-21 21:32 ` [dpdk-dev] [PATCH v5 " Honnappa Nagarahalli
2021-10-21 21:32   ` [dpdk-dev] [PATCH v5 2/2] test/eal: add a test for rte_ctrl_thread_create Honnappa Nagarahalli
2021-10-22  8:35     ` Olivier Matz
2021-10-25 19:46       ` 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=DBAPR08MB58140F220ED4A6CFFFE7588898BF9@DBAPR08MB5814.eurprd08.prod.outlook.com \
    --to=honnappa.nagarahalli@arm.com \
    --cc=Ruifeng.Wang@arm.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=lucp.at.work@gmail.com \
    --cc=nd@arm.com \
    --cc=olivier.matz@6wind.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).