[PATCH 20/20] own-evict

Chris Wilson chris at chris-wilson.co.uk
Thu Apr 16 20:17:16 UTC 2020


---
 .../gpu/drm/i915/gem/i915_gem_execbuffer.c    |  3 ---
 drivers/gpu/drm/i915/gt/intel_ggtt_fencing.c  | 19 +++----------------
 drivers/gpu/drm/i915/i915_vma.c               |  2 --
 3 files changed, 3 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
index 72564bd0a524..8d9cd991e442 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
@@ -1067,13 +1067,10 @@ static int __eb_bind_vma(struct eb_vm_work *work, int err)
 	if (!list_empty(&work->evict_list)) {
 		struct i915_vma *vma, *vn;
 
-		mutex_lock(&vm->mutex);
 		list_for_each_entry_safe(vma, vn, &work->evict_list, vm_link) {
-			GEM_BUG_ON(vma->vm != vm);
 			__i915_vma_evict(vma);
 			GEM_BUG_ON(!i915_vma_is_active(vma));
 		}
-		mutex_unlock(&vm->mutex);
 	}
 
 	/*
diff --git a/drivers/gpu/drm/i915/gt/intel_ggtt_fencing.c b/drivers/gpu/drm/i915/gt/intel_ggtt_fencing.c
index 734b6aa61809..7675e2e138a8 100644
--- a/drivers/gpu/drm/i915/gt/intel_ggtt_fencing.c
+++ b/drivers/gpu/drm/i915/gt/intel_ggtt_fencing.c
@@ -304,23 +304,10 @@ static int fence_update(struct i915_fence_reg *fence,
  */
 void i915_vma_revoke_fence(struct i915_vma *vma)
 {
-	struct i915_fence_reg *fence = vma->fence;
-	intel_wakeref_t wakeref;
-
-	lockdep_assert_held(&vma->vm->mutex);
-	if (!fence)
-		return;
+	struct i915_fence_reg *fence = READ_ONCE(vma->fence);
 
-	GEM_BUG_ON(fence->vma != vma);
-	GEM_BUG_ON(!i915_active_is_idle(&fence->active));
-	GEM_BUG_ON(atomic_read(&fence->pin_count));
-
-	fence->tiling = 0;
-	WRITE_ONCE(fence->vma, NULL);
-	vma->fence = NULL;
-
-	with_intel_runtime_pm_if_in_use(fence_to_uncore(fence)->rpm, wakeref)
-		fence_write(fence);
+	if (fence && cmpxchg(&fence->vma, vma, NULL))
+		vma->fence = NULL;
 }
 
 static struct i915_fence_reg *fence_find(struct i915_ggtt *ggtt)
diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c
index 690e43edd9e4..639ab10af952 100644
--- a/drivers/gpu/drm/i915/i915_vma.c
+++ b/drivers/gpu/drm/i915/i915_vma.c
@@ -858,8 +858,6 @@ static void vma_unbind_pages(struct i915_vma *vma)
 {
 	unsigned int count;
 
-	lockdep_assert_held(&vma->vm->mutex);
-
 	/* The upper portion of pages_count is the number of bindings */
 	count = atomic_read(&vma->pages_count);
 	count >>= I915_VMA_PAGES_BIAS;
-- 
2.20.1



More information about the Intel-gfx-trybot mailing list