Re: [RFC PATCH 1/9] uaccess: Make copy_from_user_nmi() globally available

Peter Zijlstra
2010-10-13T07:16:35Z

On Wed, 2010-10-13 at 07:06 +0200, Frederic Weisbecker wrote:
> In order to support user stack dump safely in perf samples from
> generic code, export copy_from_user_nmi() from x86 and make it
> generally available. For most archs it will map to
> copy_from_user_inatomic, but for x86 we need to take care of
> not faulting from NMIs.
>
> Since perf is the first user for now, let the overriden x86
> implementation in the perf source file.

It might make sense to call it copy_from_user_gup() because that's
bascially what it does, it doesn't rely on NMI context anymore, its just
NMI-safe.

Its a best effort software page table walk, and with the stacked
kmap_atomic bits Andrew took it should work from any context.