From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 2C5482B99 for ; Tue, 1 Mar 2016 13:42:26 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP; 01 Mar 2016 04:42:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,523,1449561600"; d="scan'208";a="661809580" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by FMSMGA003.fm.intel.com with ESMTP; 01 Mar 2016 04:42:24 -0800 Received: from fmsmsx117.amr.corp.intel.com (10.18.116.17) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 1 Mar 2016 04:42:24 -0800 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx117.amr.corp.intel.com (10.18.116.17) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 1 Mar 2016 04:42:24 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.24]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.136]) with mapi id 14.03.0248.002; Tue, 1 Mar 2016 20:42:22 +0800 From: "Liu, Yong" To: gowrishankar , "Xu, HuilongX" Thread-Topic: [dts] [PATCH 2/9] framework: platform independent cpu info parsing Thread-Index: AQHRc2iP8wi+DNrKOUGqa94rSl6By59Ehrtw Date: Tue, 1 Mar 2016 12:42:21 +0000 Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E144FF0F7@SHSMSX103.ccr.corp.intel.com> References: <1456481834-10027-1-git-send-email-gowrishankar.m@linux.vnet.ibm.com> <1456481834-10027-3-git-send-email-gowrishankar.m@linux.vnet.ibm.com> <56D50914.7060008@linux.vnet.ibm.com> In-Reply-To: <56D50914.7060008@linux.vnet.ibm.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: dts Subject: Re: [dts] [PATCH 2/9] framework: platform independent cpu info parsing X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Mar 2016 12:42:26 -0000 Huilong,=20 "lscpu" is one of linux system utilities, it packed in util-linux rpm file = in fedora distribution.=20 Could you whether there is available installation package in yocto? > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of gowrishankar > Sent: Tuesday, March 01, 2016 11:14 AM > To: Xu, HuilongX > Cc: dts > Subject: Re: [dts] [PATCH 2/9] framework: platform independent cpu info > parsing >=20 > Hi, > Thanks for this check. For yocto or any other platform which do not have > lscpu by default, we can add a function to convert cpu info into a > parsable > format as given by lscpu. Any thoughts ?. >=20 > Thanks, > Gowrishankar >=20 > On Monday 29 February 2016 07:43 AM, Xu, HuilongX wrote: > > Hi Gowrishankar, > > Lscpu cmdline not default in yocto os. > > Thanks a lot > >> -----Original Message----- > >> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Gowrishankar > >> Sent: Friday, February 26, 2016 6:17 PM > >> To: dts > >> Subject: [dts] [PATCH 2/9] framework: platform independent cpu info > >> parsing > >> > >> To collect thread/core/socket, /proc/cpuinfo would not help in case of > >> powerpc. > >> Instead, lscpu seems to be a better alternative and platform neutral > >> approach. > >> > >> Signed-off-by: Gowrishankar > >> --- > >> framework/crb.py | 40 ++++++++++++---------------------------- > >> 1 file changed, 12 insertions(+), 28 deletions(-) > >> > >> diff --git a/framework/crb.py b/framework/crb.py > >> index c6fd9fb..1711f37 100644 > >> --- a/framework/crb.py > >> +++ b/framework/crb.py > >> @@ -495,41 +495,25 @@ class Crb(object): > >> > >> cpuinfo =3D \ > >> self.send_expect( > >> - "grep --color=3Dnever \"processor\\|physical id\\|cor= e > >> id\\|^$\" /proc/cpuinfo", > >> + "lscpu -p|grep -v \#", > >> "#", alt_session=3DTrue) > >> > >> - if "processor" not in cpuinfo: > >> - # yocto not support --color=3Dnever, but ubuntu must need= - > - > >> color=3Dnever, > >> - # so check cpuinfo, before parsing cpuinfo, if cpuifo get > >> error, delete --color=3Dnever > >> - # and get cpuinfo again > >> - cpuinfo =3D \ > >> - self.send_expect( > >> - r'grep "processor\|physical id\|core id\|^$" > >> /proc/cpuinfo', > >> - "#", alt_session=3DTrue) > >> - > >> - cpuinfo =3D cpuinfo.split('\r\n\r\n') > >> + cpuinfo =3D cpuinfo.split() > >> # haswell cpu on cottonwood core id not correct > >> # need addtional coremap for haswell cpu > >> core_id =3D 0 > >> coremap =3D {} > >> for line in cpuinfo: > >> - m =3D re.search("processor\t: (\d+)\r\n" + > >> - "physical id\t: (\d+)\r\n" + > >> - "core id\t\t: (\d+)", line) > >> - > >> - if m: > >> - thread =3D m.group(1) > >> - socket =3D m.group(2) > >> - core =3D m.group(3) > >> - > >> - if core not in coremap.keys(): > >> - coremap[core] =3D core_id > >> - core_id +=3D 1 > >> - > >> - if self.crb['bypass core0'] and core =3D=3D '0' and > socket =3D=3D > >> '0': > >> - self.logger.info("Core0 bypassed") > >> - continue > >> - self.cores.append( > >> + (thread, core, socket) =3D line.split(',')[0:3] > >> + > >> + if core not in coremap.keys(): > >> + coremap[core] =3D core_id > >> + core_id +=3D 1 > >> + > >> + if self.crb['bypass core0'] and core =3D=3D '0' and socke= t =3D=3D > '0': > >> + self.logger.info("Core0 bypassed") > >> + continue > >> + self.cores.append( > >> {'thread': thread, 'socket': socket, 'core': > >> coremap[core]}) > >> > >> self.number_of_cores =3D len(self.cores) > >> -- > >> 1.7.10.4 > > >=20