Bug 16322

Summary: WARNING: at /arch/x86/include/asm/processor.h:1005 read_measured_perf_ctrs+0x5a/0x70()
Product: Other Reporter: boris64 (bugzilla.kernel.org)
Component: OtherAssignee: other_other
Status: CLOSED CODE_FIX    
Severity: normal CC: a.p.zijlstra, akpm, alexwild, bp, ck+kernelbugzilla, dkspamdk, hpa, jonas, maciej.rutecki, rjw, sarvatt, thebigguy.co.uk
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.35-rc3 Subsystem:
Regression: Yes Bisected commit-id:
Bug Depends on:    
Bug Blocks: 16055    
Attachments: kernel .config
dmesg output
lspci -vv
cat /proc/cpuinfo
cat /proc/cpuinfo (kernel-2.6.34)
debug CPUID features init
dmesg of kernel-2.6.35-rc4+ with cpuid debug patch
debug cpuid -v2
dmesg of kernel-2.6.35-rc4+ with cpuid debug patch v2
dmesg of kernel-2.6.34.1 with cpuid debug patch v2
restore 34.1 cpuid feat detection
dmesg of kernel-2.6.35-rc4+ with cpuid debug patch v3
Re-run get_cpu_cap() after unmasking CPUID levels
Re-run get_cpu_cap() after unmasking CPUID levels (trying again)
dmesg of kernel-2.6.35-rc4+ with cpuid debug patch v4
cat /proc/cpuinfo (2.6.35-cpuiddebug-v4)
dmesg output
lspci -vv output
/proc/cpuinfo output
Unbreak CPB CPUID feature
Test patch; should fix Atom N270 at least
dmidecode output
CPUID dumping program (C source)
CPUID strace output
Updated CPUID-dumping program
Fixed CPUID program (v3)
Patch, version 3
dmidecode
/proc/cpuinfo
cpu info (cpuid and /proc/cpuinfo output)
-rc6 dmesg.txt

Description boris64 2010-07-01 13:54:15 UTC
Created attachment 26987 [details]
kernel .config

While booting an up2date kernel from git i get the following warning:

[    1.604263] ------------[ cut here ]------------
[    1.604270] WARNING: at /home/files/src/git-repos/linux-2.6-t3R/arch/x86/include/asm/processor.h:1005 read_measured_perf_ctrs+0x5a/0x70()
[    1.604272] Hardware name: P5K
[    1.604273] Modules linked in:
[    1.604277] Pid: 521, comm: kondemand/2 Not tainted 2.6.35-rc3-v2k11+-testing-00336-g980019d-dirty #160
[    1.604279] Call Trace:
[    1.604284]  [<ffffffff8103c04a>] warn_slowpath_common+0x7a/0xb0
[    1.604288]  [<ffffffff8101a330>] ? read_measured_perf_ctrs+0x0/0x70
[    1.604291]  [<ffffffff8103c095>] warn_slowpath_null+0x15/0x20
[    1.604294]  [<ffffffff8101a38a>] read_measured_perf_ctrs+0x5a/0x70
[    1.604298]  [<ffffffff81066fc3>] smp_call_function_single+0x83/0x170
[    1.604301]  [<ffffffff8101a2b7>] cpufreq_get_measured_perf+0x27/0xa0
[    1.604305]  [<ffffffff81435379>] __cpufreq_driver_getavg+0x59/0x80
[    1.604309]  [<ffffffff81437284>] do_dbs_timer+0xf4/0x3a0
[    1.604312]  [<ffffffff81437190>] ? do_dbs_timer+0x0/0x3a0
[    1.604315]  [<ffffffff8104fc71>] worker_thread+0x161/0x240
[    1.604319]  [<ffffffff810541f0>] ? autoremove_wake_function+0x0/0x40
[    1.604322]  [<ffffffff8104fb10>] ? worker_thread+0x0/0x240
[    1.604325]  [<ffffffff81053d5e>] kthread+0x8e/0xa0
[    1.604329]  [<ffffffff81003154>] kernel_thread_helper+0x4/0x10
[    1.604332]  [<ffffffff81053cd0>] ? kthread+0x0/0xa0
[    1.604336]  [<ffffffff81003150>] ? kernel_thread_helper+0x0/0x10
[    1.604338] ---[ end trace f6ca9c5ff403e784 ]---


If you need more infos please tell me what you need.
If i need to enable more debug stuff inside my kernel,
tell me what to include!
Comment 1 boris64 2010-07-01 13:55:23 UTC
Created attachment 26988 [details]
dmesg output
Comment 2 boris64 2010-07-01 13:56:20 UTC
Created attachment 26989 [details]
lspci -vv
Comment 3 Peter Zijlstra 2010-07-03 09:14:39 UTC
Could you provide the contents of /proc/cpuinfo ? We need to figure out why cpufreq thinks you do have mperf/aperf but the cpu feature flags disagree.
Comment 4 boris64 2010-07-03 09:25:15 UTC
Created attachment 27003 [details]
cat /proc/cpuinfo

Here we go ;)
Comment 5 Peter Zijlstra 2010-07-05 07:45:48 UTC
Oh wow, look at that. For some reason cpu #1 doesn't have aperfmperf in the flags line, all others do.

That is most strange for a quad core, since those are supposed to be perfectly symmetrical. We get the information from CPUID, ECX, level 6, bit 0.

So for some reason your CPUID output is corrupted..
Comment 6 boris64 2010-07-05 23:14:09 UTC
Created attachment 27028 [details]
cat /proc/cpuinfo (kernel-2.6.34)

I just took a look at the cpuinfo output under a kernel2-6-34.
Guess what, "aperfmperf" shows up on every processor.
Comment 7 Peter Zijlstra 2010-07-07 15:20:20 UTC
hpa, any clue as to what could have changed between .34 and now to cause inconsistent cpu feature flags?

Initially I though b0rken BIOS but if one kernel works and another not (in a reliable fashion) that seems unlikely.
Comment 8 H. Peter Anvin 2010-07-07 15:59:28 UTC
It does, indeed... although we have some early workarounds I don't think *off the top of my head* this particular one is involved.  Probably need to trace the early code paths and look.
Comment 9 Rafael J. Wysocki 2010-07-08 23:32:37 UTC
Handled-By : H. Peter Anvin <hpa@zytor.com>
Comment 10 Borislav Petkov 2010-07-09 07:52:29 UTC
Created attachment 27052 [details]
debug CPUID features init
Comment 11 Borislav Petkov 2010-07-09 07:53:26 UTC
Well, X86_FEATURE_APERFMPERF is checked for in
init_scattered_cpuid_features() so it has to be that CPUID level
verification that fails due to some strange reason.

boris64, can you try the following debug patch on the failing kernel
(attachment #27052 [details]):

---
diff --git a/arch/x86/kernel/cpu/addon_cpuid_features.c b/arch/x86/kernel/cpu/addon_cpuid_features.c
index 10fa568..5a4ab80 100644
--- a/arch/x86/kernel/cpu/addon_cpuid_features.c
+++ b/arch/x86/kernel/cpu/addon_cpuid_features.c
@@ -46,12 +46,16 @@ void __cpuinit init_scattered_cpuid_features(struct cpuinfo_x86 *c)
 		/* Verify that the level is valid */
 		max_level = cpuid_eax(cb->level & 0xffff0000);
 		if (max_level < cb->level ||
-		    max_level > (cb->level | 0xffff))
+		    max_level > (cb->level | 0xffff)) {
+			pr_err("%s: invalid level: 0x%08x, cpu: %d\n", __func__, max_level, c->apicid);
 			continue;
+		}
 
 		cpuid(cb->level, &regs[CR_EAX], &regs[CR_EBX],
 			&regs[CR_ECX], &regs[CR_EDX]);
 
+		pr_err("%s: reg: 0x%08x\n", __func__, regs[cb->reg]);
+
 		if (regs[cb->reg] & (1 << cb->bit))
 			set_cpu_cap(c, cb->feature);
 	}
Comment 12 boris64 2010-07-09 10:54:15 UTC
Created attachment 27057 [details]
dmesg of kernel-2.6.35-rc4+ with cpuid debug patch

dmesg of kernel-2.6.35-rc4+ with cpuid debug patch
Comment 13 Borislav Petkov 2010-07-09 11:23:34 UTC
Created attachment 27058 [details]
debug cpuid -v2
Comment 14 Borislav Petkov 2010-07-09 11:25:39 UTC
Ok, I admit, the first patch was a bit clumsy but it shows where the problem is:

cpuid_eax(0) = 0x00000002 on core 1 which is the largest standard
function supported by cpuid. And the funny thing is that on the other
cores you're passing the checks just fine.

[    0.020059] CPU0: Intel(R) Core(TM)2 Quad  CPU   Q9300  @ 2.50GHz stepping 07
[    0.025016] Booting Node   0, Processors  #1
[    0.001999] init_scattered_cpuid_features: invalid level: 0x00000002, cpu: 0
[    0.001999] init_scattered_cpuid_features: invalid level: 0x00000002, cpu: 0
[    0.001999] init_scattered_cpuid_features: invalid level: 0x00000002, cpu: 0
[    0.001999] init_scattered_cpuid_features: reg: 0x00000000
[    0.001999] init_scattered_cpuid_features: invalid level: 0x80000008, cpu: 0
[    0.001999] init_scattered_cpuid_features: invalid level: 0x80000008, cpu: 0
[    0.001999] init_scattered_cpuid_features: invalid level: 0x80000008, cpu: 0
[    0.001999] init_scattered_cpuid_features: invalid level: 0x80000008, cpu: 0

Can you try the new patch now at attachment #27058 [details] on _both_ the failing and the
working kernels. Also, can you check whether your BIOS is up to date?

Thanks.
Comment 15 boris64 2010-07-09 11:30:41 UTC
Yep, i'll do that.

PS: BIOS is up to date (last BIOS on the 
ASUS support site is dated 2008/11/07)
Comment 16 boris64 2010-07-09 11:52:26 UTC
Created attachment 27059 [details]
dmesg of kernel-2.6.35-rc4+ with cpuid debug patch v2
Comment 17 boris64 2010-07-09 11:53:21 UTC
Created attachment 27060 [details]
dmesg of kernel-2.6.34.1 with cpuid debug patch v2
Comment 18 Borislav Petkov 2010-07-09 14:12:34 UTC
Created attachment 27061 [details]
restore 34.1 cpuid feat detection
Comment 19 Borislav Petkov 2010-07-09 14:15:24 UTC
Ok, the patch at attachment #27061 [details] restores the aperf/mperf detection behavior from 34 to the current failing kernel. If it works, then it looks like core1 is somehow delayed with initializing cpuid feats properly.

Please test,
thanks.
Comment 20 boris64 2010-07-09 14:39:12 UTC
Created attachment 27062 [details]
dmesg of kernel-2.6.35-rc4+ with cpuid debug patch v3

