DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Liang, Cunming" <cunming.liang@intel.com>
To: "Walukiewicz, Miroslaw" <Miroslaw.Walukiewicz@intel.com>,
	"Richardson, Bruce" <bruce.richardson@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [RFC PATCH 0/7] support multi-phtread per lcore
Date: Tue, 23 Dec 2014 09:45:31 +0000	[thread overview]
Message-ID: <D0158A423229094DA7ABF71CF2FA0DA31188F989@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <7C4248CAE043B144B1CD242D275626532FE2908C@IRSMSX104.ger.corp.intel.com>



> -----Original Message-----
> From: Walukiewicz, Miroslaw
> Sent: Monday, December 22, 2014 6:02 PM
> To: Richardson, Bruce; Liang, Cunming
> Cc: dev@dpdk.org
> Subject: RE: [dpdk-dev] [RFC PATCH 0/7] support multi-phtread per lcore
> 
> > -----Original Message-----
> > From: Richardson, Bruce
> > Sent: Monday, December 22, 2014 10:46 AM
> > To: Liang, Cunming
> > Cc: Walukiewicz, Miroslaw; dev@dpdk.org
> > Subject: Re: [dpdk-dev] [RFC PATCH 0/7] support multi-phtread per lcore
> >
> > On Mon, Dec 22, 2014 at 01:51:27AM +0000, Liang, Cunming wrote:
> > > ...
> > > > I'm conflicted on this one. However, I think far more applications would
> > be
> > > > broken
> > > > to start having to use thread_id in place of an lcore_id than would be
> > broken
> > > > by having the lcore_id no longer actually correspond to a core.
> > > > I'm actually struggling to come up with a large number of scenarios where
> > it's
> > > > important to an app to determine the cpu it's running on, compared to
> > the large
> > > > number of cases where you need to have a data-structure per thread. In
> > DPDK
> > > > libs
> > > > alone, you see this assumption that lcore_id == thread_id a large number
> > of
> > > > times.
> > > >
> > > > Despite the slight logical inconsistency, I think it's better to avoid
> > introducing
> > > > a thread-id and continue having lcore_id representing a unique thread.
> > > >
> > > > /Bruce
> > >
> > > Ok, I understand it.
> > > I list the implicit meaning if using lcore_id representing the unique thread.
> > > 1). When lcore_id less than RTE_MAX_LCORE, it still represents the logical
> > core id.
> > > 2). When lcore_id large equal than RTE_MAX_LCORE, it represents an
> > unique id for thread.
> > > 3). Most of APIs(except rte_lcore_id()) in rte_lcore.h suggest to be used
> > only in CASE 1)
> > > 4). rte_lcore_id() can be used in CASE 2), but the return value no matter
> > represent a logical core id.
> > >
> > > If most of us feel it's acceptable, I'll prepare for the RFC v2 base on this
> > conclusion.
> > >
> > > /Cunming
> >
> > Sorry, I don't like that suggestion either, as having lcore_id values greater
> > than RTE_MAX_LCORE is terrible, as how will people know how to dimension
> > arrays
> > to be indexes by lcore id? 
[Liang, Cunming] For dimension array, we shall have RTE_MAX_THREAD_ID.
Lcore id no longer means logical core, so why still use RTE_MAX_LCORE as the dimension ?
In my previous mind, I don't expect to change lcore_config. RTE_MAX_LCORE is only used to identify the legal id for logical core.
So there's no any change when id < RTE_MAX_LCORE, while id > RTE_MAX_LCORE cause fail in lcore API.

