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

From: Bill Davidsen
Date: Mon Sep 15 2003 - 13:23:45 EST


On Mon, 15 Sep 2003, Mikael Pettersson wrote:

> On Mon, 15 Sep 2003 08:11:12 -0400 (EDT), Bill Davidsen <davidsen@xxxxxxx> wrote:
> > On Mon, 15 Sep 2003, Alan Cox wrote:
> > > That disable you talk about is bloat. It also trashes the performance of
> > > PIV boxes. In fact I checked out of interest - the disable hack
> > > currently being used is adding *over* 300 bytes to my kernel as its
> > > inlined repeatedly. So its larger, and it ruins performance for all
> > > processors.
> >
> > The code to disable prefetch on Athlon is 300 bytes and hurts your PIV?
> > Really? I'll dig back through the code, but I recall it as adding or
> > deleting an entry in a table to enable prefetch. If it's affecting PIV the
> > code to use prefetch is seriously broken.
>
> Bill, look in include/asm-i386/processor.h:
>
> extern inline void prefetch(const void *x)
> {
> if (cpu_data[0].x86_vendor == X86_VENDOR_AMD)
> return; /* Some athlons fault if the address is bad */
> alternative_input(ASM_NOP4,
> "prefetchnta (%1)",
> X86_FEATURE_XMM,
> "r" (x));
> }
>
> A dynamic test at each occurrence. That's truly horrible.
> (And I'll hack it out of _my_ kernels ASAP. Can't imagine
> I missed that one.)

That's exactly the type of thing a MINIMAL_CODE flag could
drop unless Athlon support was enabled. However, the test should be at the
caller(s), to avoid a call/return in the first place.

To avoid really ugly source code it would probably be desirable to just
define a do_prefetch_if_supported() macro, and put any and all future
magic there. If the fix is used the test for AMD isn't needed, I would
just like to avoid having the test or the fix at all on my Intel systems.
And if I read correctly, that errata will be fixed in future Athlon CPUs,
so a better test will be needed anyway.

The code is appropriate for a generic X86 kernel, but not for one built to
one specific CPU. Everyone can be happy through the magin of Kconfig ;-)

--
bill davidsen <davidsen@xxxxxxx>
CTO, TMR Associates, Inc
Doing interesting things with little computers since 1979.

-
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/