All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Drop mutex after successful kref_put_mutex()
@ 2016-12-19 10:13 Chris Wilson
  2016-12-19 11:15 ` ✗ Fi.CI.BAT: warning for " Patchwork
  2016-12-19 11:38 ` [PATCH] " Joonas Lahtinen
  0 siblings, 2 replies; 4+ messages in thread
From: Chris Wilson @ 2016-12-19 10:13 UTC (permalink / raw)
  To: intel-gfx

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@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index ff58583ea757..68b8bf16de57 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -3519,9 +3519,10 @@ static inline void i915_gem_context_put(struct i915_gem_context *ctx)
 
 static inline void i915_gem_context_put_unlocked(struct i915_gem_context *ctx)
 {
-	kref_put_mutex(&ctx->ref,
-		       i915_gem_context_free,
-		       &ctx->i915->drm.struct_mutex);
+	struct mutex *lock = &ctx->i915->drm.struct_mutex;
+
+	if (kref_put_mutex(&ctx->ref, i915_gem_context_free, lock))
+		mutex_unlock(lock);
 }
 
 static inline struct intel_timeline *
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* ✗ Fi.CI.BAT: warning for drm/i915: Drop mutex after successful kref_put_mutex()
  2016-12-19 10:13 [PATCH] drm/i915: Drop mutex after successful kref_put_mutex() Chris Wilson
@ 2016-12-19 11:15 ` Patchwork
  2016-12-19 11:38 ` [PATCH] " Joonas Lahtinen
  1 sibling, 0 replies; 4+ messages in thread
From: Patchwork @ 2016-12-19 11:15 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Drop mutex after successful kref_put_mutex()
URL   : https://patchwork.freedesktop.org/series/16985/
State : warning

== Summary ==

Series 16985v1 drm/i915: Drop mutex after successful kref_put_mutex()
https://patchwork.freedesktop.org/api/1.0/series/16985/revisions/1/mbox/

Test drv_module_reload:
        Subgroup basic-reload-inject:
                dmesg-warn -> PASS       (fi-ilk-650)
Test kms_frontbuffer_tracking:
        Subgroup basic:
                pass       -> DMESG-WARN (fi-bxt-j4205)
Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-a:
                skip       -> PASS       (fi-bxt-j4205)
        Subgroup suspend-read-crc-pipe-b:
                skip       -> PASS       (fi-bxt-j4205)
        Subgroup suspend-read-crc-pipe-c:
                skip       -> PASS       (fi-bxt-j4205)
Test pm_backlight:
        Subgroup basic-brightness:
                skip       -> PASS       (fi-bxt-j4205)

fi-bdw-5557u     total:247  pass:233  dwarn:0   dfail:0   fail:0   skip:14 
fi-bsw-n3050     total:247  pass:208  dwarn:0   dfail:0   fail:0   skip:39 
fi-bxt-j4205     total:247  pass:225  dwarn:1   dfail:0   fail:0   skip:21 
fi-bxt-t5700     total:247  pass:220  dwarn:0   dfail:0   fail:0   skip:27 
fi-byt-j1900     total:247  pass:220  dwarn:0   dfail:0   fail:0   skip:27 
fi-byt-n2820     total:247  pass:216  dwarn:0   dfail:0   fail:0   skip:31 
fi-hsw-4770      total:247  pass:228  dwarn:0   dfail:0   fail:0   skip:19 
fi-hsw-4770r     total:247  pass:228  dwarn:0   dfail:0   fail:0   skip:19 
fi-ilk-650       total:247  pass:195  dwarn:0   dfail:0   fail:0   skip:52 
fi-ivb-3520m     total:247  pass:226  dwarn:0   dfail:0   fail:0   skip:21 
fi-ivb-3770      total:247  pass:226  dwarn:0   dfail:0   fail:0   skip:21 
fi-kbl-7500u     total:247  pass:226  dwarn:0   dfail:0   fail:0   skip:21 
fi-skl-6260u     total:247  pass:234  dwarn:0   dfail:0   fail:0   skip:13 
fi-skl-6700hq    total:247  pass:227  dwarn:0   dfail:0   fail:0   skip:20 
fi-skl-6700k     total:247  pass:224  dwarn:3   dfail:0   fail:0   skip:20 
fi-skl-6770hq    total:247  pass:234  dwarn:0   dfail:0   fail:0   skip:13 
fi-snb-2520m     total:247  pass:216  dwarn:0   dfail:0   fail:0   skip:31 
fi-snb-2600      total:247  pass:215  dwarn:0   dfail:0   fail:0   skip:32 

2a932d085375c80a1bbb332799db3df9738e8eba drm-tip: 2016y-12m-18d-16h-31m-05s UTC integration manifest
04f5e97 drm/i915: Drop mutex after successful kref_put_mutex()

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3324/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/i915: Drop mutex after successful kref_put_mutex()
  2016-12-19 10:13 [PATCH] drm/i915: Drop mutex after successful kref_put_mutex() Chris Wilson
  2016-12-19 11:15 ` ✗ Fi.CI.BAT: warning for " Patchwork
@ 2016-12-19 11:38 ` Joonas Lahtinen
  2016-12-19 11:50   ` Chris Wilson
  1 sibling, 1 reply; 4+ messages in thread
From: Joonas Lahtinen @ 2016-12-19 11:38 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx

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@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

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

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/i915: Drop mutex after successful kref_put_mutex()
  2016-12-19 11:38 ` [PATCH] " Joonas Lahtinen
@ 2016-12-19 11:50   ` Chris Wilson
  0 siblings, 0 replies; 4+ messages in thread
From: Chris Wilson @ 2016-12-19 11:50 UTC (permalink / raw)
  To: Joonas Lahtinen; +Cc: intel-gfx

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@chris-wilson.co.uk>
> > Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> 
> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@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
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-12-19 11:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-19 10:13 [PATCH] drm/i915: Drop mutex after successful kref_put_mutex() Chris Wilson
2016-12-19 11:15 ` ✗ Fi.CI.BAT: warning for " Patchwork
2016-12-19 11:38 ` [PATCH] " Joonas Lahtinen
2016-12-19 11:50   ` Chris Wilson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.