Re: 2.1.63 - testing Pentium bug workaround..

Ingo Molnar (mingo@pc7537.hil.siemens.at)
Thu, 13 Nov 1997 14:51:14 +0100 (MET)


On Thu, 13 Nov 1997, Troels Arvin wrote:

> By the way:
> What's the nature of the bug-workaround? Does it bring down
> performance? [...]

Fortunately there is no overhead in RL systems. This is the structure of
Linux's new IDT:

IDT --> descriptor 0
1 LOW PAGE
...
descriptor 6 <====== illegal opcode
[ ............. PAGE BOUNDARY ...........................]
descriptor 7
descriptor 8 HIGH PAGE
...
descriptor 14 <====== page fault
...
255

'LOW PAGE' is unmapped, 'HIGH PAGE' is mapped. So Linux will see
a 'bounced exception' in the page fault handler only if exceptions 0-6
happen ... they are very rare. The BSDI fix seems to cut at exception
13, which thus includes important exceptions like the lazy-FPU exception.
Linux does not have this overhead.

The above 'added complexity' is executed only after all other page fault
causes are filtered out. This means there is _zero_ added overhead for
normal page-in, COW, nonmapped faults. We detect this special condition
at a point where we'd dump the kernel anyway, because that fault Must
Not Happen under any other circumstance.

thus the _only_ affected code is exceptions 0 to 6, and the cost is moderate,
less than 50 cycles. (ring switchig alone costs 85 cycles)

The affected exceptions:

+ do_divide_error, /* 0 - divide overflow */
+ do_debug, /* 1 - debug trap */
+ do_nmi, /* 2 - NMI */
+ do_int3, /* 3 - int 3 */
+ do_overflow, /* 4 - overflow */
+ do_bounds, /* 5 - bound range */
+ do_invalid_op }; /* 6 - invalid opcode */

_all_ other exceptions, interrupts, kernel activities are unaffected.

-- mingo