Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP1:Update
lshw.7879
lshw-cpuinfo.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File lshw-cpuinfo.patch of Package lshw.7879
From 9a81309286a05f2b088c9898a0e3a16e807532be Mon Sep 17 00:00:00 2001 From: Chandni Verma <chandni@linux.vnet.ibm.com> Date: Thu, 20 Oct 2016 19:24:46 +0530 Subject: [PATCH] cpuinfo: Rectify cpuinfo for IBM Power Systems '/proc/cpuinfo' file on Power Systems represents online CPU threads, not physical cores. Also we can dynamically change number of threads. Previous patch added support to parse device tree and display core information under CPU nodes. This patch pulls useful info from cpuinfo file and updates CPU nodes. - description : Processor description - version : Processor version including subversion Signed-off-by: Chandni Verma <chandni@linux.vnet.ibm.com> [Code cleanup, updated description - Vasant] Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> --- src/core/cpuinfo.cc | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) Index: lshw-B.02.18/src/core/cpuinfo.cc =================================================================== --- lshw-B.02.18.orig/src/core/cpuinfo.cc +++ lshw-B.02.18/src/core/cpuinfo.cc @@ -13,6 +13,13 @@ __ID("@(#) $Id$"); static int currentcpu = 0; +static inline bool is_system_ppc_ibm(hwNode & node) +{ + string desc = node.getDescription(); + + return (desc == "PowerNV" || desc == "pSeries Guest" || desc == "pSeries LPAR"); +} + static hwNode *getcpu(hwNode & node, int n = 0) { @@ -33,6 +40,13 @@ int n = 0) return cpu; } + /* + * device-tree.cc creates all CPU nodes on Power Systems. + * Hence do not create new CPU nodes here. + */ + if (is_system_ppc_ibm(node)) + return NULL; + hwNode *core = node.getChild("core"); if (core) @@ -49,6 +63,20 @@ int n = 0) #ifdef __powerpc__ +static void cpuinfo_ppc_ibm(hwNode & node, + const string & description, const string & version) +{ + hwNode *cpu = getcpu(node, currentcpu); + + while (cpu) + { + cpu->setDescription(description); + cpu->setVersion(version); + + cpu = getcpu(node, ++currentcpu); + } +} + static void cpuinfo_ppc(hwNode & node, string id, string value) @@ -570,6 +598,7 @@ bool scan_cpuinfo(hwNode & n) char buffer[1024]; size_t count; string cpuinfo_str = ""; + string description = "", version = ""; while ((count = read(cpuinfo, buffer, sizeof(buffer))) > 0) { @@ -599,7 +628,23 @@ bool scan_cpuinfo(hwNode & n) cpuinfo_x86(n, id, value); #endif #ifdef __powerpc__ - cpuinfo_ppc(n, id, value); + + // All cores have same product name and version on power systems + if (is_system_ppc_ibm(n)) + { + if (id == "cpu") + description = value; + if (id == "revision") + version = value; + + if (description != "" && version != "") + { + cpuinfo_ppc_ibm(n, description, version); + break; + } + } + else + cpuinfo_ppc(n, id, value); #endif #ifdef __s390x__ cpuinfo_s390x(n, id, value);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor