From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 9FEB795EC for ; Tue, 23 Dec 2014 10:45:38 +0100 (CET) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP; 23 Dec 2014 01:45:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.07,630,1413270000"; d="scan'208";a="628142104" Received: from pgsmsx102.gar.corp.intel.com ([10.221.44.80]) by orsmga001.jf.intel.com with ESMTP; 23 Dec 2014 01:45:34 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by PGSMSX102.gar.corp.intel.com (10.221.44.80) with Microsoft SMTP Server (TLS) id 14.3.195.1; Tue, 23 Dec 2014 17:45:33 +0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.216]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.182]) with mapi id 14.03.0195.001; Tue, 23 Dec 2014 17:45:32 +0800 From: "Liang, Cunming" To: "Walukiewicz, Miroslaw" , "Richardson, Bruce" Thread-Topic: [dpdk-dev] [RFC PATCH 0/7] support multi-phtread per lcore Thread-Index: AQHQFObgfmq64AgbV0e+OTw3KgLpHZyJoZWAgAGfW9CABL60AIAAkFJwgAQ6C4CAAV5A0IAADfiAgASiO/CAAA/UgIAABFsAgAIETzA= Date: Tue, 23 Dec 2014 09:45:31 +0000 Message-ID: References: <1418263490-21088-1-git-send-email-cunming.liang@intel.com> <7C4248CAE043B144B1CD242D275626532FE15298@IRSMSX104.ger.corp.intel.com> <7C4248CAE043B144B1CD242D275626532FE232BA@IRSMSX104.ger.corp.intel.com> <7C4248CAE043B144B1CD242D275626532FE27C3B@IRSMSX104.ger.corp.intel.com> <20141219100342.GA3848@bricha3-MOBL3> <20141222094603.GA1768@bricha3-MOBL3> <7C4248CAE043B144B1CD242D275626532FE2908C@IRSMSX104.ger.corp.intel.com> In-Reply-To: <7C4248CAE043B144B1CD242D275626532FE2908C@IRSMSX104.ger.corp.intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [RFC PATCH 0/7] support multi-phtread per lcore X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Dec 2014 09:45:39 -0000 > -----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 >=20 > > -----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 =3D=3D thread_id a lar= ge number > > of > > > > times. > > > > > > > > Despite the slight logical inconsistency, I think it's better to av= oid > > introducing > > > > a thread-id and continue having lcore_id representing a unique thre= ad. > > > > > > > > /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 lo= gical > > 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 ma= tter > > 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 g= reater > > than RTE_MAX_LCORE is terrible, as how will people know how to dimensio= n > > arrays > > to be indexes by lcore id?=20 [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 th= e dimension ? In my previous mind, I don't expect to change lcore_config. RTE_MAX_LCORE i= s 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, i= t > > 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 op= tion is to > > use the existing lcore_id and accept the fact that it's now a thread id= rather > > than an actual physical lcore.=20 [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 p= hysical 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 s= tand 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 suc= h 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. >=20 > int num_cores_online =3D count of cores encountered in the core mask prov= ided by > cmdline parameter [Liang, Cunming] In this way, if we have core mask 0xf0. num_cores_online w= ill be 4. rte_lcore_id() value for logical core will be 0, 1, 2, 3, which is no longe= r 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. >=20 > Rte_lcore_id() < num_cores_online -> physical core (pthread first started= on the > core) >=20 > Rte_lcore_id() >=3D num_cores_online -> pthread created by rte_pthread_cr= eate >=20 > Mirek >=20 > > /Bruce