Re: [PATCH] Mutilated form of Andi Kleen's AMD prefetch errata patch

Andi Kleen
2003-10-01T07:06:22Z

On Wed, Oct 01, 2003 at 12:00:15AM -0700, Andrew Morton wrote:
> Andi Kleen <ak@suse.de> wrote:
> >
> > Andrew Morton <akpm@osdl.org> writes:
> >
> > > Looking at Andi's patch, it is also a dead box if the fault happens inside
> > > down_write(mmap_sem). That should be fixed, methinks.
> >
> > The only way to fix all that would be to move the instruction checks early
> > into the fast path.
>
> Well the deadlock avoidance only needs to happen if the fault occured in
> kernel mode. Presumably most faults are in userspace, so most of the
> overhead can be avoided.

Hmm. I guess that's possible, but will be somewhat intrusive in
do_page_fault()

Also you have to be very careful to avoid recursive faults (EIP unmapped)
recursing further. In the original patch I did that for kernel mode by always
checking the exception table first to catch the __get_user in __is_prefetch
early.

Maybe it would be better to just use a down_read_timeout().

-Andi