From patchwork Fri Sep 11 21:30:28 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Barnes X-Patchwork-Id: 47011 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n8BLUd3k019454 for ; Fri, 11 Sep 2009 21:30:39 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 014019E81A; Fri, 11 Sep 2009 14:30:39 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from outbound-mail-33.bluehost.com (outbound-mail-33.bluehost.com [69.89.18.153]) by gabe.freedesktop.org (Postfix) with SMTP id 7629E9E778 for ; Fri, 11 Sep 2009 14:30:37 -0700 (PDT) Received: (qmail 6865 invoked by uid 0); 11 Sep 2009 21:30:36 -0000 Received: from unknown (HELO box514.bluehost.com) (74.220.219.114) by outboundproxy2.bluehost.com with SMTP; 11 Sep 2009 21:30:36 -0000 Received: from [75.111.28.251] (helo=jbarnes-g45) by box514.bluehost.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69) (envelope-from ) id 1MmDhU-0003Qn-IJ; Fri, 11 Sep 2009 15:30:36 -0600 Date: Fri, 11 Sep 2009 14:30:28 -0700 From: Jesse Barnes To: intel-gfx@lists.freedesktop.org, eric@anholt.net, Owain Ainsworth Message-ID: <20090911143028.542c6dc4@jbarnes-g45> X-Mailer: Claws Mail 3.7.2 (GTK+ 2.17.5; i486-pc-linux-gnu) Mime-Version: 1.0 X-Identified-User: {10642:box514.bluehost.com:virtuous:virtuousgeek.org} {sentby:smtp auth 75.111.28.251 authed with jbarnes@virtuousgeek.org} Subject: [Intel-gfx] [PATCH] drm/i915: fix i915_gem_evict_something corner case X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.9 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org 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 Signed-off-by: Jesse Barnes 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