>> Given the choice, if we are not going to just use
> > lcore_id as a generic thread id, which is always between 0 and
> > RTE_MAX_LCORE
> > we can look to define a new thread_id variable to hold that. However, it
> > should
> > have a bounded range.
[Liang, Cunming] Agree, if we merge lcore id with linear thread id, anyway we require RTE_MAX_THREAD_ID.
> > From an ease-of-porting perspective, I still think that the simplest option is to
> > use the existing lcore_id and accept the fact that it's now a thread id rather
> > than an actual physical lcore. 
[Liang, Cunming] Not sure do you means propose to extend lcore_config as a per thread context instead of per lcore ?
If accepts the fact lcore_id is now a thread id, how to make decision the physical lcore is in core mask or not ?
Question is, is would that cause us lots of issues
> > in the future?
[Liang, Cunming] Personally I don't like this way that lcore id sometimes stand for logical core id, sometimes stand for thread id.
The benefit of it looks like avoid trivial change. Actually will change the meaning of API and implement.
What I propose linear thread id is new, but we can control and estimate such limited change where it happens.
> >
> I would prefer keeping the RTE_MAX_LCORES as Bruce suggests and
> determine the HW core on base of following condition if we really have to know
> this.
> 
> int num_cores_online = count of cores encountered in the core mask provided by
> cmdline parameter
[Liang, Cunming] In this way, if we have core mask 0xf0. num_cores_online will be 4.
rte_lcore_id() value for logical core will be 0, 1, 2, 3, which is no longer 4,5,6,7.
That's probably all right if trying to give up the origin meaning of lcore_id, and change to identify a unique thread id.
But I don't think having a dynamic num_cores_online is a good idea.
If in one day, we plan to support lcore hot plug, the num_cores_online will change in the fly.
It's bad to get the id which already occupied by some thread.
> 
> Rte_lcore_id() < num_cores_online -> physical core (pthread first started on the
> core)
> 
> Rte_lcore_id() >= num_cores_online -> pthread created by rte_pthread_create
> 
> Mirek
> 
> > /Bruce

  reply	other threads:[~2014-12-23  9:45 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-11  2:04 Cunming Liang
2014-12-11  2:04 ` [dpdk-dev] [RFC PATCH 1/7] eal: add linear thread id as pthread-local variable Cunming Liang
2014-12-16  7:00   ` Qiu, Michael
2014-12-22 19:02   ` Ananyev, Konstantin
2014-12-23  9:56     ` Liang, Cunming
2014-12-11  2:04 ` [dpdk-dev] [RFC PATCH 2/7] mempool: use linear-tid as mempool cache index Cunming Liang
2014-12-11  2:04 ` [dpdk-dev] [RFC PATCH 3/7] ring: use linear-tid as ring debug stats index Cunming Liang
2014-12-11  2:04 ` [dpdk-dev] [RFC PATCH 4/7] eal: add simple API for multi-pthread Cunming Liang
2014-12-11  2:04 ` [dpdk-dev] [RFC PATCH 5/7] testpmd: support multi-pthread mode Cunming Liang
2014-12-11  2:04 ` [dpdk-dev] [RFC PATCH 6/7] sample: add new sample for multi-pthread Cunming Liang
2014-12-11  2:04 ` [dpdk-dev] [RFC PATCH 7/7] eal: macro for cpuset w/ or w/o CPU_ALLOC Cunming Liang
2014-12-11  2:54 ` [dpdk-dev] [RFC PATCH 0/7] support multi-phtread per lcore Jayakumar, Muthurajan
2014-12-11  9:56 ` Walukiewicz, Miroslaw
2014-12-12  5:44   ` Liang, Cunming
2014-12-15 11:10     ` Walukiewicz, Miroslaw
2014-12-15 11:53       ` Liang, Cunming
2014-12-18 12:20         ` Walukiewicz, Miroslaw
2014-12-18 14:32           ` Bruce Richardson
2014-12-18 15:11             ` Olivier MATZ
2014-12-18 16:04               ` Bruce Richardson
2014-12-18 16:15           ` Stephen Hemminger
2014-12-19  1:28           ` Liang, Cunming
2014-12-19 10:03             ` Bruce Richardson
2014-12-22  1:51               ` Liang, Cunming
2014-12-22  9:46                 ` Bruce Richardson
2014-12-22 10:01                   ` Walukiewicz, Miroslaw
2014-12-23  9:45                     ` Liang, Cunming [this message]
2014-12-22 18:28                   ` Stephen Hemminger
2014-12-23  9:19                     ` Walukiewicz, Miroslaw
2014-12-23  9:23                       ` Bruce Richardson
2014-12-23  9:51                     ` Liang, Cunming
2015-01-08 17:05                       ` Ananyev, Konstantin
2015-01-08 17:23                         ` Richardson, Bruce
2015-01-09  9:51                           ` Liang, Cunming
2015-01-09  9:40                         ` Liang, Cunming
2015-01-09 11:52                           ` Ananyev, Konstantin
2015-01-09  9:45                         ` Liang, Cunming

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=D0158A423229094DA7ABF71CF2FA0DA31188F989@shsmsx102.ccr.corp.intel.com \
    --to=cunming.liang@intel.com \
    --cc=Miroslaw.Walukiewicz@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    /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).