2001-10-05 18:16:32

by Harik A'ttar

[permalink] [raw]
Subject: Wierd /proc/cpuinfo with 2.4.11-pre4


>From dmesg:
CPU: Before vendor init, caps: 000001bf 00000000 00000000, vendor = 0
Intel Pentium with F0 0F bug - workaround enabled.
Intel old style machine check architecture supported.
Intel old style machine check reporting enabled on CPU#0.
CPU: After vendor init, caps: 000001bf 00000000 00000000 00000000
CPU: After generic, caps: 000001bf 00000000 00000000 00000000
CPU: Common caps: 000001bf 00000000 00000000 00000000
CPU: Intel Pentium 75 - 200 stepping 0b
Checking 'hlt' instruction... OK.

Looks normal. Let's see /proc/cpuinfo...

processor : 0
vendor_id : GenuineIntel
cpu family : 5
model : 2
model name : Pentium 75 - 200
stepping : 11
cpu MHz : 132.634
fdiv_bug : no
hlt_bug : no
f00f_bug : yes
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 1
wp : yes
flags : fpu vme de pse tsc msr mce cx8
bogomips : 264.60

processor : 1
vendor_id : unknown
cpu family : 0
model : 0
model name : unknown
stepping : 16
cpu MHz : 132.634
fdiv_bug : no
hlt_bug : no
f00f_bug : yes
coma_bug : yes
fpu : yes
fpu_exception : yes
cpuid level : 0
wp : yes
flags : fpu vme de pse tsc 3dnow lrti
bogomips : 0.02

processor : 2
vendor_id : ??0??0?
cpu family : 156
model : 48
model name : ?
stepping : 192
cpu MHz : 132.634
cache size : 0 KB
fdiv_bug : yes
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 0
wp : yes
flags : fpu de tsc msr pae mce apic pge cmov pat clflush dts ia64 recovery longrun lrti
bogomips : 644790.84

processor : 3
vendor_id : L?)?
cpu family : 86
model : 41
model name : ??0???0?
stepping : 192
cache size : 0 KB
fdiv_bug : no
hlt_bug : yes
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 1048575
wp : no
flags : syscall 3dnowext 3dnow
bogomips : 0.00

processor : 4
vendor_id : ??)???)?}?)?y?)?u?)?p?)?
cpu family : 0
model : 0
model name : u?)?p?)?
stepping : 0
cpu MHz : 132.634
fdiv_bug : yes
hlt_bug : yes
f00f_bug : yes
coma_bug : yes
fpu : no
fpu_exception : no
cpuid level : 1
wp : no
flags : fpu tsc msr pae mce apic pge cmov pat clflush dts ia64 syscall 3dnowext 3dnow recovery lrti cxmmx centaur_mcr
bogomips : 0.00

processor : 5
vendor_id : unknown
cpu family : 0
model : 0
model name : unknown
stepping : 0
fdiv_bug : yes
hlt_bug : yes
f00f_bug : no
coma_bug : yes
fpu : no
fpu_exception : no
cpuid level : 0
wp : no
flags : cxmmx k6_mtrr cyrix_arr
bogomips : 0.00

processor : 6
vendor_id : unknown
cpu family : 0
model : 0
model name : unknown
stepping : 0
cache size : 0 KB
fdiv_bug : no
hlt_bug : yes
f00f_bug : no
coma_bug : no
fpu : no
fpu_exception : no
cpuid level : 0
wp : no
flags :
bogomips : 0.00

processor : 7
vendor_id : unknown
cpu family : 0
model : 0
model name : unknown
stepping : 0
cache size : 515 KB
fdiv_bug : no
hlt_bug : yes
f00f_bug : yes
coma_bug : yes
fpu : no
fpu_exception : no
cpuid level : 0
wp : no
flags :
bogomips : 644464.70


Wow! That's pretty impressive, a new kernel build gives me an
additional _7_ CPUs!

Interesting bits of .config:

