[Intel-gfx] [PATCH 5/5] drm/i915: Avoid calling i915_gem_object_unbind holding object lock

Andi Shyti andi at etezian.org
Sat Dec 7 00:03:27 UTC 2019


Hi Chris,

[...]

> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_domain.c b/drivers/gpu/drm/i915/gem/i915_gem_domain.c
> index 808eb327a29b..53e28e417cc9 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_domain.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_domain.c
> @@ -187,21 +187,23 @@ int i915_gem_object_set_cache_level(struct drm_i915_gem_object *obj,
>  {
>  	int ret;
>  
> -	assert_object_held(obj);
> -
>  	if (obj->cache_level == cache_level)

you're checking here...

>  		return 0;
>  
> -	ret = i915_gem_object_unbind(obj, I915_GEM_OBJECT_UNBIND_ACTIVE);
> +	ret = i915_gem_object_lock_interruptible(obj);
>  	if (ret)
>  		return ret;
>  
> -	/* The cache-level will be applied when each vma is rebound. */
> +	/* Always invalidate stale cachelines */
> +	if (obj->cache_level != cache_level) {

... and here... you might want to get rid of this one?

Andi

> +		i915_gem_object_set_cache_coherency(obj, cache_level);
> +		obj->cache_dirty = true;
> +	}
>  
> -	i915_gem_object_set_cache_coherency(obj, cache_level);
> -	obj->cache_dirty = true; /* Always invalidate stale cachelines */
> +	i915_gem_object_unlock(obj);
>  
> -	return 0;
> +	/* The cache-level will be applied when each vma is rebound. */
> +	return i915_gem_object_unbind(obj, I915_GEM_OBJECT_UNBIND_ACTIVE);
>  }


More information about the Intel-gfx mailing list