[Intel-gfx] [PATCH 3/3] drm/i915: Remove the vma from the drm_mm if binding fails

Chris Wilson chris at chris-wilson.co.uk
Mon Feb 27 12:06:06 UTC 2017


On Mon, Feb 27, 2017 at 02:02:00PM +0200, Joonas Lahtinen wrote:
> 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 <chris at chris-wilson.co.uk>
> > Cc: Matthew Auld <matthew.william.auld at gmail.com>
> > Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
> > Cc: <stable at vger.kernel.org> # v4.9+
> 
> Reviewed-by: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
> 
> 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.

Done: if ((bound & I915_VMA_BIND_MASK) == 0) and made bound const to be
clear.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list