[Intel-gfx] [PATCH] drm/i915: Drop mutex after successful kref_put_mutex()
Chris Wilson
chris at chris-wilson.co.uk
Mon Dec 19 11:50:23 UTC 2016
On Mon, Dec 19, 2016 at 01:38:13PM +0200, Joonas Lahtinen wrote:
> On ma, 2016-12-19 at 10:13 +0000, Chris Wilson wrote:
> > The kref_put_mutex() returns with the mutex held after freeing the
> > object - so we must remember to drop it...
> >
> > Fixes: 69df05e11ab8 ("drm/i915: Simplify releasing context reference")
> > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> > Cc: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
>
> Reviewed-by: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
Ta, wish I remembered the sting in its tail.
Does a unittest such as:
struct i915_gem_context *ctx;
mutex_lock(&struct_mutex);
ctx = i915_gem_context_create();
mutex_unlock(&struct_mutex);
i915_gem_context_put_unlocked(ctx);
might_lock(&strct_mutex);
Make sense? Feels a little too much like bolting the stable door and not
likely to detect a future bug.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the Intel-gfx
mailing list