drm/i915: Add a simple is-bound check before unbinding

Only acquire the various atomic references required to unbind the vma if
we do need to unbind the vma.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Acked-by: Imre Deak <imre.deak@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191222210256.2066451-1-chris@chris-wilson.co.uk
This commit is contained in:
Chris Wilson 2019-12-22 21:02:54 +00:00
parent 4941f35b48
commit f5af1659d8

View File

@ -138,6 +138,10 @@ try_again:
struct i915_address_space *vm = vma->vm; struct i915_address_space *vm = vma->vm;
bool awake = false; bool awake = false;
list_move_tail(&vma->obj_link, &still_in_list);
if (!i915_vma_is_bound(vma, I915_VMA_BIND_MASK))
continue;
ret = -EAGAIN; ret = -EAGAIN;
if (!i915_vm_tryopen(vm)) if (!i915_vm_tryopen(vm))
break; break;
@ -153,7 +157,6 @@ try_again:
} }
} }
list_move_tail(&vma->obj_link, &still_in_list);
spin_unlock(&obj->vma.lock); spin_unlock(&obj->vma.lock);
ret = -EBUSY; ret = -EBUSY;