[Intel-gfx] [PATCH 08/12] drm/i915: Fix struct mutex vs. RPS lock inversion

Chris Wilson chris at chris-wilson.co.uk
Tue Feb 2 14:48:59 UTC 2016


On Tue, Feb 02, 2016 at 02:13:43PM +0000, Tvrtko Ursulin wrote:
> 
> On 02/02/16 13:16, Chris Wilson wrote:
> >On Tue, Feb 02, 2016 at 11:06:26AM +0000, Tvrtko Ursulin wrote:
> >>@@ -5244,8 +5243,10 @@ static void valleyview_cleanup_pctx(struct drm_device *dev)
> >>  	if (WARN_ON(!dev_priv->vlv_pctx))
> >>  		return;
> >>
> >>+	mutex_lock(&dev->struct_mutex);
> >>  	drm_gem_object_unreference(&dev_priv->vlv_pctx->base);
> >>  	dev_priv->vlv_pctx = NULL;
> >>+	mutex_unlock(&dev->struct_mutex);
> >
> >This made me smile.
> 
> Yeah mechanical- want unreference_unlocked instead?

_unlocked() has the advantage of not suggesting that dev_priv->vlv_pctx
needs to be part of the locked transaction (that's the bit that caused a
double take).

But it really doesn't matter.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list