Skip to contentSkip to conversation

x86: cpu/proc.c adding extended_cpuid_level for /proc/cpuinfo

PATCH In review Jaswinder Singh Rajput 6 participants 18 messages May 12, 2009 – Jun 10, 2009 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: cpu/proc.c adding extended_cpuid_level for /proc/cpuinfo

Here are 2 patches for adding new field extended_cpuid_level, please choose PATCH whichever is more appropriate:

PATCH 1:
Subject: [PATCH] x86: cpu/proc.c adding extended_cpuid_level for /proc/cpuinfo

extended_cpuid_level also gives useful information like cpuid_level and very useful for AMD processors.

Adding extended_cpuid_level in /proc/cpuinfo completes cpuid_level info.

---
 arch/x86/kernel/cpu/proc.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
arch/x86/kernel/cpu/proc.c +5 -1
index 523bf39..1279e16 100644
@@ -39,6 +39,7 @@ static void show_cpuinfo_misc(struct seq_file *m, struct cpuinfo_x86 *c)
 		   "fpu\t\t: %s\n"
 		   "fpu_exception\t: %s\n"
 		   "cpuid level\t: %d\n"
+		   "ext cpuid level\t: 0x%x\n"
 		   "wp\t\t: %s\n",
 		   c->fdiv_bug ? "yes" : "no",
 		   c->hlt_works_ok ? "no" : "yes",
@@ -47,6 +48,7 @@ static void show_cpuinfo_misc(struct seq_file *m, struct cpuinfo_x86 *c)
 		   c->hard_math ? "yes" : "no",
 		   fpu_exception ? "yes" : "no",
 		   c->cpuid_level,
+		   c->extended_cpuid_level,
 		   c->wp_works_ok ? "yes" : "no");
 }
 #else
@@ -56,8 +58,10 @@ static void show_cpuinfo_misc(struct seq_file *m, struct cpuinfo_x86 *c)
 		   "fpu\t\t: yes\n"
 		   "fpu_exception\t: yes\n"
 		   "cpuid level\t: %d\n"
+		   "ext cpuid level\t: 0x%x\n"
 		   "wp\t\t: yes\n",
-		   c->cpuid_level);
+		   c->cpuid_level,
+		   c->extended_cpuid_level);
 }
 #endif
 
Signature · 17 lines
1.6.0.6


OR

PATCH 2:
Subject: [PATCH] x86: cpu/proc.c adding extended_cpuid_level for /proc/cpuinfo

extended_cpuid_level also gives useful information like cpuid_level
and very useful for AMD processors.

Adding extended_cpuid_level in /proc/cpuinfo completes cpuid_level info.

Signed-off-by: Jaswinder Singh Rajput <[email protected]>
---
 arch/x86/kernel/cpu/proc.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
arch/x86/kernel/cpu/proc.c +3 -1
index 523bf39..a965bf7 100644
@@ -102,7 +102,9 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 	show_cpuinfo_core(m, c, cpu);
 	show_cpuinfo_misc(m, c);
 
-	seq_printf(m, "flags\t\t:");
+	seq_printf(m, "ext cpuid level\t: 0x%x\n"
+		   "flags\t\t:",
+		   c->extended_cpuid_level);
 	for (i = 0; i < 32*NCAPINTS; i++)
 		if (cpu_has(c, i) && x86_cap_flags[i] != NULL)
 			seq_printf(m, " %s", x86_cap_flags[i]);
Signature · 1 line
1.6.0.6
#1 lore raw

Hi,

Quoted 11 lines · Jaswinder Singh Rajput

Here are 2 patches for adding new field extended_cpuid_level, please choose PATCH whichever is more appropriate:

PATCH 1:
Subject: [PATCH] x86: cpu/proc.c adding extended_cpuid_level for /proc/cpuinfo

extended_cpuid_level also gives useful information like cpuid_level and very useful for AMD processors.

Adding extended_cpuid_level in /proc/cpuinfo completes cpuid_level info.

and this is needed because... ?!

Signature · 8 lines
Regards/Gruss,
Boris.

Operating | Advanced Micro Devices GmbH
  System  | Karl-Hammerschmidt-Str. 34, 85609 Dornach b. München, Germany
 Research | Geschäftsführer: Thomas M. McCoy, Giuliano Meroni
  Center  | Sitz: Dornach, Gemeinde Aschheim, Landkreis München
  (OSRC)  | Registergericht München, HRB Nr. 43632
