From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com ([134.134.136.31]:61522 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751722AbdB0MR2 (ORCPT ); Mon, 27 Feb 2017 07:17:28 -0500 Message-ID: <1488196920.3324.6.camel@linux.intel.com> Subject: Re: [PATCH 3/3] drm/i915: Remove the vma from the drm_mm if binding fails From: Joonas Lahtinen To: Chris Wilson , intel-gfx@lists.freedesktop.org Cc: Matthew Auld , "# v4 . 9+" Date: Mon, 27 Feb 2017 14:02:00 +0200 In-Reply-To: <20170225232536.2277-3-chris@chris-wilson.co.uk> References: <20170225232536.2277-1-chris@chris-wilson.co.uk> <20170225232536.2277-3-chris@chris-wilson.co.uk> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org List-ID: On la, 2017-02-25 at 23:25 +0000, Chris Wilson wrote: > As we track whether a vma has been inserted into the drm_mm using the > vma->flags, if we fail to bind the vma into the GTT we do not update > those bits and will attempt to reinsert the vma into the drm_mm on > future passes. To prevent that, we want to unwind i915_vma_insert() if > we fail in our attempt to bind. > > Fixes: 59bfa1248e22 ("drm/i915: Start passing around i915_vma from execbuffer") > Testcase: igt/drv_selftest/live_gtt > Signed-off-by: Chris Wilson > Cc: Matthew Auld > Cc: Joonas Lahtinen > Cc: # v4.9+ Reviewed-by: Joonas Lahtinen One note below. > @@ -541,7 +566,12 @@ int __i915_vma_do_pin(struct i915_vma *vma, >   GEM_BUG_ON(i915_vma_misplaced(vma, size, alignment, flags)); >   return 0; >   > -err: > +err_remove: > + if ((vma->flags & I915_VMA_BIND_MASK) == 0) { This condition could be more symmetric. Regards, Joonas > + GEM_BUG_ON(vma->pages); > + i915_vma_remove(vma); > + } > +err_unpin: >   __i915_vma_unpin(vma); >   return ret; >  } -- Joonas Lahtinen Open Source Technology Center Intel Corporation