]> git.baikalelectronics.ru Git - kernel.git/commit
drm/i915: Reorder context-close to avoid calling i915_vma_close() under RCU
authorChris Wilson <chris@chris-wilson.co.uk>
Thu, 9 Nov 2017 08:55:40 +0000 (08:55 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Thu, 9 Nov 2017 12:22:11 +0000 (12:22 +0000)
commit0dcdb144323dc646a3251514aaecb9f14a0dd4a4
tree03c4dd9c158414676bbbfa69e84924033570acea
parent4017dd7a35c225e1b52ca4360e6a9f5869adbbb9
drm/i915: Reorder context-close to avoid calling i915_vma_close() under RCU

When we close the VMA, we unbind it from the ppgtt and tear down the
page directory pointing at it. That may trigger us to return WC pages
back to the system, requiring conversion back to WB which itself may
sleep. That makes i915_vma_close() unsuitable for use inside the RCU
read lock, which we need to hold to iterate the radixtree.

The fix is quite simple, we can close all the VMA as we close the ppgtt,
we only need to do that instead of closing them during destruction of
the LUT.

v2: Order between closing the LUT and the ppgtt is important; we use the
vma inside the LUT as a means of retrieving the object, and so we must
clear the LUT before freeing the VMA when closing the ppgtt.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103638
Fixes: 8338ab164046 ("drm/i915: Hold rcu_read_lock when iterating over the radixtree (vma idr)")
Fixes: 579dfa61f85e ("drm/i915: Replace execbuf vma ht with an idr")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Matthew Auld <matthew.william.auld@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171109085540.32264-1-chris@chris-wilson.co.uk
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
drivers/gpu/drm/i915/i915_gem_context.c