From: Maarten Lankhorst <maarten.lankhorst@canonical.com>
To: Ingo Molnar <mingo@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Thomas Gleixner <tglx@linutronix.de>,
Andrew Morton <akpm@linux-foundation.org>,
Dave Airlie <airlied@gmail.com>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
Alex Deucher <alexander.deucher@amd.com>
Subject: [PATCH] mutex: fix deadlock injection
Date: Tue, 30 Jul 2013 10:13:41 +0200 [thread overview]
Message-ID: <51F775B5.201@canonical.com> (raw)
In-Reply-To: <20130705062345.GA29487@gmail.com>
The check needs to be for > 1, because ctx->acquired is already incremented.
This will prevent ww_mutex_lock_slow from returning -EDEADLK and not locking
the mutex. It caused a lot of false gpu lockups on radeon with
CONFIG_DEBUG_WW_MUTEX_SLOWPATH=y because a function that shouldn't be able
to return -EDEADLK did.
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
---
diff --git a/kernel/mutex.c b/kernel/mutex.c
index ff05f4b..a52ee7bb 100644
--- a/kernel/mutex.c
+++ b/kernel/mutex.c
@@ -686,7 +686,7 @@ __ww_mutex_lock(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
might_sleep();
ret = __mutex_lock_common(&lock->base, TASK_UNINTERRUPTIBLE,
0, &ctx->dep_map, _RET_IP_, ctx);
- if (!ret && ctx->acquired > 0)
+ if (!ret && ctx->acquired > 1)
return ww_mutex_deadlock_injection(lock, ctx);
return ret;
@@ -702,7 +702,7 @@ __ww_mutex_lock_interruptible(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
ret = __mutex_lock_common(&lock->base, TASK_INTERRUPTIBLE,
0, &ctx->dep_map, _RET_IP_, ctx);
- if (!ret && ctx->acquired > 0)
+ if (!ret && ctx->acquired > 1)
return ww_mutex_deadlock_injection(lock, ctx);
return ret;
next prev parent reply other threads:[~2013-07-30 8:13 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-01 8:22 [GIT PULL] core/mutexes changes for v3.11: W/W mutex support Ingo Molnar
2013-07-03 0:54 ` Linus Torvalds
2013-07-03 6:29 ` Maarten Lankhorst
2013-07-05 6:23 ` Ingo Molnar
2013-07-05 7:29 ` [PATCH] mutex: move ww_mutex definitions to ww_mutex.h Maarten Lankhorst
2013-07-12 13:28 ` [tip:core/locking] mutex: Move " tip-bot for Maarten Lankhorst
2013-07-30 8:13 ` Maarten Lankhorst [this message]
2013-07-30 8:41 ` [PATCH] mutex: fix deadlock injection Peter Zijlstra
2013-08-07 0:05 ` Dave Airlie
2013-08-07 6:22 ` Maarten Lankhorst
2013-07-30 13:09 ` Alex Deucher
2013-07-31 8:55 ` [tip:core/urgent] mutex: Fix w/w mutex " tip-bot for Maarten Lankhorst
2013-08-05 7:58 ` [PATCH] mutex: fix " Daniel Vetter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51F775B5.201@canonical.com \
--to=maarten.lankhorst@canonical.com \
--cc=a.p.zijlstra@chello.nl \
--cc=airlied@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=alexander.deucher@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).