#2 lore raw
Quoted 10 lines · Borislav Petkov

Hi,

Quoted 7 lines · Jaswinder Singh Rajput

Here are 2 patches for adding new field extended_cpuid_level, please choose PATCH whichever is more appropriate:

PATCH 1:
Subject: [PATCH] x86: cpu/proc.c adding extended_cpuid_level for /proc/cpuinfo

Quoted 7 lines
Quoted 4 lines

extended_cpuid_level also gives useful information like cpuid_level and very useful for AMD processors.

Adding extended_cpuid_level in /proc/cpuinfo completes cpuid_level info.

and this is needed because... ?!

why we need cpuid_level ?

#3 lore raw
Quoted 14 lines · Jaswinder Singh Rajput
Quoted 13 lines · Borislav Petkov

Hi,

Quoted 10 lines · Jaswinder Singh Rajput

Here are 2 patches for adding new field extended_cpuid_level, please choose PATCH whichever is more appropriate:

PATCH 1:
Subject: [PATCH] x86: cpu/proc.c adding extended_cpuid_level for /proc/cpuinfo

extended_cpuid_level also gives useful information like cpuid_level and very useful for AMD processors.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Adding extended_cpuid_level in /proc/cpuinfo completes cpuid_level info.

and this is needed because... ?!

why we need cpuid_level ?

It is already visible in userspace. I think you've got an answer to a very similar question already:

http://marc.info/?l=linux-kernel&m=124206571628464

Signature · 8 lines
Regards/Gruss,
Boris.

Operating | Advanced Micro Devices GmbH
  System  | Karl-Hammerschmidt-Str. 34, 85609 Dornach b. München, Germany
 Research | Geschäftsführer: Thomas M. McCoy, Giuliano Meroni
  Center  | Sitz: Dornach, Gemeinde Aschheim, Landkreis München
  (OSRC)  | Registergericht München, HRB Nr. 43632
#4 lore raw
Quoted 8 lines · Borislav Petkov
Quoted 2 lines
Quoted 1 line

why we need cpuid_level ?

It is already visible in userspace. I think you've got an answer to a very similar question already:

http://marc.info/?l=linux-kernel&m=124206571628464

extended_cpuid_level should be motivated, but probably does make sense.
It hardly "completes" /proc/cpuinfo; especially if you consider that
there are at least three additional ranges in wide use (two used by a single vendor only, and the third by virtualization software.)

-hpa

Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.
#5 lore raw

Hi,

Quoted 11 lines · H. Peter Anvin
Quoted 8 lines · Borislav Petkov
Quoted 2 lines
Quoted 1 line

why we need cpuid_level ?

It is already visible in userspace. I think you've got an answer to a very similar question already:

http://marc.info/?l=linux-kernel&m=124206571628464

extended_cpuid_level should be motivated, but probably does make sense.

I still fail to see the need for adding that to /proc/cpuinfo, especially if you can do the whole exercise from userspace. But I'm sure you have a good example.

Quoted 3 lines

It hardly "completes" /proc/cpuinfo; especially if you consider that
there are at least three additional ranges in wide use (two used by a single vendor only, and the third by virtualization software.)

I think both vendors use the two ranges :-o).

Signature · 8 lines
Regards/Gruss,
Boris.

Operating | Advanced Micro Devices GmbH
  System  | Karl-Hammerschmidt-Str. 34, 85609 Dornach b. München, Germany
 Research | Geschäftsführer: Thomas M. McCoy, Giuliano Meroni
  Center  | Sitz: Dornach, Gemeinde Aschheim, Landkreis München
  (OSRC)  | Registergericht München, HRB Nr. 43632
#6 lore raw
Quoted 7 lines · Borislav Petkov
Quoted 4 lines

It hardly "completes" /proc/cpuinfo; especially if you consider that
there are at least three additional ranges in wide use (two used by a single vendor only, and the third by virtualization software.)

I think both vendors use the two ranges :-o).

No, I'm taking about the 0x8086xxxx and 0xC000xxxx used by two other vendors (neither of which you and I work for, and at least one of which is defunct.)

-hpa

Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.
#7 lore raw

Hi,

