Re: [PATCH] 2.6 workaround for Athlon/Opteron prefetch errata

Andi Kleen
2003-09-11T14:24:26Z

On Thu, 11 Sep 2003 15:14:02 +0100
Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:

>
> There is *one* change needed. We shouldnt call is_prefetch unless the
> current CPU is an Athlon. That way its a performance improvement for
> PIV, and Athlon in general, fixes the bug and causes no fancy athlon
> fixup code for non AMD processors.

I considered that when writing the patch, but: is_prefetch is a single byte
memory access for something already in cache. Checking for an Athlon
CPU needs two memory accesses in boot_cpu_data at least (checking vendor
and model)

So checking for Athlon first would be actually more expensive for other CPUs.

The switch is left in the noise, gcc compiles it to very efficient code.

This ignores the possibility of a recursive fault in the __get_user, but these
are rather unlikely. Normal page-on-demand code faults are handled
before is_prefetch is reached.

-Andi