[PATCH 7/7] HAX: drm/i915: Don't call evict_dead on dead vmas

Thomas Hellström thomas.hellstrom at linux.intel.com
Fri Jan 14 12:53:18 UTC 2022


Calling evict_dead will corrupt the vm_bound list. Instead,
force unpin the vma and add it to the locked_eviction_list for
slightly deferred eviction.

Signed-off-by: Thomas Hellström <thomas.hellstrom at linux.intel.com>
---
 drivers/gpu/drm/i915/i915_gem_evict.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_evict.c b/drivers/gpu/drm/i915/i915_gem_evict.c
index 2367902f6ac1..f7b2e8db24d7 100644
--- a/drivers/gpu/drm/i915/i915_gem_evict.c
+++ b/drivers/gpu/drm/i915/i915_gem_evict.c
@@ -111,12 +111,6 @@ static bool defer_evict(struct i915_vma *vma)
 	return false;
 }
 
-static int evict_dead(struct i915_vma *vma)
-{
-	atomic_and(~I915_VMA_PIN_MASK, &vma->flags);
-	return __i915_vma_unbind(vma);
-}
-
 /**
  * i915_gem_evict_something - Evict vmas to make room for binding a new one
  * @vm: address space to evict from
@@ -452,9 +446,10 @@ int i915_gem_evict_vm(struct i915_address_space *vm, struct i915_gem_ww_ctx *ww)
 
 		list_for_each_entry(vma, &vm->bound_list, vm_link) {
 			if (dying_vma(vma)) {
-				ret = evict_dead(vma);
-				if (ret)
-					break;
+				atomic_and(~I915_VMA_PIN_MASK, &vma->flags);
+				list_add(&vma->evict_link, &locked_eviction_list);
+				__i915_vma_pin(vma);
+				continue;
 			}
 
 			if (i915_vma_is_pinned(vma))
-- 
2.31.1



More information about the Intel-gfx-trybot mailing list