Quoted 6 lines · H. Peter Anvin
Quoted 5 lines · Borislav Petkov
Quoted 4 lines

 It hardly "completes" /proc/cpuinfo; especially if you consider that there are at least three additional ranges in wide use (two used by a single vendor only, and the third by virtualization software.)

Quoted 6 lines
Quoted 2 lines

I think both vendors use the two ranges :-o).

No, I'm taking about the 0x8086xxxx and 0xC000xxxx used by two other vendors (neither of which you and I work for, and at least one of which is defunct.)

Ah, yes. Gotcha.

Signature · 2 lines
Regards/Gruss,
Boris
#8 lore raw
In reply to H. Peter Anvin
Quoted 7 lines · H. Peter Anvin
Quoted 6 lines · Borislav Petkov
Quoted 2 lines
Quoted 1 line

why we need cpuid_level ?

It is already visible in userspace. I think you've got an answer to a very similar question already:

Quoted 8 lines
Quoted 2 lines

http://marc.info/?l=linux-kernel&m=124206571628464

extended_cpuid_level should be motivated, but probably does make sense.
It hardly "completes" /proc/cpuinfo; especially if you consider that
there are at least three additional ranges in wide use (two used by a single vendor only, and the third by virtualization software.)

So how can we complete it.

--
JSR

#9 lore raw
In reply to Jaswinder Singh Rajput

Review

Quoted 1 line · On Tue, 12 May 2009 12:44:42 +0530 Jaswinder Singh Rajput…
(quoted diff) +1 -0
+		   "ext cpuid level\t: 0x%x\n"

It's unobvious what "ext" means. External?

Can we make it "extended cpuid level"?

One would hope that google(extended cpuid level) tells you what an extended cpuid level is, but alas, unclear.

#10 lore raw
Quoted 10 lines · Andrew Morton

Review

Quoted 1 line · On Tue, 12 May 2009 12:44:42 +0530 Jaswinder Singh Rajput…
(quoted diff) +1 -0
+		   "ext cpuid level\t: 0x%x\n"

It's unobvious what "ext" means. External?

Can we make it "extended cpuid level"?

One would hope that google(extended cpuid level) tells you what an extended cpuid level is, but alas, unclear.

AMD has an own cpuid range in 0x8000_0000+. But it's only useful if you actually access it using cpuid. Everyone who needs it already needs to call cpuid and if they do that they can as well retrieve it by themselves.

Without accessing CPUID it has no value at whatsoever. It would also seem pretty dumb to spend a few thousand cycles getting it from the kernel when you can as well get it directly from CPUID and you need to have that code anyways.

The useful information in 8000_0000+ is all reported by the kernel anyways.

-Andi

Signature · 1 line
[email protected] -- Speaking for myself only.
#11 lore raw
In reply to Andrew Morton

Hello Andrew,

Quoted 7 lines · Andrew Morton

Review

Quoted 1 line · On Tue, 12 May 2009 12:44:42 +0530 Jaswinder Singh Rajput…
(quoted diff) +1 -0
+		   "ext cpuid level\t: 0x%x\n"

It's unobvious what "ext" means. External?

Can we make it "extended cpuid level"?

extended cpuid level will look like this :

fpu : yes
fpu_exception : yes
cpuid level : 5
wp : yes
extended cpuid level: 0x80000008
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe constant_tsc pebs bts pni dtes64 monitor ds_cpl cid

Is this OK ?

Thanks,
--
JSR

#12 lore raw
Quoted 10 lines · Jaswinder Singh Rajput

Hello Andrew,

Quoted 6 lines · Andrew Morton

Review

Quoted 1 line · On Tue, 12 May 2009 12:44:42 +0530 Jaswinder Singh Rajput…
(quoted diff) +1 -0
+		   "ext cpuid level\t: 0x%x\n"

It's unobvious what "ext" means. External?

Can we make it "extended cpuid level"?

Quoted 9 lines

extended cpuid level will look like this :

fpu : yes
fpu_exception : yes
cpuid level : 5
wp : yes
extended cpuid level: 0x80000008
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe constant_tsc pebs bts pni dtes64 monitor ds_cpl cid

The more I'm thinking about this I think it was a mistake to put cpuid
level: there in the first place, too. My opinion is increasingly to leave this to x86info or other user-space tools.

-hpa

#13 lore raw
Quoted 21 lines · H. Peter Anvin
Quoted 10 lines · Jaswinder Singh Rajput

