All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lscpu: Fix model and model name on Power Systems
@ 2016-03-14 14:48 Vasant Hegde
  2016-03-14 15:19 ` Karel Zak
  2016-03-15  8:33 ` Ruediger Meier
  0 siblings, 2 replies; 7+ messages in thread
From: Vasant Hegde @ 2016-03-14 14:48 UTC (permalink / raw)
  To: util-linux; +Cc: kzak

On Power System, lspcu presently displays system model number instead of
processor model name. 'model' tag in cpuinfo contains system model name,
not processor model. Instead it uses 'cpu' tag for processor model name.
Also it uses 'revision' tag for processor model.

Fix lspcu so that it displays processor model number. Also display processor
model name.

cpuinfo output on Power System:
  ...
  ...

  processor	: 127
  cpu		: POWER8E (raw), altivec supported
  clock		: 4322.000000MHz
  revision	: 2.1 (pvr 004b 0201)

  timebase	: 512000000
  platform	: PowerNV
  model		: 8286-42A
  machine	: PowerNV 8286-42A
  firmware	: OPAL


Output without this patch:
  Architecture:          ppc64le
  Byte Order:            Little Endian
  CPU(s):                128
  On-line CPU(s) list:   0-127
  Thread(s) per core:    8
  Core(s) per socket:    4
  Socket(s):             4
  NUMA node(s):          4
  Model:                 8286-42A
  ...
  ...

Output with this patch:
  Architecture:          ppc64le
  Byte Order:            Little Endian
  CPU(s):                128
  On-line CPU(s) list:   0-127
  Thread(s) per core:    8
  Core(s) per socket:    4
  Socket(s):             4
  NUMA node(s):          4
  Model:                 2.1 (pvr 004b 0201)
  Model name:            POWER8E (raw), altivec supported
  ...
  ...

Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
---
 sys-utils/lscpu.c |    5 +++++
 1 file changed, 5 insertions(+)

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 */


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] lscpu: Fix model and model name on Power Systems
  2016-03-14 14:48 [PATCH] lscpu: Fix model and model name on Power Systems Vasant Hegde
@ 2016-03-14 15:19 ` Karel Zak
  2016-03-14 15:20   ` Vasant Hegde
  2016-03-15  8:33 ` Ruediger Meier
  1 sibling, 1 reply; 7+ messages in thread
From: Karel Zak @ 2016-03-14 15:19 UTC (permalink / raw)
  To: Vasant Hegde; +Cc: util-linux

On Mon, Mar 14, 2016 at 08:18:07PM +0530, Vasant Hegde wrote:
>   Model:                 2.1 (pvr 004b 0201)
>   Model name:            POWER8E (raw), altivec supported
>   ...
>   ...
> ---
>  sys-utils/lscpu.c |    5 +++++
>  1 file changed, 5 insertions(+)

Seems better. Applied, thanks!

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] lscpu: Fix model and model name on Power Systems
  2016-03-14 15:19 ` Karel Zak
@ 2016-03-14 15:20   ` Vasant Hegde
  0 siblings, 0 replies; 7+ messages in thread
From: Vasant Hegde @ 2016-03-14 15:20 UTC (permalink / raw)
  To: Karel Zak; +Cc: util-linux

On 03/14/2016 08:49 PM, Karel Zak wrote:
> On Mon, Mar 14, 2016 at 08:18:07PM +0530, Vasant Hegde wrote:
>>    Model:                 2.1 (pvr 004b 0201)
>>    Model name:            POWER8E (raw), altivec supported
>>    ...
>>    ...
>> ---
>>   sys-utils/lscpu.c |    5 +++++
>>   1 file changed, 5 insertions(+)
>
> Seems better. Applied, thanks!

Karel,

Thanks for the quick response.

-Vasant


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] lscpu: Fix model and model name on Power Systems
  2016-03-14 14:48 [PATCH] lscpu: Fix model and model name on Power Systems Vasant Hegde
  2016-03-14 15:19 ` Karel Zak
@ 2016-03-15  8:33 ` Ruediger Meier
  2016-03-15 13:49   ` Karel Zak
  1 sibling, 1 reply; 7+ messages in thread
From: Ruediger Meier @ 2016-03-15  8:33 UTC (permalink / raw)
  To: Vasant Hegde; +Cc: util-linux, kzak

