[PATCH 94/94] drm/i915: Sync before taking vm->mutex on i915_vma_release

Chris Wilson chris at chris-wilson.co.uk
Thu Jul 30 23:22:40 UTC 2020


While we shouldn't be releasing an active vma anyway, push the
precautionary sync before we take the vm->mutex, just in case.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_vma.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c
index dedf753ffcc0..dbad360291a5 100644
--- a/drivers/gpu/drm/i915/i915_vma.c
+++ b/drivers/gpu/drm/i915/i915_vma.c
@@ -1157,10 +1157,13 @@ void i915_vma_release(struct kref *ref)
 	struct i915_vma *vma = container_of(ref, typeof(*vma), ref);
 
 	if (drm_mm_node_allocated(&vma->node)) {
+		i915_vma_sync(vma);
+
 		mutex_lock(&vma->vm->mutex);
 		atomic_and(~I915_VMA_PIN_MASK, &vma->flags);
-		WARN_ON(__i915_vma_unbind(vma));
+		GEM_WARN_ON(__i915_vma_unbind(vma));
 		mutex_unlock(&vma->vm->mutex);
+
 		GEM_BUG_ON(drm_mm_node_allocated(&vma->node));
 	}
 	GEM_BUG_ON(i915_vma_is_active(vma));
-- 
2.20.1



More information about the Intel-gfx-trybot mailing list