[PATCH 2/6] drm/i915: Remove dying vmas from the gt->closed list

Thomas Hellström thomas.hellstrom at linux.intel.com
Fri Feb 4 21:58:18 UTC 2022


When traversing the gt->closed list we may have raced with a
vm_close or object_unreference operation which is destroying the vma,
and those dying vmas are left on the list for the racing operation to
remove.

Instead of keeping them on the list, just remove them, making the
code less fragile.

Signed-off-by: Thomas Hellström <thomas.hellstrom at linux.intel.com>
---
 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 9e1f7b224848..c5f5e893c27d 100644
--- a/drivers/gpu/drm/i915/i915_vma.c
+++ b/drivers/gpu/drm/i915/i915_vma.c
@@ -1693,10 +1693,13 @@ void i915_vma_parked(struct intel_gt *gt)
 
 		/* XXX All to avoid keeping a reference on i915_vma itself */
 
-		if (!kref_get_unless_zero(&obj->base.refcount))
+		if (!kref_get_unless_zero(&obj->base.refcount)) {
+			list_del_init(&vma->closed_link);
 			continue;
+		}
 
 		if (!i915_vm_tryopen(vm)) {
+			list_del_init(&vma->closed_link);
 			i915_gem_object_put(obj);
 			continue;
 		}
-- 
2.34.1



More information about the Intel-gfx-trybot mailing list