Ok, done. The warning still seems to be there.
Comment 21 H. Peter Anvin 2010-07-09 23:26:34 UTC
Created attachment 27063 [details]
Re-run get_cpu_cap() after unmasking CPUID levels

Please try the
Comment 22 H. Peter Anvin 2010-07-09 23:27:24 UTC
Please try the above patch, that should have been...
Comment 23 boris64 2010-07-10 02:09:55 UTC
Hm, when i try your attachment
https://bugzilla.kernel.org/attachment.cgi?id=27063,
i get an adobe ppd file instead of a patch. Is konqueror
tricking me or did something go wrong here?
Comment 24 boris64 2010-07-18 15:40:01 UTC
Hey Peter, any news on this? As written before,
your last posted patch is a ppd file(?) instead
of a proper patch. Thank you in advance.
Comment 25 H. Peter Anvin 2010-07-18 23:56:45 UTC
It's just konqueror being full of it.  Just save it as a file.
Comment 26 boris64 2010-07-19 00:09:21 UTC
It's the same problem in mozilla/iexplorer. Are we
both talking about the same attachment?

"Re-run get_cpu_cap() after unmasking CPUID levels   (98.40 KB, patch)
2010-07-09 23:26, H. Peter Anvin"
-> https://bugzilla.kernel.org/attachment.cgi?id=27063

It really is a ppd, isn't it? You don't own a laserjet 420, do you? ;)
Comment 27 H. Peter Anvin 2010-07-19 00:19:57 UTC
The hell... no I don't.
Comment 28 H. Peter Anvin 2010-07-19 00:26:16 UTC
Created attachment 27137 [details]
Re-run get_cpu_cap() after unmasking CPUID levels (trying again)
Comment 29 H. Peter Anvin 2010-07-19 17:29:53 UTC
Did the corrected patch work?
Comment 30 boris64 2010-07-19 18:44:39 UTC
Nope, sorry, didn't seem to fix it. Warning is 
still there. Additionally core1 now misses two flags
(aperfmon+aperfmperf) instead of only missing aperfmperf.
Comment 31 boris64 2010-07-19 18:46:10 UTC
Created attachment 27158 [details]
dmesg of kernel-2.6.35-rc4+ with cpuid debug patch v4
Comment 32 boris64 2010-07-19 18:48:00 UTC
Created attachment 27159 [details]
cat /proc/cpuinfo (2.6.35-cpuiddebug-v4)
Comment 33 Rafael J. Wysocki 2010-08-01 14:40:57 UTC
On Sunday, August 01, 2010, Boris Cuber wrote:
> Am Sonntag, 1. August 2010 schrieben Sie:
> > This message has been generated automatically as a part of a summary report
> > of recent regressions.
> > 
> > The following bug entry is on the current list of known regressions
> > from 2.6.34.  Please verify if it still should be listed and let the
> > tracking team know (either way).
> > 
> > 
> > Bug-Entry   : http://bugzilla.kernel.org/show_bug.cgi?id=16322
> > Subject             : WARNING: at /arch/x86/include/asm/processor.h:1005
> > read_measured_perf_ctrs+0x5a/0x70()
> > Date                : 2010-07-01 13:54 (32 days old)
> 
>  Warning is still there on 2.6.35-rc6+
Comment 34 Rafael J. Wysocki 2010-08-30 17:02:34 UTC
On Monday, August 30, 2010, Boris Cuber wrote:
> Am Montag, 30. August 2010 schrieben Sie:
> > This message has been generated automatically as a part of a report
> > of regressions introduced between 2.6.34 and 2.6.35.
> > 
> > The following bug entry is on the current list of known regressions
> > introduced between 2.6.34 and 2.6.35.  Please verify if it still should
> > be listed and let the tracking team know (either way).
> > 
> > 
> > Bug-Entry   : http://bugzilla.kernel.org/show_bug.cgi?id=16322
> > Subject             : WARNING: at /arch/x86/include/asm/processor.h:1005
> > read_measured_perf_ctrs+0x5a/0x70() Submitter       : boris64
> > <bugzilla.kernel.org@boris64.net>
> > Date                : 2010-07-01 13:54 (60 days old)
> > Handled-By  : H. Peter Anvin <hpa@zytor.com>
> 
> The warning is still present in v2.6.35.4 and v2.6.36-rc3.
Comment 35 Conrad Kostecki 2010-09-11 13:26:21 UTC
Hi!
Today, I've also found out, that I seem to have affacted by this bug too.
On boot, I get this:

------------[ cut here ]------------
WARNING: at /usr/src/linux-2.6.35-gentoo-r5/arch/x86/include/asm/processor.h:1005 0x81017063()
Hardware name:
Modules linked in:
Pid: 386, comm: kondemand/0 Not tainted 2.6.35-gentoo-r5 #1
Call Trace:
 [<81030349>] ? 0x81030349
 [<81017063>] ? 0x81017063
 [<81017063>] ? 0x81017063
 [<81017020>] ? 0x81017020
 [<8103039c>] ? 0x8103039c
 [<81017063>] ? 0x81017063
 [<810562b9>] ? 0x810562b9
 [<81016f71>] ? 0x81016f71
 [<81129d6f>] ? 0x81129d6f
 [<812a75a6>] ? 0x812a75a6
 [<812a976a>] ? 0x812a976a
 [<81040954>] ? 0x81040954
 [<813c4876>] ? 0x813c4876
 [<81044420>] ? 0x81044420
 [<81040860>] ? 0x81040860
 [<810440c4>] ? 0x810440c4
 [<81044050>] ? 0x81044050
 [<810031be>] ? 0x810031be
---[ end trace f21826c06392746e ]---
Comment 36 Conrad Kostecki 2010-09-11 13:28:04 UTC
Created attachment 29622 [details]
dmesg output
Comment 37 Conrad Kostecki 2010-09-11 13:28:57 UTC
Created attachment 29632 [details]
lspci -vv output
Comment 38 Conrad Kostecki 2010-09-11 13:30:52 UTC
Created attachment 29642 [details]
/proc/cpuinfo output

The Error also accours, when I am using the "vanilla" kernel and not the gentoo kernel (aka gentoo-sources).
Comment 39 Rafael J. Wysocki 2010-09-12 21:47:32 UTC
On Sunday, September 12, 2010, Boris Cuber wrote:
> Am Sunday 12 September 2010 schrieben Sie:
> > This message has been generated automatically as a part of a report
> > of regressions introduced between 2.6.34 and 2.6.35.
> > 
> > The following bug entry is on the current list of known regressions
> > introduced between 2.6.34 and 2.6.35.  Please verify if it still should
> > be listed and let the tracking team know (either way).
> > 
> > 
> > Bug-Entry   : http://bugzilla.kernel.org/show_bug.cgi?id=16322
> > Subject             : WARNING: at /arch/x86/include/asm/processor.h:1005
> > read_measured_perf_ctrs+0x5a/0x70() Submitter       : boris64
> > <bugzilla.kernel.org@boris64.net>
> > Date                : 2010-07-01 13:54 (74 days old)
> > Handled-By  : H. Peter Anvin <hpa@zytor.com>
> 
> Not fixed yet.
> Warning is still there in 2.6.35.4 & 2.6.36-rc3+.
Comment 40 Ritz 2010-09-14 09:31:11 UTC
Still present in 2.6.36-rc4

cat /proc/cpuinfo

processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 28
model name	: Intel(R) Atom(TM) CPU N270   @ 1.60GHz
stepping	: 2
cpu MHz		: 800.000
cache size	: 512 KB
physical id	: 0
siblings	: 2
core id		: 0
cpu cores	: 1
apicid		: 0
initial apicid	: 0
fdiv_bug	: no
hlt_bug		: no
f00f_bug	: no
coma_bug	: no
fpu		: yes
fpu_exception	: yes
cpuid level	: 10
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx constant_tsc arch_perfmon pebs bts aperfmperf pni dtes64 monitor ds_cpl est tm2 ssse3 xtpr pdcm movbe lahf_lm
bogomips	: 3192.41
clflush size	: 64
cache_alignment	: 64
address sizes	: 32 bits physical, 32 bits virtual
power management:

processor	: 1
vendor_id	: GenuineIntel
cpu family	: 6
model		: 28
model name	: Intel(R) Atom(TM) CPU N270   @ 1.60GHz
stepping	: 2
cpu MHz		: 800.000
cache size	: 512 KB
physical id	: 0
siblings	: 2
core id		: 0
cpu cores	: 1
apicid		: 1
initial apicid	: 1
fdiv_bug	: no
hlt_bug		: no
f00f_bug	: no
coma_bug	: no
fpu		: yes
fpu_exception	: yes
cpuid level	: 10
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx constant_tsc arch_perfmon pebs bts pni dtes64 monitor ds_cpl est tm2 ssse3 xtpr pdcm movbe lahf_lm
bogomips	: 3191.95
clflush size	: 64
cache_alignment	: 64
address sizes	: 32 bits physical, 32 bits virtual
power management:
Comment 41 Ritz 2010-09-18 20:38:54 UTC
Something to do with this patch?

http://lkml.org/lkml/2010/3/26/119
Comment 42 Alex 2010-09-19 09:43:50 UTC
Hi Ritz,

removing
{ X86_FEATURE_APERFMPERF,	CR_ECX, 0, 0x00000006 },
{ X86_FEATURE_CPB,   		CR_EDX, 9, 0x80000007 }, 
on a 2.6.35 kernel fixes the bug on my i5-650. I guess X86_FEATURE_CPB only would be enough, but did not have the time for testing :/
Thank you alot for the hint.
Comment 43 Borislav Petkov 2010-09-19 13:12:28 UTC
From: bugzilla-daemon@bugzilla.kernel.org
Date: Sun, Sep 19, 2010 at 09:43:54AM +0000

> https://bugzilla.kernel.org/show_bug.cgi?id=16322

..

> --- Comment #42 from alexwild@gmx.de  2010-09-19 09:43:50 ---
> Hi Ritz,
> 
> removing
> { X86_FEATURE_APERFMPERF,    CR_ECX, 0, 0x00000006 },
> { X86_FEATURE_CPB,           CR_EDX, 9, 0x80000007 }, 
> on a 2.6.35 kernel fixes the bug on my i5-650. I guess X86_FEATURE_CPB only
> would be enough, but did not have the time for testing :/
> Thank you alot for the hint.

(switching to mail since bugzilla.kernel.org is kinda broken right now):

Alex,
Jonas,

can you guys both paste the error message you see. It looks like I've
mixed up APERF with CPB and so the X86_FEATURE_CPB is wrong there but
you shouldn't be seeing the warning in the bugzilla title but something
else.

Thanks.
Comment 44 Alex 2010-09-19 16:59:06 UTC
Hi Borislav,

disabling X86_FEATURE_APERFMPERF does the trick.

