Re: test10-pre3

From: Mikael Pettersson (mikpe@csd.uu.se)
Date: Mon Oct 16 2000 - 17:05:15 EST


On Fri, 13 Oct 2000, Linus Torvalds wrote:

> - pre3:
> ...
> - Dave Jones: x86 setup fixes (recognize Pentium IV etc).

And then in test10-pre3 we find the following code added to
arch/i386/kernel/setup.c:

+ /* Pentium IV. */
+ if (c->x86 == 15) {
+ c->x86 = 6;
+ get_model_name(c);
+ goto name_decoded;
+ }

I believe the "c->x86 = 6" assignment to be broken.
If it's there to make uname -m return i686 for Pentium IV,
then surely that could be done differently. (See patch below.)

The assignment throws away perfectly good information, but worse,
it also destroys the implicit invariant that boot_cpu_data.x86
equals the "family" code as returned by CPUID. Low-level cpu-specific
code may then malfunction, or it will have to be updated to do its
own CPUID identification. Think about MTRRs, model-specific registers,
performance counters, and bug workarounds.

One harmless example is the "sep_bug" identification code in setup.c:

                sep_bug = c->x86_vendor == X86_VENDOR_INTEL &&
                          c->x86 == 0x06 &&
                          c->cpuid_level >= 0 &&
                          (c->x86_capability & X86_FEATURE_SEP) &&
                          c->x86_model < 3 &&
                          c->x86_mask < 3;

Since initial Pentium IV processors have model 0 according to Intel's
Pentium IV supplement to the CPUID manual (AP-485), this code may
actually deduce that a Pentium IV has the bug (if the mask < 3).
Imagine a similar mistake in an MTRR/MSR/whatever driver...

I propose the following patch against test10-pre3:

--- linux-2.4.0-test10-pre3/arch/i386/kernel/setup.c.~1~ Mon Oct 16 17:29:05 2000
+++ linux-2.4.0-test10-pre3/arch/i386/kernel/setup.c Mon Oct 16 23:13:21 2000
@@ -1548,7 +1548,6 @@
 
                         /* Pentium IV. */
                         if (c->x86 == 15) {
- c->x86 = 6;
                                 get_model_name(c);
                                 goto name_decoded;
                         }
--- linux-2.4.0-test10-pre3/include/asm-i386/bugs.h.~1~ Sat Sep 9 12:49:40 2000
+++ linux-2.4.0-test10-pre3/include/asm-i386/bugs.h Mon Oct 16 23:14:42 2000
@@ -426,5 +426,5 @@
         check_pentium_f00f();
 #endif
         check_cyrix_coma();
- system_utsname.machine[1] = '0' + boot_cpu_data.x86;
+ system_utsname.machine[1] = '0' + (boot_cpu_data.x86 > 6 ? 6 : boot_cpu_data.x86);
 }

mtrr.c will need fixing too, but we can't really do that until Intel
releases a new IA-32 System Programming manual with Pentium IV updates.

/Mikael
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Oct 23 2000 - 21:00:10 EST