Commit 00de702c authored by Chris Wilson's avatar Chris Wilson

drm/i915: Check that the vma hasn't been closed before we insert it

As there is a delay before we pin a vma, there is an opportunity for
another thread to have closed the vm and its vma (including us).
Check as soon as we acquire the vm->mutex and know the vm/vma is stable.

Closes: https://gitlab.freedesktop.org/drm/intel/issues/1291Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarMatthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200221121940.2741563-1-chris@chris-wilson.co.uk
parent deeee411
...@@ -919,6 +919,11 @@ int i915_vma_pin(struct i915_vma *vma, u64 size, u64 alignment, u64 flags) ...@@ -919,6 +919,11 @@ int i915_vma_pin(struct i915_vma *vma, u64 size, u64 alignment, u64 flags)
if (err) if (err)
goto err_fence; goto err_fence;
if (unlikely(i915_vma_is_closed(vma))) {
err = -ENOENT;
goto err_unlock;
}
bound = atomic_read(&vma->flags); bound = atomic_read(&vma->flags);
if (unlikely(bound & I915_VMA_ERROR)) { if (unlikely(bound & I915_VMA_ERROR)) {
err = -ENOMEM; err = -ENOMEM;
......
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