[Intel-gfx] [PATCH] drm/i915: fix i915_gem_evict_something corner case

Jesse Barnes jbarnes at virtuousgeek.org
Fri Sep 11 23:30:28 CEST 2009


Owain pointed out a potential bug in i915_gem_evict_something.  In the
case where we get there without any buffers on the inactive list, we
may end up waiting on an outstanding request to finish.  If a request
does finish but doesn't end up on the inactive list, we can't assume
that a buffer has been freed and that space is available, since that
path doesn't actually free space (and since we're holding the struct
mutex at that point, no one else will have freed it either).

So remove the break, fixup the comment, and try flushing something
instead when we hit that case (looping back up to the top as necessary).

Reported-by: Owain Ainsworth <zerooa at googlemail.com>
Signed-off-by: Jesse Barnes <jbarnes at virtuousgeek.org>

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index f3758f9..ef4065f 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2003,13 +2003,10 @@ i915_gem_evict_something(struct drm_device *dev)
 				break;
 
 			/* if waiting caused an object to become inactive,
-			 * then loop around and wait for it. Otherwise, we
-			 * assume that waiting freed and unbound something,
-			 * so there should now be some space in the GTT
+			 * then loop around and wait for it.
 			 */
 			if (!list_empty(&dev_priv->mm.inactive_list))
 				continue;
-			break;
 		}
 
 		/* If we didn't have anything on the request list but there



More information about the Intel-gfx mailing list