CONFIG_M586TSC=y
CONFIG_X86_MSR=y
CONFIG_X86_CPUID=y
CONFIG_NOHIGHMEM=y
# CONFIG_HIGHMEM4G is not set
# CONFIG_HIGHMEM64G is not set
# CONFIG_MATH_EMULATION is not set
CONFIG_MTRR=y
# CONFIG_SMP is not set
# CONFIG_X86_UP_APIC is not set
# CONFIG_X86_UP_IOAPIC is not set

Won't compile with UP APIC turned on, as others have noted.

Aside from /bin/ps getting confused about the system capabilities, it
seems stable.

--Dan


2001-10-05 21:42:41

by Alessandro Suardi

[permalink] [raw]
Subject: Re: Wierd /proc/cpuinfo with 2.4.11-pre4

Dan Merillat wrote:
>
> From dmesg:
> CPU: Before vendor init, caps: 000001bf 00000000 00000000, vendor = 0
> Intel Pentium with F0 0F bug - workaround enabled.
> Intel old style machine check architecture supported.
> Intel old style machine check reporting enabled on CPU#0.
> CPU: After vendor init, caps: 000001bf 00000000 00000000 00000000
> CPU: After generic, caps: 000001bf 00000000 00000000 00000000
> CPU: Common caps: 000001bf 00000000 00000000 00000000
> CPU: Intel Pentium 75 - 200 stepping 0b
> Checking 'hlt' instruction... OK.
>
> Looks normal. Let's see /proc/cpuinfo...
>
> processor : 0

[snip]

> processor : 7
> vendor_id : unknown
> cpu family : 0
> model : 0
> model name : unknown
> stepping : 0
> cache size : 515 KB
> fdiv_bug : no
> hlt_bug : yes
> f00f_bug : yes
> coma_bug : yes
> fpu : no
> fpu_exception : no
> cpuid level : 0
> wp : no
> flags :
> bogomips : 644464.70
>
> Wow! That's pretty impressive, a new kernel build gives me an
> additional _7_ CPUs!
>
> Interesting bits of .config:
>
> CONFIG_M586TSC=y
> CONFIG_X86_MSR=y
> CONFIG_X86_CPUID=y
> CONFIG_NOHIGHMEM=y
> # CONFIG_HIGHMEM4G is not set
> # CONFIG_HIGHMEM64G is not set
> # CONFIG_MATH_EMULATION is not set
> CONFIG_MTRR=y
> # CONFIG_SMP is not set
> # CONFIG_X86_UP_APIC is not set
> # CONFIG_X86_UP_IOAPIC is not set
>
> Won't compile with UP APIC turned on, as others have noted.
>
> Aside from /bin/ps getting confused about the system capabilities, it
> seems stable.

Same 8-processor incorrect info on my PIII Dell laptop -
redirecting '/usr/bin/top' stderr gets this:

[asuardi@dolphin linux]$ cat x
fscanf failed on /proc/stat for cpu 1
fscanf failed on /proc/stat for cpu 2
fscanf failed on /proc/stat for cpu 3
fscanf failed on /proc/stat for cpu 4
fscanf failed on /proc/stat for cpu 5
fscanf failed on /proc/stat for cpu 6
fscanf failed on /proc/stat for cpu 7
fscanf failed on /proc/stat for cpu 1

So I'd assume anything touching /proc/cpuinfo is hosed.

--alessandro

"this is no time to get cute, it's a mad dog's promenade
so walk tall, or baby don't walk at all"
(Bruce Springsteen, 'New York City Serenade')

2001-10-05 22:02:52

by Martin J. Bligh

[permalink] [raw]
Subject: Re: Wierd /proc/cpuinfo with 2.4.11-pre4

>> Wow! That's pretty impressive, a new kernel build gives me an
>> additional _7_ CPUs!

Sorry. Mea culpa

