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@xxxxxxxxxxxxxxxxxx> > > Cc: Matthew Auld <matthew.william.auld@xxxxxxxxx> > > Cc: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx> > > Cc: <stable@xxxxxxxxxxxxxxx> # v4.9+ > > Reviewed-by: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx> > > 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