[Intel-gfx] [PATCH] drm/i915/evict: watch out for unevictable nodes

Matthew Auld matthew.auld at intel.com
Wed Apr 8 17:04:56 UTC 2020


In an address space there can be sprinkling of I915_COLOR_UNEVICTABLE
nodes, which lack a parent vma. For platforms with cache coloring we
might be very unlucky and abut with such a node thinking we can simply
unbind the vma.

Signed-off-by: Matthew Auld <matthew.auld at intel.com>
---
 drivers/gpu/drm/i915/i915_gem_evict.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_gem_evict.c b/drivers/gpu/drm/i915/i915_gem_evict.c
index 4518b9b35c3d..9e462c6a4c6a 100644
--- a/drivers/gpu/drm/i915/i915_gem_evict.c
+++ b/drivers/gpu/drm/i915/i915_gem_evict.c
@@ -227,6 +227,10 @@ i915_gem_evict_something(struct i915_address_space *vm,
 	}
 
 	while (ret == 0 && (node = drm_mm_scan_color_evict(&scan))) {
+		/* If we find any non-objects (!vma), we cannot evict them */
+		if (node->color == I915_COLOR_UNEVICTABLE)
+			return -ENOSPC;
+
 		vma = container_of(node, struct i915_vma, node);
 		ret = __i915_vma_unbind(vma);
 	}
-- 
2.20.1



More information about the Intel-gfx mailing list