Re: [PATCH] Pentium Pro - sysenter - doublefault

From: Mikael Pettersson
Date: Thu Aug 21 2003 - 16:39:07 EST


Jim Houston writes:
> Hi Everyone,
>
> I upgraded my Pentium Pro system to Redhat 9, installed a
> linux-2.6.0-test3 kernel, and it fails with a double-fault when
> init starts.
>
> The code which decides if it is o.k. to use sysenter is broken for
> some Pentium Pro cpus ,in particular, this bit of code from
> arch/i386/kernel/cpu/intel.c:
>
> /* SEP CPUID bug: Pentium Pro reports SEP but doesn't have it */
> if ( c->x86 == 6 && c->x86_model < 3 && c->x86_mask < 3 )
> clear_bit(X86_FEATURE_SEP, c->x86_capability);
>
> On my cpu model=1 and mask=9, it doesn't clear 86_FEATURE_SEP.
> This results in a double-fault when init starts. The double-fault
> happens on the sysexit. The new double-fault handler caught this
> nicely, and I was able to debug this with kgdb.
>
> The logic above is exactly what Intel says to do in "IA-32 Intel®
> Architecture Software Developer's Manual, Volume 2: Instruction Set
> Reference" on page 3-767. It also says that sysenter was added to the
> Pentium II.

I double-checked AP-485 (24161823.pdf, the "real" reference to CPUID),
and it says (section 3.4) that SEP is unsupported when the signature
as a whole is less that 0x633. This means all PPros, and PII Model 3s
with steppings less than 3.

The problem is that the kernel check you quoted above is buggy: the
c->x86_model < 3 && c->x86_mask < 3 part fails for late-stepping PPros
since c->x86_mask >= 3 for them. The test should be rewritten as:

if (c->x86 == 6 && (c->x86_model < 3 ||
(c->x86_model == 3 && c->x86_mask < 3)))
clear_bit(X86_FEATURE_SEP, c->x86_capability);

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