[Intel-gfx] [PATCH 2/3] drm/i915: Retire after wait-for-idle on evict

Chris Wilson chris at chris-wilson.co.uk
Sun Oct 8 13:43:21 UTC 2017


We have to manually retire the requests in order to unpin the contexts,
and thereby make their space available in the GGTT. So call retire after
we idle the GPU to account for the lazy pinning.

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

diff --git a/drivers/gpu/drm/i915/i915_gem_evict.c b/drivers/gpu/drm/i915/i915_gem_evict.c
index 4df039ef2ce3..fc7e476448e3 100644
--- a/drivers/gpu/drm/i915/i915_gem_evict.c
+++ b/drivers/gpu/drm/i915/i915_gem_evict.c
@@ -157,17 +157,18 @@ i915_gem_evict_something(struct i915_address_space *vm,
 				    min_size, alignment, cache_level,
 				    start, end, mode);
 
-	/* Retire before we search the active list. Although we have
+	/*
+	 * Retire before we search the active list. Although we have
 	 * reasonable accuracy in our retirement lists, we may have
 	 * a stray pin (preventing eviction) that can only be resolved by
 	 * retiring.
 	 */
+search_again:
 	if (!(flags & PIN_NONBLOCK))
 		i915_gem_retire_requests(dev_priv);
 	else
 		phases[1] = NULL;
 
-search_again:
 	INIT_LIST_HEAD(&eviction_list);
 	phase = phases;
 	do {
@@ -380,6 +381,8 @@ int i915_gem_evict_vm(struct i915_address_space *vm)
 		ret = ggtt_flush(vm->i915);
 		if (ret)
 			return ret;
+
+		i915_gem_retire_requests(vm->i915);
 	}
 
 	INIT_LIST_HEAD(&eviction_list);
-- 
2.14.2



More information about the Intel-gfx mailing list