On Monday 14 March 2016, Vasant Hegde wrote:
> On Power System, lspcu presently displays system model number instead
> of processor model name. 'model' tag in cpuinfo contains system model
> name, not processor model. Instead it uses 'cpu' tag for processor
> model name. Also it uses 'revision' tag for processor model.
>
> Fix lspcu so that it displays processor model number. Also display
> processor model name.
>
> cpuinfo output on Power System:
>   ...
>   ...
>
>   processor	: 127
>   cpu		: POWER8E (raw), altivec supported
>   clock		: 4322.000000MHz
>   revision	: 2.1 (pvr 004b 0201)
>
>   timebase	: 512000000
>   platform	: PowerNV
>   model		: 8286-42A
>   machine	: PowerNV 8286-42A
>   firmware	: OPAL
>
>
> Output without this patch:
>   Architecture:          ppc64le
>   Byte Order:            Little Endian
>   CPU(s):                128
>   On-line CPU(s) list:   0-127
>   Thread(s) per core:    8
>   Core(s) per socket:    4
>   Socket(s):             4
>   NUMA node(s):          4
>   Model:                 8286-42A
>   ...
>   ...
>
> Output with this patch:
>   Architecture:          ppc64le
>   Byte Order:            Little Endian
>   CPU(s):                128
>   On-line CPU(s) list:   0-127
>   Thread(s) per core:    8
>   Core(s) per socket:    4
>   Socket(s):             4
>   NUMA node(s):          4
>   Model:                 2.1 (pvr 004b 0201)
>   Model name:            POWER8E (raw), altivec supported
>   ...
>   ...
>
> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
> ---
>  sys-utils/lscpu.c |    5 +++++
>  1 file changed, 5 insertions(+)
>
> 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.

See below our test diffs. The power7 and sparc dumps look better, x86 is 
broken and ppc-qemu looks odd.


--- /home/abuild/rpmbuild/BUILD/util-linux-2.28.rc1.git35.83a77/tests/expected/lscpu/lscpu-ppc-qemu     
2016-03-13 15:08:02.457989796 +0000
+++ /home/abuild/rpmbuild/BUILD/util-linux-2.28.rc1.git35.83a77/tests/output/lscpu/lscpu-ppc-qemu       
2016-03-15 00:48:52.850000003 +0000
@@ -3,7 +3,8 @@
 Thread(s) per core:    1
 Core(s) per socket:    1
 Socket(s):             1
-Model:                 Power Macintosh
+Model:                 3.1 (pvr 0008 0301)
+Model name:            740/750
 BogoMIPS:              33.25
 L1d cache:             unknown size
 L1i cache:             unknown size
--- /home/abuild/rpmbuild/BUILD/util-linux-2.28.rc1.git35.83a77/tests/expected/lscpu/lscpu-ppc64-POWER7 
2016-03-02 21:33:53.348702004 +0000
+++ /home/abuild/rpmbuild/BUILD/util-linux-2.28.rc1.git35.83a77/tests/output/lscpu/lscpu-ppc64-POWER7   
2016-03-15 00:48:53.080000003 +0000
@@ -4,7 +4,8 @@
 Core(s) per socket:    1
 Socket(s):             4
 NUMA node(s):          1
-Model:                 IBM,8233-E8B
+Model:                 2.1 (pvr 003f 0201)
+Model name:            POWER7 (architected), altivec supported
 L1d cache:             32K
 L1i cache:             32K
 NUMA node0 CPU(s):     0-15
--- /home/abuild/rpmbuild/BUILD/util-linux-2.28.rc1.git35.83a77/tests/expected/lscpu/lscpu-ppc64-POWER7-64cpu   
2016-03-13 15:08:02.457989796 +0000
+++ /home/abuild/rpmbuild/BUILD/util-linux-2.28.rc1.git35.83a77/tests/output/lscpu/lscpu-ppc64-POWER7-64cpu     
2016-03-15 00:48:53.010000003 +0000
@@ -4,7 +4,8 @@
 Core(s) per socket:    1
 Socket(s):             16
 NUMA node(s):          2
-Model:                 IBM,8231-E2B
+Model:                 2.1 (pvr 003f 0201)
+Model name:            POWER7 (architected), altivec supported
 Hypervisor vendor:     pHyp
 Virtualization type:   para
 L1d cache:             32K
--- /home/abuild/rpmbuild/BUILD/util-linux-2.28.rc1.git35.83a77/tests/expected/lscpu/lscpu-sparc64      
2016-03-13 15:08:02.457989796 +0000
+++ /home/abuild/rpmbuild/BUILD/util-linux-2.28.rc1.git35.83a77/tests/output/lscpu/lscpu-sparc64        
2016-03-15 00:48:53.250000003 +0000
@@ -4,6 +4,7 @@
 Thread(s) per core:    1
 Core(s) per socket:    1
 Socket(s):             6
