DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Van Haaren, Harry" <harry.van.haaren@intel.com>
To: Thomas Monjalon <thomas@monjalon.net>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	'Jerin Jacob' <jerin.jacob@caviumnetworks.com>,
	"Wiles, Keith" <keith.wiles@intel.com>,
	"Richardson, Bruce" <bruce.richardson@intel.com>
Subject: Re: [dpdk-dev] Service lcores and Application lcores
Date: Fri, 30 Jun 2017 08:52:02 +0000	[thread overview]
Message-ID: <E923DB57A917B54B9182A2E928D00FA640C343DB@IRSMSX102.ger.corp.intel.com> (raw)
In-Reply-To: <25008072.aWAPEDBPgL@xps>

> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> Sent: Thursday, June 29, 2017 9:19 PM
> To: Van Haaren, Harry <harry.van.haaren@intel.com>
> Cc: dev@dpdk.org; 'Jerin Jacob' <jerin.jacob@caviumnetworks.com>; Wiles, Keith
> <keith.wiles@intel.com>; Richardson, Bruce <bruce.richardson@intel.com>
> Subject: Re: Service lcores and Application lcores
> 
> 29/06/2017 18:35, Van Haaren, Harry:
> > 3) The problem;
> >    If a service core runs the SW PMD schedule() function (option 2) *AND*
> >    the application lcore runs schedule() func (option 1), the result is that
> >    two threads are concurrently running a multi-thread unsafe function.
> 
> Which function is multi-thread unsafe?

With the current design, the service-callback does not have to be multi-thread safe.
For example, the eventdev SW PMD is not multi-thread safe.

The service library handles serializing access to the service-callback if multiple cores
are mapped to that service. This keeps the atomic complexity in one place, and keeps
services as light-weight to implement as possible.

(We could consider forcing all service-callbacks to be multi-thread safe by using atomics,
but we would not be able to optimize away the atomic cmpset if it is not required. This
feels heavy handed, and would cause useless atomic ops to execute.)


> Why the same function would be run by the service and by the scheduler?

The same function can be run concurrently by the application, and a service core.
The root cause that this could happen is that an application can *think* it is the
only one running threads, but in reality one or more service-cores may be running
in the background.

The service lcores and application lcores existence without knowledge of the others
behavior is the cause of concurrent running of the multi-thread unsafe service function.

  reply	other threads:[~2017-06-30  8:52 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-29 14:36 Van Haaren, Harry
2017-06-29 15:16 ` Thomas Monjalon
2017-06-29 16:35   ` Van Haaren, Harry
2017-06-29 20:18     ` Thomas Monjalon
2017-06-30  8:52       ` Van Haaren, Harry [this message]
2017-06-30  9:29         ` Thomas Monjalon
2017-06-30 10:18           ` Van Haaren, Harry
2017-06-30 10:38             ` Thomas Monjalon
2017-06-30 11:14               ` Van Haaren, Harry
2017-06-30 13:04                 ` Jerin Jacob
2017-06-30 13:16                   ` Van Haaren, Harry
2017-06-29 15:57 ` Bruce Richardson
2017-06-30  4:45   ` Jerin Jacob
2017-06-30 10:00     ` Van Haaren, Harry
2017-06-30 12:51       ` Jerin Jacob
2017-06-30 13:08         ` Van Haaren, Harry
2017-06-30 13:20           ` Jerin Jacob
2017-06-30 13:24             ` Van Haaren, Harry
2017-06-30 13:51               ` 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=E923DB57A917B54B9182A2E928D00FA640C343DB@IRSMSX102.ger.corp.intel.com \
    --to=harry.van.haaren@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=jerin.jacob@caviumnetworks.com \
    --cc=keith.wiles@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 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).