Commit-ID:  c7faee2109f978f3ef826c48b7e60609061fda4f
Gitweb:     http://git.kernel.org/tip/c7faee2109f978f3ef826c48b7e60609061fda4f
Author:     Ingo Molnar <[email protected]>
AuthorDate: Thu, 3 Nov 2016 07:16:43 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Thu, 3 Nov 2016 07:21:12 +0100

locking/drm: Fix i915_gem_shrinker_lock() locking

Mike Krinkin reported hangs in the DRM code and bisected it to:

  3ab7c086d5ec72585ef0 ("locking/drm: Kill mutex trickery")

Hugh Dickins observed:

 "i915_gem_shrinker_lock() is broken: but copy the pattern from
  msm_gem_shrinker_lock() and it's okay - patch below."

Pick up the fix in isolation to make sure the bug is fixed, cleanup
patch will follow up.

Originally-From: Hugh Dickins <[email protected]>
Reported-by: Hugh Dickins <[email protected]>
Reported-by: Mike Krinkin <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Dave Airlie <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Paul E. McKenney <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: [email protected]
Cc: [email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem_shrinker.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_shrinker.c 
b/drivers/gpu/drm/i915/i915_gem_shrinker.c
index 3695375..e9bd2a8 100644
--- a/drivers/gpu/drm/i915/i915_gem_shrinker.c
+++ b/drivers/gpu/drm/i915/i915_gem_shrinker.c
@@ -228,8 +228,9 @@ unsigned long i915_gem_shrink_all(struct drm_i915_private 
*dev_priv)
 static bool i915_gem_shrinker_lock(struct drm_device *dev, bool *unlock)
 {
        if (!mutex_trylock(&dev->struct_mutex))
-               *unlock = false;
+               return false;
 
+       *unlock = true;
        return true;
 }
 

Reply via email to