+Model name:            TI UltraSparc II  (BlackBird)
 Flags:                 sun4u

 # The following is the parsable format, which can be fed to other
--- /home/abuild/rpmbuild/BUILD/util-linux-2.28.rc1.git35.83a77/tests/expected/lscpu/lscpu-vbox-win     
2016-03-13 15:08:02.457989796 +0000
+++ /home/abuild/rpmbuild/BUILD/util-linux-2.28.rc1.git35.83a77/tests/output/lscpu/lscpu-vbox-win       
2016-03-15 00:48:53.290000003 +0000
@@ -7,8 +7,6 @@
 NUMA node(s):          1
 Vendor ID:             GenuineIntel
 CPU family:            6
-Model:                 58
-Model name:            Intel(R) Core(TM) i5-3317U CPU @ 1.70GHz
 Stepping:              9
 CPU MHz:               1600.000
 CPU max MHz:           3800.0000
--- /home/abuild/rpmbuild/BUILD/util-linux-2.28.rc1.git35.83a77/tests/expected/lscpu/lscpu-x86_64-64cpu 
2016-03-13 15:08:02.457989796 +0000
+++ /home/abuild/rpmbuild/BUILD/util-linux-2.28.rc1.git35.83a77/tests/output/lscpu/lscpu-x86_64-64cpu   
2016-03-15 00:48:53.710000003 +0000
@@ -7,8 +7,6 @@
 NUMA node(s):          3
 Vendor ID:             GenuineIntel
 CPU family:            6
-Model:                 46
-Model name:            Intel(R) Xeon(R) CPU           X7550  @ 2.00GHz
 Stepping:              6
 CPU MHz:               1064.000
 CPU max MHz:           1996.0000
--- /home/abuild/rpmbuild/BUILD/util-linux-2.28.rc1.git35.83a77/tests/expected/lscpu/lscpu-x86_64-dell_e4310    
2016-03-13 15:08:02.457989796 +0000
+++ /home/abuild/rpmbuild/BUILD/util-linux-2.28.rc1.git35.83a77/tests/output/lscpu/lscpu-x86_64-dell_e4310      
2016-03-15 00:48:53.760000003 +0000
@@ -7,8 +7,6 @@
 NUMA node(s):          1
 Vendor ID:             GenuineIntel
 CPU family:            6
-Model:                 37
-Model name:            Intel(R) Core(TM) i5 CPU       M 560  @ 2.67GHz
 Stepping:              5
 CPU MHz:               1199.000
 CPU max MHz:           2667.0000


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] lscpu: Fix model and model name on Power Systems
  2016-03-15  8:33 ` Ruediger Meier
@ 2016-03-15 13:49   ` Karel Zak
  2016-03-15 15:29     ` Ruediger Meier
  2016-03-16  5:36     ` Vasant Hegde
  0 siblings, 2 replies; 7+ messages in thread
From: Karel Zak @ 2016-03-15 13:49 UTC (permalink / raw)
  To: Ruediger Meier; +Cc: Vasant Hegde, util-linux

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

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] lscpu: Fix model and model name on Power Systems
  2016-03-15 13:49   ` Karel Zak
@ 2016-03-15 15:29     ` Ruediger Meier
  2016-03-16  5:36     ` Vasant Hegde
  1 sibling, 0 replies; 7+ messages in thread
From: Ruediger Meier @ 2016-03-15 15:29 UTC (permalink / raw)
  To: Karel Zak; +Cc: Vasant Hegde, util-linux

On Tuesday 15 March 2016, 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.

I have another idea, just use revision and cpu if available. I'll send a 
patch.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] lscpu: Fix model and model name on Power Systems
  2016-03-15 13:49   ` Karel Zak
  2016-03-15 15:29     ` Ruediger Meier
@ 2016-03-16  5:36     ` Vasant Hegde
  1 sibling, 0 replies; 7+ messages in thread
From: Vasant Hegde @ 2016-03-16  5:36 UTC (permalink / raw)
  To: Karel Zak, Ruediger Meier; +Cc: util-linux

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-03-16  5:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-14 14:48 [PATCH] lscpu: Fix model and model name on Power Systems Vasant Hegde
2016-03-14 15:19 ` Karel Zak
2016-03-14 15:20   ` Vasant Hegde
2016-03-15  8:33 ` Ruediger Meier
2016-03-15 13:49   ` Karel Zak
2016-03-15 15:29     ` Ruediger Meier
2016-03-16  5:36     ` Vasant Hegde

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.