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

Andi Kleen
2003-09-11T01:47:38Z

On Wed, Sep 10, 2003 at 06:44:14PM -0700, Andrew Morton wrote:
> Andi Kleen <ak@suse.de> wrote:
> >
> > +static int is_prefetch(struct pt_regs *regs, unsigned long addr)
>
> Can we make this code go away if the configured CPU is, say, Intel?
> (I couldn't find a sane CONFIG_ setting to use for this).

It could be done but ... we are moving more and more to generic kernels
(e.g. see the alternative patch code which is enabled unconditionally)
So that when you have a kernel it will boot on near all modern CPUs.
Currently Athlon and P4 kernels run on each other for example.

I would hate to break this again just to save a few hundred bytes in
this function. Also the overhead is very low so it is also not
interesting to make it conditional for speed reasons.

>
> It might be vaguely interesting to add a user-visible counter for this
> event? If someone somehow comes up with an application which hits the fault
> frequently they will take a big performance hit.

In that case they can just profile the kernel. is_prefetch should
show it then.

Of course someone can still add the counter if they want, I'm not
opposed to it.

-Andi