Re: [PATCH] lscpu: Fix model and model name on Power Systems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/15/2016 07:19 PM, Karel Zak wrote:
On Tue, Mar 15, 2016 at 09:33:31AM +0100, Ruediger Meier wrote:
diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index fc32762..423bc56 100644
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -465,8 +465,13 @@ read_basicinfo(struct lscpu_desc *desc, struct
lscpu_modifier *mod) else if (lookup(buf, "vendor_id",
&desc->vendor)) ;
  		else if (lookup(buf, "family", &desc->family)) ;
  		else if (lookup(buf, "cpu family", &desc->family)) ;
+#if defined(__powerpc__) || defined(__powerpc64__)
+		else if (lookup(buf, "revision", &desc->model)) ;
+		else if (lookup(buf, "cpu", &desc->modelname)) ;
+#else
  		else if (lookup(buf, "model", &desc->model)) ;
  		else if (lookup(buf, "model name", &desc->modelname)) ;
+#endif
  		else if (lookup(buf, "stepping", &desc->stepping)) ;
  		else if (lookup(buf, "cpu MHz", &desc->mhz)) ;
  		else if (lookup(buf, "flags", &desc->flags)) ;		/* x86 */

Would it be possible to decide on runtime what to do, ideally looking
into /proc or /sys to see whether it's a powerpc? This ifdef does not
work with lscpu --sysroot.

  I have reverted the patch for --sysroot, so the #ifdef is applied to
  live systems only (please, test it). Not elegant, but better than
  nothing.

Karel,

I've gone through this patch.. Looks good. But I think Ruediger's patch is better one.

-Vasant

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux