[Intel-gfx] [PATCH 12/16] drm/i915: Reduce locking inside swfinish ioctl

Joonas Lahtinen joonas.lahtinen at linux.intel.com
Thu Aug 4 10:32:52 UTC 2016


On ma, 2016-08-01 at 19:22 +0100, Chris Wilson wrote:
>  	/* Pinned buffers may be scanout, so flush the cache */
> -	if (obj->pin_display)
> +	if (READ_ONCE(obj->pin_display)) {
> +		ret = i915_mutex_lock_interruptible(dev);
> +		if (ret)
> +			goto unref;

See below.

> +
>  		i915_gem_object_flush_cpu_write_domain(obj);
>  
> -	i915_gem_object_put(obj);
> -unlock:
> -	mutex_unlock(&dev->struct_mutex);
> +		i915_gem_object_put(obj);
> +		mutex_unlock(&dev->struct_mutex);
> +	} else {
> +		ret = 0;
> +unref:

No, nope, nein, ei, njet, inte, nack; this shall not pass.

Most inappropriate use of goto I've seen shortly.

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


More information about the Intel-gfx mailing list