Hello Andrew,

Quoted 6 lines · Andrew Morton

Review

Quoted 1 line · On Tue, 12 May 2009 12:44:42 +0530 Jaswinder Singh Rajput…
(quoted diff) +1 -0
+		   "ext cpuid level\t: 0x%x\n"

It's unobvious what "ext" means. External?

Can we make it "extended cpuid level"?

Quoted 9 lines

extended cpuid level will look like this :

fpu : yes
fpu_exception : yes
cpuid level : 5
wp : yes
extended cpuid level: 0x80000008
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe constant_tsc pebs bts pni dtes64 monitor ds_cpl cid

Quoted 4 lines

The more I'm thinking about this I think it was a mistake to put cpuid
level: there in the first place, too. My opinion is increasingly to leave this to x86info or other user-space tools.

cpuid level is as important as cpu family, model and stepping.

For Intel, in some cases cpuid level is more important then cpu family, model and stepping. Like you cannot tell by looking at cpu family, model and stepping which model is new and which is old like 05_01 or 06_1A or 0F_03H ?

But by looking at cpuid level and extended cpuid level you can tell which is new and which is old and which supports more features.

So cpuid level and extended cpuid level is better scale than cpu family, model and stepping. So I think hiding this valuable information is a crime.

Thanks,
--
JSR

#14 lore raw

Hello Peter,

Quoted 34 lines · Jaswinder Singh Rajput
Quoted 21 lines · H. Peter Anvin
Quoted 10 lines · Jaswinder Singh Rajput

Hello Andrew,

Quoted 6 lines · Andrew Morton

Review

Quoted 1 line · On Tue, 12 May 2009 12:44:42 +0530 Jaswinder Singh Rajput…
(quoted diff) +1 -0
+		   "ext cpuid level\t: 0x%x\n"

It's unobvious what "ext" means. External?

Can we make it "extended cpuid level"?

Quoted 9 lines

extended cpuid level will look like this :

fpu : yes
fpu_exception : yes
cpuid level : 5
wp : yes
extended cpuid level: 0x80000008
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe constant_tsc pebs bts pni dtes64 monitor ds_cpl cid

Quoted 4 lines

The more I'm thinking about this I think it was a mistake to put cpuid
level: there in the first place, too. My opinion is increasingly to leave this to x86info or other user-space tools.

cpuid level is as important as cpu family, model and stepping.

For Intel, in some cases cpuid level is more important then cpu family, model and stepping. Like you cannot tell by looking at cpu family, model and stepping which model is new and which is old like 05_01 or 06_1A or 0F_03H ?

Quoted 7 lines

But by looking at cpuid level and extended cpuid level you can tell which is new and which is old and which supports more features.

So cpuid level and extended cpuid level is better scale than cpu family, model and stepping. So I think hiding this valuable information is a crime.

Highest Value in EAX
Intel 64 or IA-32 Processors Basic Information Extended Function
Information
Earlier Intel486 Processors CPUID Not Implemented CPUID Not Implemented
Later Intel486 Processors and 01H Not Implemented
Pentium Processors
Pentium Pro and Pentium II 02H Not Implemented
Processors, Intel Celeron
Processors

Pentium III Processors                 03H                     Not Implemented
Pentium 4 Processors                   02H                       80000004H
Intel Xeon Processors                  02H                       80000004H
Pentium M Processor                    02H                       80000004H
Pentium 4 Processor                    05H                       80000008H
supporting Hyper-Threading
Technology
Pentium D Processor (8xx)              05H                       80000008H
Pentium D Processor (9xx)              06H                       80000008H
Intel Core Duo Processor               0AH                       80000008H
Intel Core 2 Duo Processor             0AH                       80000008H
Intel Xeon Processor 3000,             0AH                       80000008H

5100, 5200, 5300, 5400
Series
Intel Core 2 Duo Processor 0DH 80000008H
8000 Series
Intel Xeon Processor 5200, 0AH 80000008H
5400 Series

Intel Atom Processor                   0AH                       80000008H
Intel Core i7 Processor                0BH                       80000008H

cpuid level and extended cpuid level tells the information about Intel processor model.
Do you still think it is useless and should not be present in /proc/cpuinfo .

Thanks,
--
JSR

#15 lore raw
Quoted 15 lines
Quoted 15 lines
Quoted 5 lines
Quoted 1 line

