[Intel-gfx] [PATCH 6/8] drm/i915: add struct_mutex WARNs to i915_gem_stolen.c

Chris Wilson chris at chris-wilson.co.uk
Tue Jun 30 07:15:33 PDT 2015


On Tue, Jun 30, 2015 at 10:53:10AM -0300, Paulo Zanoni wrote:
> From: Paulo Zanoni <paulo.r.zanoni at intel.com>
> 
> Let's make sure the future Paulos don't forget that we need
> struct_mutex when touching dev_priv->mm.stolen.
> 
> Signed-off-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
> ---
>  drivers/gpu/drm/i915/i915_gem_stolen.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
> index 793bcba..cac1bce 100644
> --- a/drivers/gpu/drm/i915/i915_gem_stolen.c
> +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
> @@ -160,6 +160,8 @@ static int find_compression_threshold(struct drm_device *dev,
>  	int compression_threshold = 1;
>  	int ret;
>  
> +	WARN_ON(!mutex_is_locked(&dev->struct_mutex));

I'm not a huge fan of vague mutex warnings that don't even check the owner.
I'm espcially not a fan of adding a WARN and not handling the error.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list