[Intel-gfx] [PATCH 2/2] drm/i915: Drop any active reference before unbinding

Daniel Vetter daniel at ffwll.ch
Tue Sep 9 13:39:24 CEST 2014


On Tue, Sep 09, 2014 at 07:02:43AM +0100, Chris Wilson wrote:
> Before we process the final unbind on an object and move it to the
> unbound list, it is semantically cleaner if there are no more active
> references to the object. (An active reference would imply that it was
> still being accessed by the GPU after it became inaccessible.) The
> caveat is that all callsites must be prepared for the object to
> disappeared during the unbind - i.e. they must hold their own reference.
> 
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

Oh dear, more fuel for gem nightmares ;-)

Both patches merged to dinq, thanks a lot. Aside, git diff -b is awesome
for getting rid of indent changes in diffs. Just discovered that ...
-Daniel

> ---
>  drivers/gpu/drm/i915/i915_gem.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 4ca3a6dcf10b..f5362cabd921 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -2944,6 +2944,9 @@ int i915_vma_unbind(struct i915_vma *vma)
>  	 * cause memory corruption through use-after-free.
>  	 */
>  
> +	/* Throw away the active reference before moving to the unbound list */
> +	i915_gem_object_retire(obj);
> +
>  	if (i915_is_ggtt(vma->vm)) {
>  		i915_gem_object_finish_gtt(obj);
>  
> -- 
> 2.1.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch



More information about the Intel-gfx mailing list