[Intel-gfx] [PATCH 2/2] drm/i915: Disable page-faults around the fast pwrite/pread paths
Eric Anholt
eric at anholt.net
Sat Jul 9 16:41:57 CEST 2011
On Sat, 9 Jul 2011 09:38:51 +0100, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> These paths hold onto the struct mutex whilst accessing pages. In
> order, to prevent a recursive dead-lock should we fault-in a GTT mapped
> page we need to return -EFAULT and fallback to the slow path.
>
> Lockdep has complained before about the potential dead-lock, but rvis is
> the first application found to sufficiently abuse the API to trigger it.
>
> Cursory performance regression testing on a 1GiB PineView system using
> x11perf, cairo-perf-trace, glxgears and a few game benchmarks suggested
> no large regressions with just a 2% slowdown for firefox. The caveat is
> that this was an otherwise idle system and that for 32-bit systems
> io_mapping_map_atomic_wc() already disabled page-faults.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38115
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> ---
> drivers/gpu/drm/i915/i915_gem.c | 22 ++++++++++++++++++++--
> 1 files changed, 20 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 2fce620..ecb27fd 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> - vaddr = kmap_atomic(page, KM_USER0);
> + vaddr = kmap_atomic(page);
> + /* We have to disable faulting here in case the user address
> + * is really a GTT mapping and so we can not enter
> + * i915_gem_fault() whilst already holding struct_mutex.
> + */
> + pagefault_disable();
> ret = __copy_from_user_inatomic(vaddr + page_offset,
> user_data,
> page_length);
> - kunmap_atomic(vaddr, KM_USER0);
> + pagefault_enable();
> + kunmap_atomic(vaddr);
does this even compile? Looks like you dropped an arg.
Looks like a reasonable fix for the problem, though.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/intel-gfx/attachments/20110709/efcd7d96/attachment.sig>
More information about the Intel-gfx
mailing list