[    1.346334] ------------[ cut here ]------------
[    1.346397] WARNING: at /usr/src/linux-2.6.35.4/arch/x86/include/asm/processor.h:1005 read_measured_perf_ctrs+0x43/0x50()
[    1.346484] Hardware name: System Product Name
[    1.346530] Modules linked in:
[    1.346590] Pid: 422, comm: kondemand/2 Not tainted 2.6.35.4 #1
[    1.346640] Call Trace:
[    1.346685]  [<c1032c38>] ? warn_slowpath_common+0x78/0xb0
[    1.346735]  [<c1016ef3>] ? read_measured_perf_ctrs+0x43/0x50
[    1.346786]  [<c1016ef3>] ? read_measured_perf_ctrs+0x43/0x50
[    1.346804] ------------[ cut here ]------------
Comment 45 Borislav Petkov 2010-09-19 17:30:13 UTC
Created attachment 30622 [details]
Unbreak CPB CPUID feature
Comment 46 Borislav Petkov 2010-09-19 17:32:05 UTC
(In reply to comment #44)
> Hi Borislav,
> 
> disabling X86_FEATURE_APERFMPERF does the trick.

How do you do that? Do you mean you do what you do in comment
#42? Because removing the X86_FEATURE_APERFMPERF line is
not the right thing to do. Please try this patch instead:
https://bugzilla.kernel.org/attachment.cgi?id=30622.
It is against latest Linus git, let me know if you need a version
against a different kernel.

Thanks,
Boris.
Comment 47 H. Peter Anvin 2010-09-20 15:23:02 UTC
[Resending since Bugzilla seems to have spat it out]

I'm confused - I don't see CPB set in the CPUID dump that the posted, so
how could this be a misdetect of CPB?  Furthermore:

a) I'd really like to verify that there is a non-AMD CPU which uses this
bit for another purpose and
b) If that is, rather than duplicating code it would be better to add an
optional vendor ID to the scatter table.

	-hpa
Comment 48 Anonymous Emailer 2010-09-20 16:49:00 UTC
Reply-To: bp@amd64.org

From: "H. Peter Anvin" <hpa@zytor.com>
Date: Mon, Sep 20, 2010 at 11:22:08AM -0400

> [Resending since Bugzilla seems to have spat it out]

Yeah this message somehow got delayed - I just got it so this is why I
didn't know that you've asked for information.

> I'm confused - I don't see CPB set in the CPUID dump that the posted, so
> how could this be a misdetect of CPB?  Furthermore:
> 
> a) I'd really like to verify that there is a non-AMD CPU which uses this
> bit for another purpose and
> b) If that is, rather than duplicating code it would be better to add an
> optional vendor ID to the scatter table.

Here's the whole story as I see it:

1) I just thought that the CPB bit should be in AMD-only path, since
Intel's turbo boost bit is somewhere else, i.e. Function 06h, EAX[1] and
I'd rather put the AMD-one of Fn8000_0007_EDX[9] in AMD-only path. But
I'm fine with you wanting to keep it in scattered.c for brevity too.

2) Totally unrelated, obviously, the couple users on the bugzilla have
conflicting features reported over CPUID: core 0 reports, for example,
max base level for base CPUID functions as being 0x0000000b while the
remaining cores 1,2,3 report as max level 0x00000002 and therefore the
APERFMPERF check fails since boot_cpu_data's bitmasks get cleared when
AND-ing it with the capabilities of the remaining cores at the end of
identify_cpu().

For example, https://bugzilla.kernel.org/attachment.cgi?id=29642,
has aperfmperf set only on core0 but not on core1. The
initial reporter has it set on cores 0,2,3 but not on 1:
https://bugzilla.kernel.org/attachment.cgi?id=27159 One other user sent
me the debug output after applying

---
diff --git a/arch/x86/kernel/cpu/addon_cpuid_features.c b/arch/x86/kernel/cpu/addon_cpuid_features.c
index 10fa568..8037c7a 100644
--- a/arch/x86/kernel/cpu/addon_cpuid_features.c
+++ b/arch/x86/kernel/cpu/addon_cpuid_features.c
@@ -45,6 +45,9 @@ void __cpuinit init_scattered_cpuid_features(struct cpuinfo_x86 *c)

                /* Verify that the level is valid */
                max_level = cpuid_eax(cb->level & 0xffff0000);
+               pr_err("%s: cpu %d: max_level: 0x%08x for 0x%08x\n",
+                       __func__, smp_processor_id(), max_level, cb->level);
+
                if (max_level < cb->level ||
                    max_level > (cb->level | 0xffff))
                        continue;
@@ -52,6 +55,9 @@ void __cpuinit init_scattered_cpuid_features(struct cpuinfo_x86 *c)
                cpuid(cb->level, &regs[CR_EAX], &regs[CR_EBX],
                        &regs[CR_ECX], &regs[CR_EDX]);

+               pr_err("%s: cpu %d: reg: %d, value 0x%08x\n",
+                       __func__, smp_processor_id(), cb->reg, regs[cb->reg]);
+
                if (regs[cb->reg] & (1 << cb->bit))
                        set_cpu_cap(c, cb->feature);
        }
---

and very strangely, max_level is different on core0 vs the remaining ones:

[    0.000282] init_scattered_cpuid_features: cpu 0: max_level: 0x0000000b for 0x00000006
[    0.000357] init_scattered_cpuid_features: cpu 0: reg: 0, value 0x00000007
[    0.000410] init_scattered_cpuid_features: cpu 0: max_level: 0x0000000b for 0x00000006
[    0.000484] init_scattered_cpuid_features: cpu 0: reg: 0, value 0x00000007
[    0.000537] init_scattered_cpuid_features: cpu 0: max_level: 0x0000000b for 0x00000006
[    0.000612] init_scattered_cpuid_features: cpu 0: reg: 1, value 0x00000001
[    0.000666] init_scattered_cpuid_features: cpu 0: max_level: 0x80000008 for 0x80000007
[    0.000740] init_scattered_cpuid_features: cpu 0: reg: 2, value 0x00000100
[    0.000794] init_scattered_cpuid_features: cpu 0: max_level: 0x80000008 for 0x8000000a
[    0.000868] init_scattered_cpuid_features: cpu 0: max_level: 0x80000008 for 0x8000000a
[    0.000942] init_scattered_cpuid_features: cpu 0: max_level: 0x80000008 for 0x8000000a
[    0.001016] init_scattered_cpuid_features: cpu 0: max_level: 0x80000008 for 0x8000000a

...

[    0.051000] CPU0: Intel(R) Core(TM) i5 CPU         650  @ 3.20GHz stepping 02
[    0.157410] Booting Node   0, Processors  #1
[    0.167758] Initializing CPU#1
[    0.245379] init_scattered_cpuid_features: cpu 1: max_level: 0x00000002 for 0x00000006
[    0.245380] init_scattered_cpuid_features: cpu 1: max_level: 0x00000002 for 0x00000006
[    0.245382] init_scattered_cpuid_features: cpu 1: max_level: 0x00000002 for 0x00000006
[    0.245384] init_scattered_cpuid_features: cpu 1: max_level: 0x80000008 for 0x80000007
[    0.245385] init_scattered_cpuid_features: cpu 1: reg: 2, value 0x00000100
[    0.245387] init_scattered_cpuid_features: cpu 1: max_level: 0x80000008 for 0x8000000a
[    0.245388] init_scattered_cpuid_features: cpu 1: max_level: 0x80000008 for 0x8000000a
[    0.245390] init_scattered_cpuid_features: cpu 1: max_level: 0x80000008 for 0x8000000a
[    0.245391] init_scattered_cpuid_features: cpu 1: max_level: 0x80000008 for 0x8000000a
[    0.265526]  #2
[    0.276404] Initializing CPU#2
[    0.353381] init_scattered_cpuid_features: cpu 2: max_level: 0x00000002 for 0x00000006
[    0.353382] init_scattered_cpuid_features: cpu 2: max_level: 0x00000002 for 0x00000006
[    0.353384] init_scattered_cpuid_features: cpu 2: max_level: 0x00000002 for 0x00000006
[    0.353385] init_scattered_cpuid_features: cpu 2: max_level: 0x80000008 for 0x80000007
[    0.353387] init_scattered_cpuid_features: cpu 2: reg: 2, value 0x00000100
[    0.353389] init_scattered_cpuid_features: cpu 2: max_level: 0x80000008 for 0x8000000a
[    0.353390] init_scattered_cpuid_features: cpu 2: max_level: 0x80000008 for 0x8000000a
[    0.353392] init_scattered_cpuid_features: cpu 2: max_level: 0x80000008 for 0x8000000a
[    0.353394] init_scattered_cpuid_features: cpu 2: max_level: 0x80000008 for 0x8000000a
...

so it doesn't look like some kind of software issue but like
inconsistent values between core0 and the remaining cores.

Hmmm...
Comment 49 H. Peter Anvin 2010-09-20 21:09:03 UTC
On 09/20/2010 08:55 AM, Borislav Petkov wrote:
> 
> Yeah this message somehow got delayed - I just got it so this is why I
> didn't know that you've asked for information.
> 
>> I'm confused - I don't see CPB set in the CPUID dump that the posted, so
>> how could this be a misdetect of CPB?  Furthermore:
>>
>> a) I'd really like to verify that there is a non-AMD CPU which uses this
>> bit for another purpose and
>> b) If that is, rather than duplicating code it would be better to add an
>> optional vendor ID to the scatter table.
> 
> Here's the whole story as I see it:
> 
> 1) I just thought that the CPB bit should be in AMD-only path, since
> Intel's turbo boost bit is somewhere else, i.e. Function 06h, EAX[1] and
> I'd rather put the AMD-one of Fn8000_0007_EDX[9] in AMD-only path. But
> I'm fine with you wanting to keep it in scattered.c for brevity too.
> 

I'd rather leave it scattered.c; if we have to put a vendor ID into the
table on it I'd be fine with that, but I'd prefer to only do so as
necessary.

> 2) Totally unrelated, obviously, the couple users on the bugzilla have
> conflicting features reported over CPUID: core 0 reports, for example,
> max base level for base CPUID functions as being 0x0000000b while the
> remaining cores 1,2,3 report as max level 0x00000002 and therefore the
> APERFMPERF check fails since boot_cpu_data's bitmasks get cleared when
> AND-ing it with the capabilities of the remaining cores at the end of
> identify_cpu().

Which is correct in the sense that only some CPUs report the features.
However, I would have thought the feature-enabling code should have
taken care of that.  I'll have to look into why that doesn't happen.

> 
> so it doesn't look like some kind of software issue but like
> inconsistent values between core0 and the remaining cores.
> 

Right.

	-hpa
Comment 50 H. Peter Anvin 2010-09-20 21:17:23 UTC
It looks like all the affected systems are Atom N270?
Comment 51 H. Peter Anvin 2010-09-20 21:18:35 UTC
Created attachment 30842 [details]
Test patch; should fix Atom N270 at least

