From: gowrishankar <gowrishankar.m@linux.vnet.ibm.com>
To: "Xu, HuilongX" <huilongx.xu@intel.com>
Cc: dts <dts@dpdk.org>
Subject: Re: [dts] [PATCH 2/9] framework: platform independent cpu info parsing
Date: Tue, 01 Mar 2016 08:44:28 +0530 [thread overview]
Message-ID: <56D50914.7060008@linux.vnet.ibm.com> (raw)
In-Reply-To: <DF2A19295B96364286FEB7F3DDA27A4637B0BE24@SHSMSX101.ccr.corp.intel.com>
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 ?.
Thanks,
Gowrishankar
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 <gowrishankar.m@linux.vnet.ibm.com>
>> ---
>> 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 = \
>> self.send_expect(
>> - "grep --color=never \"processor\\|physical id\\|core
>> id\\|^$\" /proc/cpuinfo",
>> + "lscpu -p|grep -v \#",
>> "#", alt_session=True)
>>
>> - if "processor" not in cpuinfo:
>> - # yocto not support --color=never, but ubuntu must need --
>> color=never,
>> - # so check cpuinfo, before parsing cpuinfo, if cpuifo get
>> error, delete --color=never
>> - # and get cpuinfo again
>> - cpuinfo = \
>> - self.send_expect(
>> - r'grep "processor\|physical id\|core id\|^$"
>> /proc/cpuinfo',
>> - "#", alt_session=True)
>> -
>> - cpuinfo = cpuinfo.split('\r\n\r\n')
>> + cpuinfo = cpuinfo.split()
>> # haswell cpu on cottonwood core id not correct
>> # need addtional coremap for haswell cpu
>> core_id = 0
>> coremap = {}
>> for line in cpuinfo:
>> - m = re.search("processor\t: (\d+)\r\n" +
>> - "physical id\t: (\d+)\r\n" +
>> - "core id\t\t: (\d+)", line)
>> -
>> - if m:
>> - thread = m.group(1)
>> - socket = m.group(2)
>> - core = m.group(3)
>> -
>> - if core not in coremap.keys():
>> - coremap[core] = core_id
>> - core_id += 1
>> -
>> - if self.crb['bypass core0'] and core == '0' and socket ==
>> '0':
>> - self.logger.info("Core0 bypassed")
>> - continue
>> - self.cores.append(
>> + (thread, core, socket) = line.split(',')[0:3]
>> +
>> + if core not in coremap.keys():
>> + coremap[core] = core_id
>> + core_id += 1
>> +
>> + if self.crb['bypass core0'] and core == '0' and socket == '0':
>> + self.logger.info("Core0 bypassed")
>> + continue
>> + self.cores.append(
>> {'thread': thread, 'socket': socket, 'core':
>> coremap[core]})
>>
>> self.number_of_cores = len(self.cores)
>> --
>> 1.7.10.4
>
next prev parent reply other threads:[~2016-03-01 3:14 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-26 10:17 [dts] framework: hugepages, cpuinfo, connect x3 support and bug fixes Gowrishankar
2016-02-26 10:17 ` [dts] [PATCH 1/9] framework: check hugepage size and add pages Gowrishankar
2016-02-26 10:17 ` [dts] [PATCH 2/9] framework: platform independent cpu info parsing Gowrishankar
2016-02-29 2:13 ` Xu, HuilongX
2016-03-01 3:14 ` gowrishankar [this message]
2016-03-01 12:42 ` Liu, Yong
2016-03-09 5:50 ` Xu, HuilongX
2016-02-26 10:17 ` [dts] [PATCH 3/9] framework: include domain id in pci tuple Gowrishankar
2016-02-26 10:17 ` [dts] [PATCH 4/9] framework: enable connect X3 support Gowrishankar
2016-03-01 13:17 ` Liu, Yong
2016-03-03 7:57 ` gowrishankar
2016-03-04 1:07 ` Liu, Yong
2016-02-26 10:17 ` [dts] [PATCH 5/9] framework: fix numa number lookup for a dev Gowrishankar
2016-02-26 10:17 ` [dts] [PATCH 6/9] framework: fix get_core_list to return all lcores Gowrishankar
2016-02-26 10:17 ` [dts] [PATCH 7/9] tests: fix multiprocess test to set coremask through library Gowrishankar
2016-02-26 10:17 ` [dts] [PATCH 8/9] tests: fix coremask test to check expected EAL output Gowrishankar
2016-02-26 10:17 ` [dts] [PATCH 9/9] tests: fix blacklist test to discard extra pci domain id in verification string Gowrishankar
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=56D50914.7060008@linux.vnet.ibm.com \
--to=gowrishankar.m@linux.vnet.ibm.com \
--cc=dts@dpdk.org \
--cc=huilongx.xu@intel.com \
/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).