--- setup.c.old Fri Oct 5 14:20:29 2001
+++ setup.c Fri Oct 5 14:28:51 2001
@@ -2420,7 +2420,7 @@
* WARNING - nasty evil hack ... if we print > 8, it overflows the
* page buffer and corrupts memory - this needs fixing properly
*/
- for (n = 0; n < 8; n++, c++) {
+ for (n = 0; n < (clustered_apic_mode ? 8 : NR_CPUS); n++, c++) {
/* for (n = 0; n < NR_CPUS; n++, c++) { */
int fpu_exception;
#ifdef CONFIG_SMP

M.

PS. I just tested this since my last post. It seems to work.

2001-10-05 23:07:46

by Alessandro Suardi

[permalink] [raw]
Subject: Re: Wierd /proc/cpuinfo with 2.4.11-pre4

"Martin J. Bligh" wrote:
>
> >> Wow! That's pretty impressive, a new kernel build gives me an
> >> additional _7_ CPUs!
>
> Sorry. Mea culpa
>
> --- setup.c.old Fri Oct 5 14:20:29 2001
> +++ setup.c Fri Oct 5 14:28:51 2001
> @@ -2420,7 +2420,7 @@
> * WARNING - nasty evil hack ... if we print > 8, it overflows the
> * page buffer and corrupts memory - this needs fixing properly
> */
> - for (n = 0; n < 8; n++, c++) {
> + for (n = 0; n < (clustered_apic_mode ? 8 : NR_CPUS); n++, c++) {
> /* for (n = 0; n < NR_CPUS; n++, c++) { */
> int fpu_exception;
> #ifdef CONFIG_SMP
>
> M.
>
> PS. I just tested this since my last post. It seems to work.

Doesn't build here...

gcc -D__KERNEL__ -I/share/src/linux-2.4.11-pre4/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-common -pipe -mpreferred-stack-boundary=2
-march=i686 -c -o setup.o setup.c
setup.c: In function `get_cpuinfo':
setup.c:2423: `clustered_apic_mode' undeclared (first use in this function)
setup.c:2423: (Each undeclared identifier is reported only once
setup.c:2423: for each function it appears in.)
make[1]: *** [setup.o] Error 1
make[1]: Leaving directory `/share/src/linux-2.4.11-pre4/arch/i386/kernel'
make: *** [_dir_arch/i386/kernel] Error 2

--alessandro

"this is no time to get cute, it's a mad dog's promenade
so walk tall, or baby don't walk at all"
(Bruce Springsteen, 'New York City Serenade')

2001-10-05 23:12:48

by Martin J. Bligh

[permalink] [raw]
Subject: Re: Wierd /proc/cpuinfo with 2.4.11-pre4

> Doesn't build here...

Looks like you need the other patch I posted here too.

M.

Combined reformated patch below:

diff -urN virgin-2.4.11-pre4/arch/i386/kernel/setup.c numa-2.4.11-pre4/arch/i386/kernel/setup.c
--- virgin-2.4.11-pre4/arch/i386/kernel/setup.c Fri Oct 5 15:39:54 2001
+++ numa-2.4.11-pre4/arch/i386/kernel/setup.c Fri Oct 5 15:42:37 2001
@@ -2420,7 +2420,7 @@
* WARNING - nasty evil hack ... if we print > 8, it overflows the
* page buffer and corrupts memory - this needs fixing properly
*/
- for (n = 0; n < 8; n++, c++) {
+ for (n = 0; n < (clustered_apic_mode ? 8 : NR_CPUS); n++, c++) {
/* for (n = 0; n < NR_CPUS; n++, c++) { */
int fpu_exception;
#ifdef CONFIG_SMP
diff -urN virgin-2.4.11-pre4/include/asm-i386/smp.h numa-2.4.11-pre4/include/asm-i386/smp.h
--- virgin-2.4.11-pre4/include/asm-i386/smp.h Fri Oct 5 15:40:46 2001
+++ numa-2.4.11-pre4/include/asm-i386/smp.h Fri Oct 5 15:44:57 2001
@@ -22,7 +22,7 @@
#endif
#endif

-#if CONFIG_SMP
+#ifdef CONFIG_SMP
# ifdef CONFIG_MULTIQUAD
# define TARGET_CPUS 0xf /* all CPUs in *THIS* quad */
# define INT_DELIVERY_MODE 0 /* physical delivery on LOCAL quad */
@@ -31,9 +31,20 @@
# define INT_DELIVERY_MODE 1 /* logical delivery broadcast to all procs */
# endif
#else
+# define INT_DELIVERY_MODE 0 /* physical delivery on LOCAL quad */
# define TARGET_CPUS 0x01
#endif

+#ifndef clustered_apic_mode
+ #ifdef CONFIG_MULTIQUAD
+ #define clustered_apic_mode (1)
+ #define esr_disable (1)
+ #else /* !CONFIG_MULTIQUAD */
+ #define clustered_apic_mode (0)
+ #define esr_disable (0)
+ #endif /* CONFIG_MULTIQUAD */
+#endif
+
#ifdef CONFIG_SMP
#ifndef ASSEMBLY

@@ -76,16 +87,6 @@
extern volatile int physical_apicid_to_cpu[MAX_APICID];
extern volatile int cpu_to_logical_apicid[NR_CPUS];
extern volatile int logical_apicid_to_cpu[MAX_APICID];
-
-#ifndef clustered_apic_mode
- #ifdef CONFIG_MULTIQUAD
- #define clustered_apic_mode (1)
- #define esr_disable (1)
- #else /* !CONFIG_MULTIQUAD */
- #define clustered_apic_mode (0)
- #define esr_disable (0)
- #endif /* CONFIG_MULTIQUAD */
-#endif

/*
* General functions that each host system must provide.

2001-10-05 23:18:46

by Andreas Dilger

[permalink] [raw]
Subject: Re: Wierd /proc/cpuinfo with 2.4.11-pre4

On Oct 06, 2001 01:10 +0200, Alessandro Suardi wrote:
> "Martin J. Bligh" wrote:
> > Sorry. Mea culpa
> >
> > --- setup.c.old Fri Oct 5 14:20:29 2001
> > +++ setup.c Fri Oct 5 14:28:51 2001
> > @@ -2420,7 +2420,7 @@
> > * WARNING - nasty evil hack ... if we print > 8, it overflows the
> > * page buffer and corrupts memory - this needs fixing properly
> > */
> > - for (n = 0; n < 8; n++, c++) {
> > + for (n = 0; n < (clustered_apic_mode ? 8 : NR_CPUS); n++, c++) {
> > /* for (n = 0; n < NR_CPUS; n++, c++) { */
> > int fpu_exception;
> > #ifdef CONFIG_SMP

This will also fail if, for some reason "clustered_apic_mode" is set and
you have less than 8 CPUs. What you really want is to have "max(8:NR_CPUS)"
in the loop (or make the loop actually work with > 8 CPUs, which is probably
the correct solution in the long run).

Cheers, Andreas
--
Andreas Dilger \ "If a man ate a pound of pasta and a pound of antipasto,
\ would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/ -- Dogbert

2001-10-05 23:22:07

by Brian Gerst

[permalink] [raw]
Subject: Re: Wierd /proc/cpuinfo with 2.4.11-pre4

"Martin J. Bligh" wrote:
>
> >> Wow! That's pretty impressive, a new kernel build gives me an
> >> additional _7_ CPUs!
>
> Sorry. Mea culpa
>
> --- setup.c.old Fri Oct 5 14:20:29 2001
> +++ setup.c Fri Oct 5 14:28:51 2001
> @@ -2420,7 +2420,7 @@
> * WARNING - nasty evil hack ... if we print > 8, it overflows the
> * page buffer and corrupts memory - this needs fixing properly
> */
> - for (n = 0; n < 8; n++, c++) {
> + for (n = 0; n < (clustered_apic_mode ? 8 : NR_CPUS); n++, c++) {
> /* for (n = 0; n < NR_CPUS; n++, c++) { */
> int fpu_exception;
> #ifdef CONFIG_SMP
>
> M.
>
> PS. I just tested this since my last post. It seems to work.

It would be more appropriate to do:
for (n = 0; n < min(8, NR_CPUS); n++, c++) {

--

Brian Gerst

2001-10-05 23:25:16

by Martin J. Bligh

[permalink] [raw]
Subject: Re: Wierd /proc/cpuinfo with 2.4.11-pre4

> This will also fail if, for some reason "clustered_apic_mode" is set and
> you have less than 8 CPUs. What you really want is to have "max(8:NR_CPUS)"
> in the loop (or make the loop actually work with > 8 CPUs, which is probably
> the correct solution in the long run).

Nope, the cpu_online map should catch this. NR_CPUS is always 32
in SMP mode.

in get_cpuinfo ....

if (!(cpu_online_map & (1<<n)))
continue;

I didn't notice that this would only work in SMP mode.

It's a horrible hack, but it's less horrible than corrupting memory randomly ;-)

M.

2001-10-06 00:34:57

by Alessandro Suardi

[permalink] [raw]
Subject: Re: Wierd /proc/cpuinfo with 2.4.11-pre4

On Sat, 2001-10-06 at 01:07, Martin J. Bligh wrote:
> > Doesn't build here...
>
> Looks like you need the other patch I posted here too.

Thanks, builds - boots - fixes /proc/cpuinfo on my UP :)

> Combined reformated patch below:
>
> diff -urN virgin-2.4.11-pre4/arch/i386/kernel/setup.c numa-2.4.11-pre4/arch/i386/kernel/setup.c
> --- virgin-2.4.11-pre4/arch/i386/kernel/setup.c Fri Oct 5 15:39:54 2001
> +++ numa-2.4.11-pre4/arch/i386/kernel/setup.c Fri Oct 5 15:42:37 2001
> @@ -2420,7 +2420,7 @@
> * WARNING - nasty evil hack ... if we print > 8, it overflows the
> * page buffer and corrupts memory - this needs fixing properly
> */
> - for (n = 0; n < 8; n++, c++) {
> + for (n = 0; n < (clustered_apic_mode ? 8 : NR_CPUS); n++, c++) {
> /* for (n = 0; n < NR_CPUS; n++, c++) { */
> int fpu_exception;
> #ifdef CONFIG_SMP
> diff -urN virgin-2.4.11-pre4/include/asm-i386/smp.h numa-2.4.11-pre4/include/asm-i386/smp.h
> --- virgin-2.4.11-pre4/include/asm-i386/smp.h Fri Oct 5 15:40:46 2001
> +++ numa-2.4.11-pre4/include/asm-i386/smp.h Fri Oct 5 15:44:57 2001
> @@ -22,7 +22,7 @@
> #endif
> #endif
>
> -#if CONFIG_SMP
> +#ifdef CONFIG_SMP
> # ifdef CONFIG_MULTIQUAD
> # define TARGET_CPUS 0xf /* all CPUs in *THIS* quad */
> # define INT_DELIVERY_MODE 0 /* physical delivery on LOCAL quad */
> @@ -31,9 +31,20 @@
> # define INT_DELIVERY_MODE 1 /* logical delivery broadcast to all procs */
> # endif
> #else
> +# define INT_DELIVERY_MODE 0 /* physical delivery on LOCAL quad */
> # define TARGET_CPUS 0x01
> #endif
>
> +#ifndef clustered_apic_mode
> + #ifdef CONFIG_MULTIQUAD
> + #define clustered_apic_mode (1)
> + #define esr_disable (1)
> + #else /* !CONFIG_MULTIQUAD */
> + #define clustered_apic_mode (0)
> + #define esr_disable (0)
> + #endif /* CONFIG_MULTIQUAD */
> +#endif
> +
> #ifdef CONFIG_SMP
> #ifndef ASSEMBLY
>
> @@ -76,16 +87,6 @@
> extern volatile int physical_apicid_to_cpu[MAX_APICID];
> extern volatile int cpu_to_logical_apicid[NR_CPUS];
> extern volatile int logical_apicid_to_cpu[MAX_APICID];
> -
> -#ifndef clustered_apic_mode
> - #ifdef CONFIG_MULTIQUAD
> - #define clustered_apic_mode (1)
> - #define esr_disable (1)
> - #else /* !CONFIG_MULTIQUAD */
> - #define clustered_apic_mode (0)
> - #define esr_disable (0)
> - #endif /* CONFIG_MULTIQUAD */
> -#endif
>
> /*
> * General functions that each host system must provide.
>


--alessandro

"this is no time to get cute, it's a mad dog's promenade
so walk tall, or baby don't walk at all"
(Bruce Springsteen, 'New York City Serenade')