Commit 8567774e authored by Chris Wilson's avatar Chris Wilson

drm/i915/gt: Pin the rings before marking active

On eviction, we acquire the vm->mutex and then wait on the vma->active.
Therefore when binding and pinning the vma, we must follow the same
sequence, lock/pin the vma then mark it active. Otherwise, we mark the
vma as active, then wait for the vm->mutex, and meanwhile the evictor
holding the mutex waits upon us to complete our activity.

Fixes: 8ccfc20a ("drm/i915/gt: Mark ring->vma as active while pinned")
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: <stable@vger.kernel.org> # v5.6+
Reviewed-by: default avatarMatthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200706170138.8993-1-chris@chris-wilson.co.uk
parent 6f48fd8a
...@@ -204,25 +204,25 @@ static int __ring_active(struct intel_ring *ring) ...@@ -204,25 +204,25 @@ static int __ring_active(struct intel_ring *ring)
{ {
int err; int err;
err = i915_active_acquire(&ring->vma->active); err = intel_ring_pin(ring);
if (err) if (err)
return err; return err;
err = intel_ring_pin(ring); err = i915_active_acquire(&ring->vma->active);
if (err) if (err)
goto err_active; goto err_pin;
return 0; return 0;
err_active: err_pin:
i915_active_release(&ring->vma->active); intel_ring_unpin(ring);
return err; return err;
} }
static void __ring_retire(struct intel_ring *ring) static void __ring_retire(struct intel_ring *ring)
{ {
intel_ring_unpin(ring);
i915_active_release(&ring->vma->active); i915_active_release(&ring->vma->active);
intel_ring_unpin(ring);
} }
__i915_active_call __i915_active_call
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment