[Intel-gfx] [PATCH 22/42] drm/i915: Acquire the backing storage outside of struct_mutex in set-domain

Joonas Lahtinen joonas.lahtinen at linux.intel.com
Thu Oct 13 11:47:49 UTC 2016


On pe, 2016-10-07 at 10:46 +0100, Chris Wilson wrote:
> @@ -1499,25 +1523,40 @@ i915_gem_set_domain_ioctl(struct drm_device *dev, void *data,
>  				   MAX_SCHEDULE_TIMEOUT,
>  				   to_rps_client(file));
>  	if (ret)
> -		goto err;
> +		goto err_unlocked;
> +
> +	/* Flush and acquire obj->pages so that we are coherent through
> +	 * direct access in memory with previous cached writes through
> +	 * shmemfs and that our cache domain tracking remains valid.
> +	 * For example, if the obj->filp was moved to swap without us
> +	 * being notified and releasing the pages, we would mistakenly
> +	 * continue to assume that the obj remained out of the CPU cached
> +	 * domain.
> +	 */
> +	ret = i915_gem_object_pin_pages(obj);
> +	if (ret)
> +		goto err_unlocked;
>  
>  	ret = i915_mutex_lock_interruptible(dev);
>  	if (ret)
> -		goto err;
> +		goto err_pages;
>  
>  	if (read_domains & I915_GEM_DOMAIN_GTT)
>  		ret = i915_gem_object_set_to_gtt_domain(obj, write_domain != 0);
>  	else
>  		ret = i915_gem_object_set_to_cpu_domain(obj, write_domain != 0);
>  
> -	if (write_domain != 0)
> -		intel_fb_obj_invalidate(obj, write_origin(obj, write_domain));
> +	/* And bump the LRU for this access */
> +	i915_gem_object_bump_inactive_ggtt(obj);
>  
> -	i915_gem_object_put(obj);
>  	mutex_unlock(&dev->struct_mutex);
> -	return ret;
>  
> -err:
> +	if (write_domain != 0)
> +		intel_fb_obj_invalidate(obj, write_origin(obj, write_domain));
> +
> +err_pages:

out_pages: as it's a shared path now.

Code motion would still be great as separate patches.

Reviewed-by: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation


More information about the Intel-gfx mailing list