drm/i915: Revoke fenced GTT mmapings across GPU reset
authorChris Wilson <chris@chris-wilson.co.uk>
Wed, 4 Jan 2017 14:51:10 +0000 (14:51 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Wed, 4 Jan 2017 18:44:30 +0000 (18:44 +0000)
commitb1ed35d9179bc42c5ac7b86548cfae589be17b3e
tree83388fc33c306eb9655d2f5048d22f686b127724
parentfd7d6c5c8f3e46bf168c8560c842285c13ab7dd7
drm/i915: Revoke fenced GTT mmapings across GPU reset

The fence registers are clobbered by a GPU reset. If there is concurrent
user access to a fenced region via a GTT mmaping, the access will not be
fenced during the reset (until we restore the fences afterwards). In order
to prevent invalid access during the reset, before we clobber the fences
first we must invalidate the GTT mmapings. Access to the mmap will then
be forced to fault in the page, and in handling the fault, i915_gem_fault()
will take the struct_mutex and wait upon the reset to complete.

v2: Fix up commentary.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99274
Testcase: igt/gem_mmap_gtt/hang
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/20170104145110.1486-1-chris@chris-wilson.co.uk
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
drivers/gpu/drm/i915/i915_drv.c
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/i915_gem_fence_reg.c