The more I'm thinking about this I think it was a mistake to put cpuid
level: there in the first place, too. My opinion is increasingly to leave this to x86info or other user-space tools.

cpuid level is as important as cpu family, model and stepping.

For Intel, in some cases cpuid level is more important then cpu family, model and stepping. Like you cannot tell by looking at cpu family, model and stepping which model is new and which is old like 05_01 or 06_1A or 0F_03H ?

But by looking at cpuid level and extended cpuid level you can tell which is new and which is old and which supports more features.

Quoted 8 lines
Quoted 3 lines

So cpuid level and extended cpuid level is better scale than cpu family, model and stepping. So I think hiding this valuable information is a crime.

cpuid level and extended cpuid level tells the information about Intel processor model. Do you still think it is useless and should not be present in /proc/cpuinfo .

I think it's pointless, because if you're doing this kind of stuff you might as well talk to CPUID directly. We have a CPUID interface already. The kernel isn't meant to replicate x86info or any of those tools -- it really can't, and at that point why stop at x86info... we could replicate arbitrary applications at that point.

As far as extended CPUID, why only the 0x0000 and 0x8000 ranges? Transmeta used 0x8086 and VIA uses 0xC000, but we don't even cache those internally, nevermind display them.

I'm not really all that doctrinal about this, but I'd like to get a decent answer to the question "where does it stop, *and why*". It's a slippery slope, and without a target, it goes on forever.

-hpa

Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.
#16 lore raw
Quoted 30 lines · H. Peter Anvin
Quoted 15 lines
Quoted 15 lines
Quoted 5 lines
Quoted 1 line

The more I'm thinking about this I think it was a mistake to put cpuid
level: there in the first place, too. My opinion is increasingly to leave this to x86info or other user-space tools.

cpuid level is as important as cpu family, model and stepping.

For Intel, in some cases cpuid level is more important then cpu family, model and stepping. Like you cannot tell by looking at cpu family, model and stepping which model is new and which is old like 05_01 or 06_1A or 0F_03H ?

But by looking at cpuid level and extended cpuid level you can tell which is new and which is old and which supports more features.

Quoted 8 lines
Quoted 3 lines

So cpuid level and extended cpuid level is better scale than cpu family, model and stepping. So I think hiding this valuable information is a crime.

cpuid level and extended cpuid level tells the information about Intel processor model. Do you still think it is useless and should not be present in /proc/cpuinfo .

I think it's pointless, because if you're doing this kind of stuff you might as well talk to CPUID directly. We have a CPUID interface already. The kernel isn't meant to replicate x86info or any of those tools -- it really can't, and at that point why stop at x86info... we could replicate arbitrary applications at that point.

Quoted 7 lines

As far as extended CPUID, why only the 0x0000 and 0x8000 ranges? Transmeta used 0x8086 and VIA uses 0xC000, but we don't even cache those internally, nevermind display them.

I'm not really all that doctrinal about this, but I'd like to get a decent answer to the question "where does it stop, *and why*". It's a slippery slope, and without a target, it goes on forever.

I still fail to see a real use case which requires adding that info to the kernel and querying CPUID directly is _absolutely_ not an option. This is what the decisive argument should be and not some "but we have already this and that in there." Otherwise its like painting a broken car pink - it's still broken.

Signature · 8 lines
Regards/Gruss,
Boris.

Operating | Advanced Micro Devices GmbH
  System  | Karl-Hammerschmidt-Str. 34, 85609 Dornach b. München, Germany
 Research | Geschäftsführer: Thomas M. McCoy, Giuliano Meroni
  Center  | Sitz: Dornach, Gemeinde Aschheim, Landkreis München
  (OSRC)  | Registergericht München, HRB Nr. 43632
#17 lore raw
Quoted 11 lines · Borislav Petkov
Quoted 4 lines

I'm not really all that doctrinal about this, but I'd like to get a decent answer to the question "where does it stop, *and why*". It's a slippery slope, and without a target, it goes on forever.

I still fail to see a real use case which requires adding that info to the kernel and querying CPUID directly is _absolutely_ not an option. This is what the decisive argument should be and not some "but we have already this and that in there." Otherwise its like painting a broken car pink - it's still broken.

Exactly, the question is where does it stop *and why* -- give a coherent argument why drawing a line at any one particular place makes sense.

-hpa

Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.