mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Avi Weiss <thnkslprpt@gmail.com>
To: Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@redhat.com>
Cc: Will Deacon <will@kernel.org>, Boqun Feng <boqun@kernel.org>,
	Waiman Long <longman@redhat.com>,
	Thomas Gleixner <tglx@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] locking/rtmutex: Use EDEADLK for deadlock handling
Date: Sat, 31 Oct 2026 07:26:59 +0200	[thread overview]
Message-ID: <20261031052658.2863067-2-thnkslprpt@gmail.com> (raw)

rt_mutex_handle_deadlock() checks for -EDEADLOCK, but the rtmutex
deadlock paths return -EDEADLK. These values differ on MIPS,
PowerPC and SPARC, causing the handler to return without entering
the intended warning and scheduling loop.

Compare against -EDEADLK to handle the actual error.

Fixes: 3d5c9340d194 ("rtmutex: Handle deadlock detection smarter")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
---
 kernel/locking/rtmutex.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c
index 5a9534c715b8..e968e88834d8 100644
--- a/kernel/locking/rtmutex.c
+++ b/kernel/locking/rtmutex.c
@@ -1229,7 +1229,7 @@ static int __sched task_blocks_on_rt_mutex(struct rt_mutex_base *lock,
 	 * enqueue on itself just to untangle the mess later. It's not
 	 * only an optimization. We drop the locks, so another waiter
 	 * can come in before the chain walk detects the deadlock. So
-	 * the other will detect the deadlock and return -EDEADLOCK,
+	 * the other will detect the deadlock and return -EDEADLK,
 	 * which is wrong, as the other waiter is not in a deadlock
 	 * situation.
 	 *
@@ -1684,10 +1684,10 @@ static void __sched rt_mutex_handle_deadlock(int res, int detect_deadlock,
 	__must_hold(&lock->wait_lock)
 {
 	/*
-	 * If the result is not -EDEADLOCK or the caller requested
+	 * If the result is not -EDEADLK or the caller requested
 	 * deadlock detection, nothing to do here.
 	 */
-	if (res != -EDEADLOCK || detect_deadlock)
+	if (res != -EDEADLK || detect_deadlock)
 		return;
 
 	if (build_ww_mutex() && w->ww_ctx)

base-commit: 2a500a04d6f969318c05f46aedb6e73fc1963a00
-- 
2.43.0


                 reply	other threads:[~2026-10-31  5:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261031052658.2863067-2-thnkslprpt@gmail.com \
    --to=thnkslprpt@gmail.com \
    --cc=boqun@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@kernel.org \
    --cc=will@kernel.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

all inboxes | Powered by JetHome®