Could someone who can reproduce this problem test this patch, please?
Comment 52 Conrad Kostecki 2010-09-20 21:51:30 UTC
(In reply to comment #51)
> Created an attachment (id=30842) [details]
> Test patch; should fix Atom N270 at least
> 
> Could someone who can reproduce this problem test this patch, please?

Did not fix the problem on my N270.
Comment 53 H. Peter Anvin 2010-09-20 21:54:54 UTC
Could you include a dmidecode of your system, please?
Comment 54 Conrad Kostecki 2010-09-20 21:57:27 UTC
Created attachment 30852 [details]
dmidecode output

(In reply to comment #53)
> Could you include a dmidecode of your system, please?

Sure :)
Comment 55 H. Peter Anvin 2010-09-20 23:09:08 UTC
OK, what machine is that?  The dmidecode fields are empty...
Comment 56 H. Peter Anvin 2010-09-20 23:13:09 UTC
OK, one more question:

Could you install the "msr-tools" package and then run the following commands:

rdmsr -cx -p 0 0x1a0
rdmsr -cx -p 1 0x1a0

Thanks!
Comment 57 boris64 2010-09-21 00:54:31 UTC
(In reply to comment #50)
> It looks like all the affected systems are Atom N270?

Nope, this is a Core2Quad (Q9300).
Comment 58 H. Peter Anvin 2010-09-21 00:55:37 UTC
OK, could you try the same experiment (but with -p 0 ... -p 3)?
Comment 59 H. Peter Anvin 2010-09-21 01:06:16 UTC
Geez, this bug is getting to be old enough that I just wrote up a patch that I had already done.

Are you *sure* that https://bugzilla.kernel.org/attachment.cgi?id=27137 above didn't fix the problem?
Comment 60 boris64 2010-09-21 01:09:29 UTC
rdmsr -cx -p 0 0x1a0
0x4062972489

rdmsr -cx -p 1 0x1a0
0x4062972489

rdmsr -cx -p 2 0x1a0
0x4062972489

rdmsr -cx -p 3 0x1a0
0x4062972489
Comment 61 boris64 2010-09-21 01:22:54 UTC
(In reply to comment #59)
> Geez, this bug is getting to be old enough that I just wrote up a patch that
> I
> had already done.
> 
> Are you *sure* that https://bugzilla.kernel.org/attachment.cgi?id=27137 above
> didn't fix the problem?

I really feel sorry somehow, but it didn't fix the warning. Additionally core #1
misses flag "arch_perfmon" (dunno what's that good for but it's gone). I just
recompiled my new kernel-2.6.35.5 with the patch from https://bugzilla.kernel.org/attachment.cgi?id=27137
again to be sure.
Comment 62 Conrad Kostecki 2010-09-21 07:41:28 UTC
(In reply to comment #55)
> OK, what machine is that?  The dmidecode fields are empty...

This is an "Flepo Delta". An Atom MiniPC. See: http://www.flepo.de/minipc-delta.html (There seems no english site to be available)

(In reply to comment #56)
> OK, one more question:
> 
> Could you install the "msr-tools" package and then run the following
> commands:
> 
> rdmsr -cx -p 0 0x1a0
> rdmsr -cx -p 1 0x1a0
> 
> Thanks!

Ok, here are the results:
Galactica msr-tools-1.2 # ./rdmsr -cx -p 0 0x1a0
0x62972489
Galactica msr-tools-1.2 # ./rdmsr -cx -p 1 0x1a0
0x62972489

(In reply to comment #59)
> Geez, this bug is getting to be old enough that I just wrote up a patch that
> I
> had already done.
> 
> Are you *sure* that https://bugzilla.kernel.org/attachment.cgi?id=27137 above
> didn't fix the problem?

Well, I just now recompiled my kernel again with this patch applied. And the error still accours.
Comment 63 Conrad Kostecki 2010-09-21 07:46:27 UTC
In /proc/cpuinfo, core1 (ht) is now missing: arch_perfmon aperfmperf monitor
Comment 64 Ritz 2010-09-21 14:22:00 UTC
tried rdmsr -cx p 0 0x1a0 and rdmsr -cx p 1 0x1a0

on the following kernels

2.6.35-22 (standard ubuntu kernel)
2.6.34-7 from mainline ubuntu 
2.6.36rc4 from mainline ubuntu

output of rdmsr is the same on all 3 kernels, but there is no warning with the .34 kernel 

output is 0x364972488
Comment 65 H. Peter Anvin 2010-09-21 15:37:46 UTC
But /proc/cpuinfo is different on all of the kernels?
Comment 66 Ritz 2010-09-21 16:21:18 UTC
cilie@cilie-laptop:~$ uname -a
Linux cilie-laptop 2.6.34-02063407-generic #201009140905 SMP Tue Sep 14 10:10:14 UTC 2010 i686 GNU/Linux

cilie@cilie-laptop:~$ sudo rdmsr -cx -p 0 0x1a0
0x364972488

/proc/cpuinfo
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 28
model name	: Intel(R) Atom(TM) CPU N270   @ 1.60GHz
stepping	: 2
cpu MHz		: 1067.000
cache size	: 512 KB
physical id	: 0
siblings	: 2
core id		: 0
cpu cores	: 1
apicid		: 0
initial apicid	: 0
fdiv_bug	: no
hlt_bug		: no
f00f_bug	: no
coma_bug	: no
fpu		: yes
fpu_exception	: yes
cpuid level	: 10
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx constant_tsc arch_perfmon pebs bts aperfmperf pni dtes64 monitor ds_cpl est tm2 ssse3 xtpr pdcm movbe lahf_lm
bogomips	: 3192.30
clflush size	: 64
cache_alignment	: 64
address sizes	: 32 bits physical, 32 bits virtual
power management:

processor	: 1
vendor_id	: GenuineIntel
cpu family	: 6
model		: 28
model name	: Intel(R) Atom(TM) CPU N270   @ 1.60GHz
stepping	: 2
cpu MHz		: 1600.000
cache size	: 512 KB
physical id	: 0
siblings	: 2
core id		: 0
cpu cores	: 1
apicid		: 1
initial apicid	: 1
fdiv_bug	: no
hlt_bug		: no
f00f_bug	: no
coma_bug	: no
fpu		: yes
fpu_exception	: yes
cpuid level	: 10
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx constant_tsc arch_perfmon pebs bts aperfmperf pni dtes64 monitor ds_cpl est tm2 ssse3 xtpr pdcm movbe lahf_lm
bogomips	: 3191.94
clflush size	: 64
cache_alignment	: 64
address sizes	: 32 bits physical, 32 bits virtual
power management:
Comment 67 Ritz 2010-09-21 16:35:46 UTC
cilie@cilie-laptop:~$ uname -a
Linux cilie-laptop 2.6.36-020636rc4-generic #201009130905 SMP Mon Sep 13 10:15:27 UTC 2010 i686 GNU/Linux
cilie@cilie-laptop:~$ sudo modprobe msr
[sudo] password for cilie: 
cilie@cilie-laptop:~$ sudo rdmsr -cx -p 0 0x1a0
0x364972488

cilie@cilie-laptop:~$ dmesg |grep WARNING
[   85.676247] WARNING: at /home/kernel-ppa/COD/linux/arch/x86/include/asm/processor.h:1006 read_measured_perf_ctrs+0x6e/0x80()


/proc/cpuinfo
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 28
model name	: Intel(R) Atom(TM) CPU N270   @ 1.60GHz
stepping	: 2
cpu MHz		: 1600.000
cache size	: 512 KB
physical id	: 0
siblings	: 2
core id		: 0
cpu cores	: 1
apicid		: 0
initial apicid	: 0
fdiv_bug	: no
hlt_bug		: no
f00f_bug	: no
coma_bug	: no
fpu		: yes
fpu_exception	: yes
cpuid level	: 10
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx constant_tsc arch_perfmon pebs bts aperfmperf pni dtes64 monitor ds_cpl est tm2 ssse3 xtpr pdcm movbe lahf_lm
bogomips	: 3192.11
clflush size	: 64
cache_alignment	: 64
address sizes	: 32 bits physical, 32 bits virtual
power management:

processor	: 1
vendor_id	: GenuineIntel
cpu family	: 6
model		: 28
model name	: Intel(R) Atom(TM) CPU N270   @ 1.60GHz
stepping	: 2
cpu MHz		: 1067.000
cache size	: 512 KB
physical id	: 0
siblings	: 2
core id		: 0
cpu cores	: 1
apicid		: 1
initial apicid	: 1
fdiv_bug	: no
hlt_bug		: no
f00f_bug	: no
coma_bug	: no
fpu		: yes
fpu_exception	: yes
cpuid level	: 10
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx constant_tsc arch_perfmon pebs bts pni dtes64 monitor ds_cpl est tm2 ssse3 xtpr pdcm movbe lahf_lm
bogomips	: 3192.03
clflush size	: 64
cache_alignment	: 64
address sizes	: 32 bits physical, 32 bits virtual
power management:
Comment 68 Ritz 2010-09-21 16:42:59 UTC
cilie@cilie-laptop:~$ uname -a
Linux cilie-laptop 2.6.35-22-generic #33-Ubuntu SMP Sun Sep 19 20:34:50 UTC 2010 i686 GNU/Linux
cilie@cilie-laptop:~$ sudo modprobe msr
[sudo] password for cilie: 
cilie@cilie-laptop:~$ sudo rdmsr -cx -p 0 0x1a0
0x364972488
cilie@cilie-laptop:~$ dmesg |grep WARNING
[   97.305065] WARNING: at /build/buildd/linux-2.6.35/arch/x86/include/asm/processor.h:1005 read_measured_perf_ctrs+0x6c/0x80()

/proc/cpuinfo
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 28
model name	: Intel(R) Atom(TM) CPU N270   @ 1.60GHz
stepping	: 2
cpu MHz		: 1067.000
cache size	: 512 KB
physical id	: 0
siblings	: 2
core id		: 0
cpu cores	: 1
apicid		: 0
initial apicid	: 0
fdiv_bug	: no
hlt_bug		: no
f00f_bug	: no
coma_bug	: no
fpu		: yes
fpu_exception	: yes
cpuid level	: 10
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx constant_tsc arch_perfmon pebs bts aperfmperf pni dtes64 monitor ds_cpl est tm2 ssse3 xtpr pdcm movbe lahf_lm
bogomips	: 3191.88
clflush size	: 64
cache_alignment	: 64
address sizes	: 32 bits physical, 32 bits virtual
power management:

processor	: 1
vendor_id	: GenuineIntel
cpu family	: 6
model		: 28
model name	: Intel(R) Atom(TM) CPU N270   @ 1.60GHz
stepping	: 2
cpu MHz		: 1600.000
cache size	: 512 KB
physical id	: 0
siblings	: 2
core id		: 0
cpu cores	: 1
apicid		: 1
initial apicid	: 1
fdiv_bug	: no
hlt_bug		: no
f00f_bug	: no
coma_bug	: no
fpu		: yes
fpu_exception	: yes
cpuid level	: 10
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx constant_tsc arch_perfmon pebs bts pni dtes64 monitor ds_cpl est tm2 ssse3 xtpr pdcm movbe lahf_lm
bogomips	: 3191.94
clflush size	: 64
cache_alignment	: 64
address sizes	: 32 bits physical, 32 bits virtual
power management:
Comment 69 Ritz 2010-09-21 18:48:38 UTC
Maybee this is way older than we think....(some flags are missing on the .31 kernel as well)

This is a standard updated Ubuntu 9.04 running on a eeePC 1000H.

klaphat@eee:~$ uname -a
Linux eee 2.6.31-22-generic #65-Ubuntu SMP Thu Sep 16 15:48:58 UTC 2010 i686 GNU/Linux
klaphat@eee:~$ sudo rdmsr -cx -p 1 0x1a0
0x364972488
klaphat@eee:~$ dmesg |grep WARNING
klaphat@eee:~$ dmesg |grep Error
[  140.709191] ACPI Error (psparse-0537): Method parse/execution failed [\_SB_.PCI0.SBRG.EC0_.BST1] (Node f7012dc8), AE_TIME
[  140.709299] ACPI Error (psparse-0537): Method parse/execution failed [\_SB_.PCI0.CBST] (Node f70156f0), AE_TIME
[  140.709385] ACPI Error (psparse-0537): Method parse/execution failed [\_SB_.PCI0.BAT0._BST] (Node f7015630), AE_TIME
klaphat@eee:~$ dmesg |grep Exception
[  140.709141] ACPI Exception: AE_TIME, Returned by Handler for [EmbeddedControl] 20090521 evregion-424
[  140.709483] ACPI Exception: AE_TIME, Evaluating _BST 20090521 battery-385
klaphat@eee:~$ 

/proc/cpuinfo
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 28
model name	: Intel(R) Atom(TM) CPU N270   @ 1.60GHz
stepping	: 2
cpu MHz		: 800.000
cache size	: 512 KB
physical id	: 0
siblings	: 2
core id		: 0
cpu cores	: 1
apicid		: 0
initial apicid	: 0
fdiv_bug	: no
hlt_bug		: no
f00f_bug	: no
coma_bug	: no
fpu		: yes
fpu_exception	: yes
cpuid level	: 10
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx constant_tsc arch_perfmon pebs bts pni dtes64 monitor ds_cpl est tm2 ssse3 xtpr pdcm movbe lahf_lm
bogomips	: 3191.92
clflush size	: 64
power management:

processor	: 1
vendor_id	: GenuineIntel
cpu family	: 6
model		: 28
model name	: Intel(R) Atom(TM) CPU N270   @ 1.60GHz
stepping	: 2
cpu MHz		: 1600.000
cache size	: 512 KB
physical id	: 0
siblings	: 2
core id		: 0
cpu cores	: 1
apicid		: 1
initial apicid	: 1
fdiv_bug	: no
hlt_bug		: no
f00f_bug	: no
coma_bug	: no
fpu		: yes
fpu_exception	: yes
cpuid level	: 10
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx constant_tsc arch_perfmon pebs bts pni dtes64 monitor ds_cpl est tm2 ssse3 xtpr pdcm movbe lahf_lm
bogomips	: 3191.93
clflush size	: 64
power management:
Comment 70 H. Peter Anvin 2010-09-23 23:10:05 UTC
That's actually quite likely; the reason it's failing now is because something is using it.  I'm going to attach a CPUID dumping program; I would greatly appreciate it if all the reporters for this bug could run it on each processor (the processor number is an argument, e.g.):

   ./cpuid 0

Thanks,

   -hpa
Comment 71 H. Peter Anvin 2010-09-23 23:33:46 UTC
Created attachment 31132 [details]
CPUID dumping program (C source)
Comment 72 Conrad Kostecki 2010-09-24 07:02:16 UTC
Created attachment 31252 [details]
CPUID strace output

Galactica ~ # ./cpuid 0
Leaf     Subleaf    EAX            EBX            ECX            EDX            
Segmentation fault
Galactica ~ # ./cpuid 1
Leaf     Subleaf    EAX            EBX            ECX            EDX            
Segmentation fault

:( Does not work. Attaching strace output
Comment 73 Ritz 2010-09-24 09:01:14 UTC
cilie@cilie-laptop:~/Documents$ uname -a
Linux cilie-laptop 2.6.35-22-generic #33-Ubuntu SMP Sun Sep 19 20:34:50 UTC 2010 i686 GNU/Linux
cilie@cilie-laptop:~/Documents$ cpuid -cpuid0
 eax in    eax      ebx      ecx      edx
00000000 0000000a 756e6547 6c65746e 49656e69
00000001 000106c2 00020800 0040c39d bfe9fbff
00000002 4fba5901 0e3080c0 00000000 00000000
00000003 00000000 00000000 00000000 00000000
00000004 00000000 00000000 00000000 00000000
00000005 00000040 00000040 00000003 00020220
00000006 00000001 00000002 00000001 00000000
00000007 00000000 00000000 00000000 00000000
00000008 00000000 00000000 00000000 00000000
00000009 00000000 00000000 00000000 00000000
0000000a 07280203 00000000 00000000 00002501
80000000 80000008 00000000 00000000 00000000
80000001 00000000 00000000 00000001 00100000
80000002 20202020 20202020 746e4920 52286c65
80000003 74412029 54286d6f 4320294d 4e205550
80000004 20303732 20402020 30362e31 007a4847
80000005 00000000 00000000 00000000 00000000
80000006 00000000 00000000 02008040 00000000
80000007 00000000 00000000 00000000 00000000
80000008 00002020 00000000 00000000 00000000

Vendor ID: "GenuineIntel"; CPUID level 10

Intel-specific functions:
Version 000106c2:
Type 0 - Original OEM
Family 6 - Pentium Pro
Model 12 - 
Stepping 2
Reserved 4

Extended brand string: "         Intel(R) Atom(TM) CPU N270   @ 1.60GHz"
CLFLUSH instruction cache line size: 8
Hyper threading siblings: 2

Feature flags bfe9fbff:
FPU    Floating Point Unit
VME    Virtual 8086 Mode Enhancements
DE     Debugging Extensions
PSE    Page Size Extensions
TSC    Time Stamp Counter
MSR    Model Specific Registers
PAE    Physical Address Extension
MCE    Machine Check Exception
CX8    COMPXCHG8B Instruction
APIC   On-chip Advanced Programmable Interrupt Controller present and enabled
SEP    Fast System Call
MTRR   Memory Type Range Registers
PGE    PTE Global Flag
MCA    Machine Check Architecture
CMOV   Conditional Move and Compare Instructions
FGPAT  Page Attribute Table
CLFSH  CFLUSH instruction
DS     Debug store
ACPI   Thermal Monitor and Clock Ctrl
MMX    MMX instruction set
FXSR   Fast FP/MMX Streaming SIMD Extensions save/restore
SSE    Streaming SIMD Extensions instruction set
SSE2   SSE2 extensions
SS     Self Snoop
HT     Hyper Threading
TM     Thermal monitor
31     reserved

TLB and cache info:
59: unknown TLB/cache descriptor
ba: unknown TLB/cache descriptor
4f: unknown TLB/cache descriptor
c0: unknown TLB/cache descriptor
80: unknown TLB/cache descriptor
30: unknown TLB/cache descriptor
0e: unknown TLB/cache descriptor
Processor serial: 0001-06C2-0000-0000-0000-0000
cilie@cilie-laptop:~/Documents$ cpuid -cpuid1
 eax in    eax      ebx      ecx      edx
00000000 0000000a 756e6547 6c65746e 49656e69
00000001 000106c2 01020800 0040c39d bfe9fbff
00000002 4fba5901 0e3080c0 00000000 00000000
00000003 00000000 00000000 00000000 00000000
00000004 00000000 00000000 00000000 00000000
00000005 00000040 00000040 00000003 00020220
00000006 00000001 00000002 00000001 00000000
00000007 00000000 00000000 00000000 00000000
00000008 00000000 00000000 00000000 00000000
00000009 00000000 00000000 00000000 00000000
0000000a 07280203 00000000 00000000 00002501
80000000 80000008 00000000 00000000 00000000
80000001 00000000 00000000 00000001 00100000
80000002 20202020 20202020 746e4920 52286c65
80000003 74412029 54286d6f 4320294d 4e205550
80000004 20303732 20402020 30362e31 007a4847
80000005 00000000 00000000 00000000 00000000
80000006 00000000 00000000 02008040 00000000
80000007 00000000 00000000 00000000 00000000
80000008 00002020 00000000 00000000 00000000

Vendor ID: "GenuineIntel"; CPUID level 10

Intel-specific functions:
Version 000106c2:
Type 0 - Original OEM
Family 6 - Pentium Pro
Model 12 - 
Stepping 2
Reserved 4

Extended brand string: "         Intel(R) Atom(TM) CPU N270   @ 1.60GHz"
CLFLUSH instruction cache line size: 8
Initial APIC ID: 1
Hyper threading siblings: 2

Feature flags bfe9fbff:
FPU    Floating Point Unit
VME    Virtual 8086 Mode Enhancements
DE     Debugging Extensions
PSE    Page Size Extensions
TSC    Time Stamp Counter
MSR    Model Specific Registers
PAE    Physical Address Extension
MCE    Machine Check Exception
CX8    COMPXCHG8B Instruction
APIC   On-chip Advanced Programmable Interrupt Controller present and enabled
SEP    Fast System Call
MTRR   Memory Type Range Registers
PGE    PTE Global Flag
MCA    Machine Check Architecture
CMOV   Conditional Move and Compare Instructions
FGPAT  Page Attribute Table
CLFSH  CFLUSH instruction
DS     Debug store
ACPI   Thermal Monitor and Clock Ctrl
MMX    MMX instruction set
FXSR   Fast FP/MMX Streaming SIMD Extensions save/restore
SSE    Streaming SIMD Extensions instruction set
SSE2   SSE2 extensions
SS     Self Snoop
HT     Hyper Threading
TM     Thermal monitor
31     reserved

TLB and cache info:
59: unknown TLB/cache descriptor
ba: unknown TLB/cache descriptor
4f: unknown TLB/cache descriptor
c0: unknown TLB/cache descriptor
80: unknown TLB/cache descriptor
30: unknown TLB/cache descriptor
0e: unknown TLB/cache descriptor
Processor serial: 0001-06C2-0000-0000-0000-0000
Comment 74 boris64 2010-09-24 09:43:23 UTC
I'm not getting any data at all. Could something
be missing in my custom kernel? What am i doing wrong?

boris64 tmp # for i in 0 1 2 3; do ./cpuid $i; done
Leaf     Subleaf    EAX            EBX            ECX            EDX            
Leaf     Subleaf    EAX            EBX            ECX            EDX            
Leaf     Subleaf    EAX            EBX            ECX            EDX            
Leaf     Subleaf    EAX            EBX            ECX            EDX            
boris64 tmp #
Comment 75 Alex 2010-09-24 14:42:08 UTC
Program does not work as it should :(

Leaf     Subleaf    EAX            EBX            ECX            EDX
00000000 00000000:  0000000b ....  756e6547 Genu  6c65746e ntel  49656e69 ineI
00000001 00000000:  00020652 R...  04100800 ....  0298e3ff ....  bfebfbff ....
00000002 00000000:  55035a01 .Z.U  00f0b2e3 ....  00000000 ....  09ca212c ,!..
00000003 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
00000004 00000000:  1c004121 !A..  01c0003f ?...  0000003f ?...  00000000 ....
00000004 00000001:  1c004121 !A..  01c0003f ?...  0000003f ?...  00000000 ....

after this Subleaf increases infinitely, rest same output as last 2 lines.
Comment 76 H. Peter Anvin 2010-09-24 20:51:25 UTC
boris64: looks like your missing the CPUID driver in the kernel.

Alex: will look at.
Comment 77 H. Peter Anvin 2010-09-24 21:00:42 UTC
Created attachment 31432 [details]
Updated CPUID-dumping program
Comment 78 H. Peter Anvin 2010-09-24 21:01:34 UTC
boris64: try doing "modprobe cpuid" if you have it as a module.  Otherwise you need to enable CONFIG_X86_CPUID in your kernel compile.
Comment 79 boris64 2010-09-24 23:02:04 UTC
Hm, that's strange, i _have_ CONFIG_X86_CPUID=y in my config.
I also have these cpuid-files in /dev/cpu/%d/ that 
your dumping program seems to look at.

Well, whatever, perhaps i'll try a newer live-cd 
of ubuntu or something like that tomorrow.
Comment 80 H. Peter Anvin 2010-09-24 23:03:15 UTC
No idea then...
Comment 81 boris64 2010-09-24 23:39:32 UTC
I just tried an ubuntu cd (v10.10pre, kernel-2.6.35-19(?))
with the very same result. No data from ./cpuid 0/1/2/3.
(Yep, i did a 'modprobe cpuid' first).
Comment 82 H. Peter Anvin 2010-09-24 23:40:44 UTC
What does strace show?
Comment 83 boris64 2010-09-24 23:46:26 UTC
[strace output]
execve("./cpuid", ["./cpuid", "0"], [/* 43 vars */]) = 0
brk(0)                                  = 0x673000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f44365b2000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=193011, ...}) = 0
mmap(NULL, 193011, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f4436582000
close(3)                                = 0
open("/lib/libc.so.6", O_RDONLY)        = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360\355\341z6\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1483104, ...}) = 0
mmap(0x367ae00000, 3586888, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x367ae00000
mprotect(0x367af62000, 2097152, PROT_NONE) = 0
mmap(0x367b162000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x162000) = 0x367b162000
mmap(0x367b167000, 19272, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x367b167000
close(3)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f4436581000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f4436580000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f443657f000
arch_prctl(ARCH_SET_FS, 0x7f4436580700) = 0
mprotect(0x367b162000, 16384, PROT_READ) = 0
mprotect(0x601000, 4096, PROT_READ)     = 0
mprotect(0x367ac1e000, 4096, PROT_READ) = 0
munmap(0x7f4436582000, 193011)          = 0
fstat(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 9), ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f44365b1000
write(1, "Leaf     Subleaf    EAX         "..., 81) = 81
open("/dev/cpu/0/cpuid", O_RDONLY)      = 3
pread(3, "\n\0\0\0GenuntelineI", 16, 0) = 16
pread(3, "\2\2(\7\0\0\0\0\0\0\0\0\3\5\0\0", 16, 65536) = 16
pread(3, "\2\2(\7\0\0\0\0\0\0\0\0\3\5\0\0", 16, 131072) = 16
pread(3, "\2\2(\7\0\0\0\0\0\0\0\0\3\5\0\0", 16, 196608) = 16
pread(3, "\2\2(\7\0\0\0\0\0\0\0\0\3\5\0\0", 16, 262144) = 16
pread(3, "\2\2(\7\0\0\0\0\0\0\0\0\3\5\0\0", 16, 327680) = 16
pread(3, "\2\2(\7\0\0\0\0\0\0\0\0\3\5\0\0", 16, 393216) = 16

... <cut> ...

pread(3, "\2\2(\7\0\0\0\0\0\0\0\0\3\5\0\0", 16, 4294705152) = 16
pread(3, "\2\2(\7\0\0\0\0\0\0\0\0\3\5\0\0", 16, 4294770688) = 16
pread(3, "\2\2(\7\0\0\0\0\0\0\0\0\3\5\0\0", 16, 4294836224) = 16
pread(3, "\2\2(\7\0\0\0\0\0\0\0\0\3\5\0\0", 16, 4294901760) = 16
exit_group(0)                           = ?
[/strace output]
Comment 84 H. Peter Anvin 2010-09-25 00:07:34 UTC
Created attachment 31452 [details]
Fixed CPUID program (v3)

OK, stupid error on my part trying to fix another problem.  Forgot to turn warnings on, that's why I didn't catch it in the first place.
Comment 85 boris64 2010-09-25 00:12:30 UTC
Ok, this one (v3) looks definitly better ;)

[cpuid output]
cpuid 0:
Leaf     Subleaf    EAX            EBX            ECX            EDX            
00000000 00000000:  0000000a ....  756e6547 Genu  6c65746e ntel  49656e69 ineI
00000001 00000000:  00010677 w...  00040800 ....  0008e3fd ....  bfebfbff ....
00000002 00000000:  05b0b101 ....  005657f0 .WV.  00000000 ....  2cb43048 H0.,
00000003 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
00000004 00000000:  0c000121 !...  01c0003f ?...  0000003f ?...  00000001 ....
00000004 00000001:  0c000122 "...  01c0003f ?...  0000003f ?...  00000001 ....
00000004 00000002:  0c004143 CA..  02c0003f ?...  00000fff ....  00000001 ....
00000005 00000000:  00000040 @...  00000040 @...  00000003 ....  00000020  ...
00000006 00000000:  00000001 ....  00000002 ....  00000001 ....  00000000 ....
00000007 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
00000008 00000000:  00000400 ....  00000000 ....  00000000 ....  00000000 ....
00000009 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
0000000a 00000000:  07280202 ..(.  00000000 ....  00000000 ....  00000503 ....
80000000 00000000:  80000008 ....  00000000 ....  00000000 ....  00000000 ....
80000001 00000000:  00000000 ....  00000000 ....  00000001 ....  20100800 ... 
80000002 00000000:  65746e49 Inte  2952286c l(R)  726f4320  Cor  4d542865 e(TM
80000003 00000000:  51203229 )2 Q  20646175 uad   55504320  CPU  51202020    Q
80000004 00000000:  30303339 9300  20402020   @   30352e32 2.50  007a4847 GHz.
80000005 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
80000006 00000000:  00000000 ....  00000000 ....  0c006040 @`..  00000000 ....
80000007 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
80000008 00000000:  00003024 $0..  00000000 ....  00000000 ....  00000000 ....

cpuid 1:
Leaf     Subleaf    EAX            EBX            ECX            EDX            
00000000 00000000:  0000000a ....  756e6547 Genu  6c65746e ntel  49656e69 ineI
00000001 00000000:  00010677 w...  02040800 ....  0008e3fd ....  bfebfbff ....
00000002 00000000:  05b0b101 ....  005657f0 .WV.  00000000 ....  2cb43048 H0.,
00000003 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
00000004 00000000:  0c000121 !...  01c0003f ?...  0000003f ?...  00000001 ....
00000004 00000001:  0c000122 "...  01c0003f ?...  0000003f ?...  00000001 ....
00000004 00000002:  0c004143 CA..  02c0003f ?...  00000fff ....  00000001 ....
00000005 00000000:  00000040 @...  00000040 @...  00000003 ....  00000020  ...
00000006 00000000:  00000001 ....  00000002 ....  00000001 ....  00000000 ....
00000007 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
00000008 00000000:  00000400 ....  00000000 ....  00000000 ....  00000000 ....
00000009 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
0000000a 00000000:  07280202 ..(.  00000000 ....  00000000 ....  00000503 ....
80000000 00000000:  80000008 ....  00000000 ....  00000000 ....  00000000 ....
80000001 00000000:  00000000 ....  00000000 ....  00000001 ....  20100800 ... 
80000002 00000000:  65746e49 Inte  2952286c l(R)  726f4320  Cor  4d542865 e(TM
80000003 00000000:  51203229 )2 Q  20646175 uad   55504320  CPU  51202020    Q
80000004 00000000:  30303339 9300  20402020   @   30352e32 2.50  007a4847 GHz.
80000005 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
80000006 00000000:  00000000 ....  00000000 ....  0c006040 @`..  00000000 ....
80000007 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
80000008 00000000:  00003024 $0..  00000000 ....  00000000 ....  00000000 ....

cpuid 2:
Leaf     Subleaf    EAX            EBX            ECX            EDX            
00000000 00000000:  0000000a ....  756e6547 Genu  6c65746e ntel  49656e69 ineI
00000001 00000000:  00010677 w...  01040800 ....  0008e3fd ....  bfebfbff ....
00000002 00000000:  05b0b101 ....  005657f0 .WV.  00000000 ....  2cb43048 H0.,
00000003 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
00000004 00000000:  0c000121 !...  01c0003f ?...  0000003f ?...  00000001 ....
00000004 00000001:  0c000122 "...  01c0003f ?...  0000003f ?...  00000001 ....
00000004 00000002:  0c004143 CA..  02c0003f ?...  00000fff ....  00000001 ....
00000005 00000000:  00000040 @...  00000040 @...  00000003 ....  00000020  ...
00000006 00000000:  00000001 ....  00000002 ....  00000001 ....  00000000 ....
00000007 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
00000008 00000000:  00000400 ....  00000000 ....  00000000 ....  00000000 ....
00000009 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
0000000a 00000000:  07280202 ..(.  00000000 ....  00000000 ....  00000503 ....
80000000 00000000:  80000008 ....  00000000 ....  00000000 ....  00000000 ....
80000001 00000000:  00000000 ....  00000000 ....  00000001 ....  20100800 ... 
80000002 00000000:  65746e49 Inte  2952286c l(R)  726f4320  Cor  4d542865 e(TM
80000003 00000000:  51203229 )2 Q  20646175 uad   55504320  CPU  51202020    Q
80000004 00000000:  30303339 9300  20402020   @   30352e32 2.50  007a4847 GHz.
80000005 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
80000006 00000000:  00000000 ....  00000000 ....  0c006040 @`..  00000000 ....
80000007 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
80000008 00000000:  00003024 $0..  00000000 ....  00000000 ....  00000000 ....

cpuid 3:
Leaf     Subleaf    EAX            EBX            ECX            EDX            
00000000 00000000:  0000000a ....  756e6547 Genu  6c65746e ntel  49656e69 ineI
00000001 00000000:  00010677 w...  03040800 ....  0008e3fd ....  bfebfbff ....
00000002 00000000:  05b0b101 ....  005657f0 .WV.  00000000 ....  2cb43048 H0.,
00000003 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
00000004 00000000:  0c000121 !...  01c0003f ?...  0000003f ?...  00000001 ....
00000004 00000001:  0c000122 "...  01c0003f ?...  0000003f ?...  00000001 ....
00000004 00000002:  0c004143 CA..  02c0003f ?...  00000fff ....  00000001 ....
00000005 00000000:  00000040 @...  00000040 @...  00000003 ....  00000020  ...
00000006 00000000:  00000001 ....  00000002 ....  00000001 ....  00000000 ....
00000007 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
00000008 00000000:  00000400 ....  00000000 ....  00000000 ....  00000000 ....
00000009 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
0000000a 00000000:  07280202 ..(.  00000000 ....  00000000 ....  00000503 ....
80000000 00000000:  80000008 ....  00000000 ....  00000000 ....  00000000 ....
80000001 00000000:  00000000 ....  00000000 ....  00000001 ....  20100800 ... 
80000002 00000000:  65746e49 Inte  2952286c l(R)  726f4320  Cor  4d542865 e(TM
80000003 00000000:  51203229 )2 Q  20646175 uad   55504320  CPU  51202020    Q
80000004 00000000:  30303339 9300  20402020   @   30352e32 2.50  007a4847 GHz.
80000005 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
80000006 00000000:  00000000 ....  00000000 ....  0c006040 @`..  00000000 ....
80000007 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
80000008 00000000:  00003024 $0..  00000000 ....  00000000 ....  00000000 ....
[/cpuid output]
Comment 86 Ritz 2010-09-25 21:23:51 UTC
cilie@cilie-laptop:~$ uname -a
Linux cilie-laptop 2.6.36-020636rc4-generic #201009130905 SMP Mon Sep 13 10:15:27 UTC 2010 i686 GNU/Linux

cilie@cilie-laptop:~$ ./cpuid -cpuid0
Leaf     Subleaf    EAX            EBX            ECX            EDX            
00000000 00000000:  0000000a ....  756e6547 Genu  6c65746e ntel  49656e69 ineI
00000001 00000000:  000106c2 ....  00020800 ....  0040c39d ..@.  bfe9fbff ....
00000002 00000000:  4fba5901 .Y.O  0e3080c0 ..0.  00000000 ....  00000000 ....
00000003 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
00000004 00000000:  00004121 !A..  0140003f ?.@.  0000003f ?...  00000001 ....
00000004 00000001:  00004122 "A..  01c0003f ?...  0000003f ?...  00000001 ....
00000004 00000002:  00004143 CA..  01c0003f ?...  000003ff ....  00000001 ....
00000005 00000000:  00000040 @...  00000040 @...  00000003 ....  00020220  ...
00000006 00000000:  00000001 ....  00000002 ....  00000001 ....  00000000 ....
00000007 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
00000008 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
00000009 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
0000000a 00000000:  07280203 ..(.  00000000 ....  00000000 ....  00002501 .%..
80000000 00000000:  80000008 ....  00000000 ....  00000000 ....  00000000 ....
80000001 00000000:  00000000 ....  00000000 ....  00000001 ....  00100000 ....
80000002 00000000:  20202020       20202020       746e4920  Int  52286c65 el(R
80000003 00000000:  74412029 ) At  54286d6f om(T  4320294d M) C  4e205550 PU N
80000004 00000000:  20303732 270   20402020   @   30362e31 1.60  007a4847 GHz.
80000005 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
80000006 00000000:  00000000 ....  00000000 ....  02008040 @...  00000000 ....
80000007 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
80000008 00000000:  00002020   ..  00000000 ....  00000000 ....  00000000 ....
cilie@cilie-laptop:~$ ./cpuid -cpuid1
Leaf     Subleaf    EAX            EBX            ECX            EDX            
00000000 00000000:  0000000a ....  756e6547 Genu  6c65746e ntel  49656e69 ineI
00000001 00000000:  000106c2 ....  00020800 ....  0040c39d ..@.  bfe9fbff ....
00000002 00000000:  4fba5901 .Y.O  0e3080c0 ..0.  00000000 ....  00000000 ....
00000003 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
00000004 00000000:  00004121 !A..  0140003f ?.@.  0000003f ?...  00000001 ....
00000004 00000001:  00004122 "A..  01c0003f ?...  0000003f ?...  00000001 ....
00000004 00000002:  00004143 CA..  01c0003f ?...  000003ff ....  00000001 ....
00000005 00000000:  00000040 @...  00000040 @...  00000003 ....  00020220  ...
00000006 00000000:  00000001 ....  00000002 ....  00000001 ....  00000000 ....
00000007 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
00000008 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
00000009 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
0000000a 00000000:  07280203 ..(.  00000000 ....  00000000 ....  00002501 .%..
80000000 00000000:  80000008 ....  00000000 ....  00000000 ....  00000000 ....
80000001 00000000:  00000000 ....  00000000 ....  00000001 ....  00100000 ....
80000002 00000000:  20202020       20202020       746e4920  Int  52286c65 el(R
80000003 00000000:  74412029 ) At  54286d6f om(T  4320294d M) C  4e205550 PU N
80000004 00000000:  20303732 270   20402020   @   30362e31 1.60  007a4847 GHz.
80000005 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
80000006 00000000:  00000000 ....  00000000 ....  02008040 @...  00000000 ....
80000007 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
80000008 00000000:  00002020   ..  00000000 ....  00000000 ....  00000000 ....
Comment 87 Alex 2010-09-26 06:40:18 UTC
cpuid 0-4 on Intel(R) Core(TM) i5 CPU 650  @ 3.20GHz

Leaf     Subleaf    EAX            EBX            ECX            EDX            
00000000 00000000:  0000000b ....  756e6547 Genu  6c65746e ntel  49656e69 ineI
00000001 00000000:  00020652 R...  00100800 ....  0298e3ff ....  bfebfbff ....
00000002 00000000:  55035a01 .Z.U  00f0b2e3 ....  00000000 ....  09ca212c ,!..
00000003 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
00000004 00000000:  1c004121 !A..  01c0003f ?...  0000003f ?...  00000000 ....
00000005 00000000:  00000040 @...  00000040 @...  00000003 ....  00001120  ...
00000006 00000000:  00000007 ....  00000002 ....  00000001 ....  00000000 ....
00000007 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
00000008 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
00000009 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
0000000a 00000000:  07300403 ..0.  00000004 ....  00000000 ....  00000603 ....
0000000b 00000000:  00000001 ....  00000002 ....  00000100 ....  00000000 ....
Leaf     Subleaf    EAX            EBX            ECX            EDX            
00000000 00000000:  0000000b ....  756e6547 Genu  6c65746e ntel  49656e69 ineI
00000001 00000000:  00020652 R...  04100800 ....  0298e3ff ....  bfebfbff ....
00000002 00000000:  55035a01 .Z.U  00f0b2e3 ....  00000000 ....  09ca212c ,!..
00000003 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
00000004 00000000:  1c004121 !A..  01c0003f ?...  0000003f ?...  00000000 ....
00000005 00000000:  00000040 @...  00000040 @...  00000003 ....  00001120  ...
00000006 00000000:  00000007 ....  00000002 ....  00000001 ....  00000000 ....
00000007 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
00000008 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
00000009 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
0000000a 00000000:  07300403 ..0.  00000004 ....  00000000 ....  00000603 ....
0000000b 00000000:  00000001 ....  00000002 ....  00000100 ....  00000004 ....
Leaf     Subleaf    EAX            EBX            ECX            EDX            
00000000 00000000:  0000000b ....  756e6547 Genu  6c65746e ntel  49656e69 ineI
00000001 00000000:  00020652 R...  01100800 ....  0298e3ff ....  bfebfbff ....
00000002 00000000:  55035a01 .Z.U  00f0b2e3 ....  00000000 ....  09ca212c ,!..
00000003 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
00000004 00000000:  1c004121 !A..  01c0003f ?...  0000003f ?...  00000000 ....
00000005 00000000:  00000040 @...  00000040 @...  00000003 ....  00001120  ...
00000006 00000000:  00000007 ....  00000002 ....  00000001 ....  00000000 ....
00000007 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
00000008 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
00000009 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
0000000a 00000000:  07300403 ..0.  00000004 ....  00000000 ....  00000603 ....
0000000b 00000000:  00000001 ....  00000002 ....  00000100 ....  00000001 ....
Leaf     Subleaf    EAX            EBX            ECX            EDX            
00000000 00000000:  0000000b ....  756e6547 Genu  6c65746e ntel  49656e69 ineI
00000001 00000000:  00020652 R...  05100800 ....  0298e3ff ....  bfebfbff ....
00000002 00000000:  55035a01 .Z.U  00f0b2e3 ....  00000000 ....  09ca212c ,!..
00000003 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
00000004 00000000:  1c004121 !A..  01c0003f ?...  0000003f ?...  00000000 ....
00000005 00000000:  00000040 @...  00000040 @...  00000003 ....  00001120  ...
00000006 00000000:  00000007 ....  00000002 ....  00000001 ....  00000000 ....
00000007 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
00000008 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
00000009 00000000:  00000000 ....  00000000 ....  00000000 ....  00000000 ....
0000000a 00000000:  07300403 ..0.  00000004 ....  00000000 ....  00000603 ....
0000000b 00000000:  00000001 ....  00000002 ....  00000100 ....  00000005 ....
Comment 88 Rafael J. Wysocki 2010-09-27 19:25:37 UTC
On Monday, September 27, 2010, Boris Cuber wrote:
> Am Sunday 26 September 2010 schrieben Sie:
> > This message has been generated automatically as a part of a report
> > of regressions introduced between 2.6.34 and 2.6.35.
> > 
> > The following bug entry is on the current list of known regressions
> > introduced between 2.6.34 and 2.6.35.  Please verify if it still should
> > be listed and let the tracking team know (either way).
> > 
> > 
> > Bug-Entry   : http://bugzilla.kernel.org/show_bug.cgi?id=16322
> > Subject             : WARNING: at /arch/x86/include/asm/processor.h:1005
> > read_measured_perf_ctrs+0x5a/0x70() Submitter       : boris64
> > <bugzilla.kernel.org@boris64.net>
> > Date                : 2010-07-01 13:54 (88 days old)
> > Handled-By  : H. Peter Anvin <hpa@zytor.com>
> Not fixed yet.
Comment 89 H. Peter Anvin 2010-09-28 22:19:11 UTC
OK, I have managed to reproduce at least one variant of this problem locally... let's see if I can nail it down from here.
Comment 90 H. Peter Anvin 2010-09-28 22:43:57 UTC
Created attachment 31802 [details]
Patch, version 3

Okay, it turns out I had the right idea the first time, but I just made a slight mistake in the actual implementation (I thought get_cpu_cap() included the setting of cpuid_level, it turns out that it does not.)

Here is a fixed patch that resolves this problem on my test system.  Please test it out, but since I have been able to confirm that it works locally on at least one system I'm going to push it to Linus.
Comment 91 boris64 2010-09-29 00:29:25 UTC
I confirm that this patch works for me on my core2duo cpu.
No warning anymore plus no more missing flags /proc/cpuinfo.

Thanks for your time and effort Peter ;)
Comment 92 Alex 2010-09-29 16:16:56 UTC
Still not working on my i5-650:
uname -a
Linux i5-650 2.6.35.7 #1 SMP Wed Sep 29 07:12:59 CEST 2010 i686 GNU/Linux

[    1.390419] ------------[ cut here ]------------
[    1.390481] WARNING: at /usr/src/linux-2.6.35.7/arch/x86/include/asm/processor.h:1005 read_measured_perf_ctrs+0x43/0x50()
[    1.390569] Hardware name: System Product Name
[    1.390614] Modules linked in:
[    1.390675] Pid: 422, comm: kondemand/2 Not tainted 2.6.35.7 #1
[    1.390725] Call Trace:
[    1.390770]  [<c1032d28>] ? warn_slowpath_common+0x78/0xb0
[    1.390820]  [<c1016fe3>] ? read_measured_perf_ctrs+0x43/0x50
[    1.390869]  [<c1016fe3>] ? read_measured_perf_ctrs+0x43/0x50
[    1.390893] ------------[ cut here ]------------
[    1.390897] WARNING: at /usr/src/linux-2.6.35.7/arch/x86/include/asm/processor.h:1005 read_measured_perf_ctrs+0x43/0x50()
[    1.390898] Hardware name: System Product Name
[    1.390899] Modules linked in:
[    1.390900] Pid: 423, comm: kondemand/3 Not tainted 2.6.35.7 #1
[    1.390901] Call Trace:
[    1.390904]  [<c1032d28>] ? warn_slowpath_common+0x78/0xb0
[    1.390906]  [<c1016fe3>] ? read_measured_perf_ctrs+0x43/0x50
[    1.390907]  [<c1016fe3>] ? read_measured_perf_ctrs+0x43/0x50
[    1.390909]  [<c1016fa0>] ? read_measured_perf_ctrs+0x0/0x50
[    1.390911]  [<c1032d7b>] ? warn_slowpath_null+0x1b/0x20
[    1.390912]  [<c1016fe3>] ? read_measured_perf_ctrs+0x43/0x50
[    1.390916]  [<c105a068>] ? smp_call_function_single+0x68/0x120
[    1.390918]  [<c1016ef0>] ? cpufreq_get_measured_perf+0x30/0xe0
[    1.390920]  [<c10372d6>] ? ns_to_timeval+0x6/0x20
[    1.390923]  [<c11a6c9f>] ? kobject_get+0xf/0x20
[    1.390926]  [<c1295302>] ? __cpufreq_driver_getavg+0x62/0x70
[    1.390928]  [<c1296d5c>] ? do_dbs_timer+0xdc/0x3f0
[    1.390929]  [<c1296c80>] ? do_dbs_timer+0x0/0x3f0
[    1.390932]  [<c104448f>] ? worker_thread+0xcf/0x160
[    1.390934]  [<c1047830>] ? autoremove_wake_function+0x0/0x40
[    1.390935]  [<c10443c0>] ? worker_thread+0x0/0x160
[    1.390937]  [<c10474b4>] ? kthread+0x74/0x80
[    1.390938]  [<c1047440>] ? kthread+0x0/0x80
[    1.390940]  [<c1002ff6>] ? kernel_thread_helper+0x6/0x10
[    1.390942] ---[ end trace c524a9ecdd3a096a ]---
[    1.392182]  [<c1016fa0>] ? read_measured_perf_ctrs+0x0/0x50
[    1.392231]  [<c1032d7b>] ? warn_slowpath_null+0x1b/0x20
[    1.392280]  [<c1016fe3>] ? read_measured_perf_ctrs+0x43/0x50
[    1.392331]  [<c105a068>] ? smp_call_function_single+0x68/0x120
[    1.392382]  [<c1016ef0>] ? cpufreq_get_measured_perf+0x30/0xe0
[    1.392432]  [<c10372d6>] ? ns_to_timeval+0x6/0x20
[    1.392480]  [<c11a6c9f>] ? kobject_get+0xf/0x20
[    1.392527]  [<c1295302>] ? __cpufreq_driver_getavg+0x62/0x70
[    1.392577]  [<c1296d5c>] ? do_dbs_timer+0xdc/0x3f0
[    1.392625]  [<c1296c80>] ? do_dbs_timer+0x0/0x3f0
[    1.392672]  [<c104448f>] ? worker_thread+0xcf/0x160
[    1.392721]  [<c1047830>] ? autoremove_wake_function+0x0/0x40
[    1.392771]  [<c10443c0>] ? worker_thread+0x0/0x160
[    1.392819]  [<c10474b4>] ? kthread+0x74/0x80
[    1.392866]  [<c1047440>] ? kthread+0x0/0x80
[    1.392912]  [<c1002ff6>] ? kernel_thread_helper+0x6/0x10
[    1.392960] ---[ end trace c524a9ecdd3a096b ]---
Comment 93 Robert Hooker 2010-09-30 01:04:46 UTC
No luck with the patch in comment #90 here either on a machine with a sandybridge CPU, but disabling the "Enable CPUID limit" feature in bios makes the warnings go away as well.
Comment 94 H. Peter Anvin 2010-09-30 04:20:55 UTC
The "CPUID limit" thing is the fundamental problem -- what seems to not be working quite right is the part of the kernel which turns *off* the CPUID limit if it was found to be enabled.

Robert and Alex: if you could please do the cpuid and rdmsr dump thing (I need both), that would be extremely useful.  I would also like to know the exact systems that you both are on.
Comment 95 Alex 2010-09-30 05:16:01 UTC
Created attachment 31972 [details]
dmidecode
Comment 96 Alex 2010-09-30 05:16:34 UTC
Created attachment 31982 [details]
/proc/cpuinfo
Comment 97 Alex 2010-09-30 05:17:29 UTC
root@i5-650:/usr/src# rdmsr -cx -p 0 0x1a0
0x850089
root@i5-650:/usr/src# rdmsr -cx -p 1 0x1a0
0x850089
root@i5-650:/usr/src# rdmsr -cx -p 2 0x1a0
0x850089
root@i5-650:/usr/src# rdmsr -cx -p 3 0x1a0
0x850089

cpuid output already postet in #87
hope this helps
Comment 98 Robert Hooker 2010-09-30 18:45:13 UTC
Created attachment 32092 [details]
cpu info (cpuid and /proc/cpuinfo output) 

info obtained on 2.6.35-22-generic x64 ubuntu kernel with the v3 patch applied and the bios option which causes the warning enabled.

rdmsr returns this for all 4 CPU's
0x850089
Comment 99 H. Peter Anvin 2010-09-30 22:35:44 UTC
Alex, Robert: could you please put a printk() statement immediately after the call to get_cpu_cap() in arch/x86/kernel/cpu/intel.c and see if the printk appears in the resulting dmesg output?

Something like this:

printk(KERN_NOTICE "Uncapping CPUID on CPU#%d\n", smp_processor_id());
Comment 100 Alex 2010-10-01 05:00:13 UTC
dmesg |grep Uncapping
[    0.244613] Uncapping CPUID on CPU#1
[    0.352277] Uncapping CPUID on CPU#2
[    0.459941] Uncapping CPUID on CPU#3

Hmm, no 0?
Comment 101 H. Peter Anvin 2010-10-01 05:03:44 UTC
Doesn't look like CPU #0 needed uncapping, or perhaps it just got run before printk is available unless you're using earlyprintk (the code gets run on CPU #0 *way* earlier than on the other CPUs.)
Comment 102 Ritz 2010-10-01 07:05:32 UTC
hmm..
Something happend now.
Before the Warning only happend once or twice about 30 seconds after boot.
But on 2.6.36-rc6 it keeps on. See attached file. dmesg_2.6.36_rc6.txt
Comment 103 Ritz 2010-10-01 07:08:41 UTC
Created attachment 32162 [details]
-rc6 dmesg.txt
Comment 104 Ritz 2010-10-01 08:21:33 UTC
-sorry #102 + #103 is probally bug 19062
Comment 105 Robert Hooker 2010-10-01 18:08:37 UTC
This time I patched 2.6.36-rc6 with the patch in comment #90 and added the printk and I am not getting the warning that I was getting on the 2.6.35 based kernel, things appear to be working properly.


[    0.000000] Uncapping CPUID on CPU#0
[    0.394873] Uncapping CPUID on CPU#1
[    0.574638] Uncapping CPUID on CPU#2
[    0.754400] Uncapping CPUID on CPU#3
Comment 106 Robert Hooker 2010-10-01 20:08:17 UTC
With the 2.6.35.4 based kernel patched with the patch in comment #90 and the printk added the previous the warnings do indeed return, so it appears it does fix things on 2.6.36 but not .35 at least.
Comment 107 H. Peter Anvin 2010-10-01 20:28:05 UTC
Hm, okay.  That makes more sense.
Comment 108 H. Peter Anvin 2010-10-01 20:32:42 UTC
I suspect 2.6.35 needs 1dedefd1a066a795a87afca9c0236e1a94de9bf6 from the 2.6.36 tree in addition to this patch.

Could you try adding

http://git.kernel.org/linus/1dedefd1a066a795a87afca9c0236e1a94de9bf6

... in addition to patch #3 and see if this fixes the problem on 2.6.35?
Comment 109 Rafael J. Wysocki 2010-10-01 20:38:45 UTC
A fix that works on top of 2.6.36 is sufficient for marking this bug as resolved.

Patch : https://bugzilla.kernel.org/attachment.cgi?id=31802
Comment 110 Alex 2010-10-01 20:47:20 UTC
Yes, 1dedefd1a066a795a87afca9c0236e1a94de9bf6 and patch #3 works on 2.6.35 :)
Thank you
Comment 111 H. Peter Anvin 2010-10-01 20:52:43 UTC
Alright, I think we have this one nailed.  Finally.  :)
Comment 112 H. Peter Anvin 2010-10-01 21:05:08 UTC
Email sent to the stable guys to request these patches be promoted into stable.
Comment 113 Ritz 2010-10-03 06:46:43 UTC
I can confirm 1dedefd1a066a795a87afca9c0236e1a94de9bf6 and patchv3 works on 2.6.35 running on N270 atom hardware.

/Thanks
Comment 114 Rafael J. Wysocki 2010-10-03 21:22:17 UTC
Fixed by commit d900329e20f4476db6461752accebcf7935a8055 .