[GIT pull] locking/urgent for v6.11-rc7

Thomas Gleixner posted 1 patch 1 year, 5 months ago
kernel/locking/rtmutex.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
[GIT pull] locking/urgent for v6.11-rc7
Posted by Thomas Gleixner 1 year, 5 months ago
Linus,

please pull the latest locking/urgent branch from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git locking-urgent-2024-08-25

up to:  d33d26036a02: rtmutex: Drop rt_mutex::wait_lock before scheduling

A single fix for rt_mutex:

  The deadlock detection code drops into an infinite scheduling loop while
  still holding rt_mutex::wait_lock, which rightfully triggers a
  'scheduling in atomic' warning. Unlock it before that.


Thanks,

	tglx

------------------>
Roland Xu (1):
      rtmutex: Drop rt_mutex::wait_lock before scheduling


 kernel/locking/rtmutex.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c
index 88d08eeb8bc0..fba1229f1de6 100644
--- a/kernel/locking/rtmutex.c
+++ b/kernel/locking/rtmutex.c
@@ -1644,6 +1644,7 @@ static int __sched rt_mutex_slowlock_block(struct rt_mutex_base *lock,
 }
 
 static void __sched rt_mutex_handle_deadlock(int res, int detect_deadlock,
+					     struct rt_mutex_base *lock,
 					     struct rt_mutex_waiter *w)
 {
 	/*
@@ -1656,10 +1657,10 @@ static void __sched rt_mutex_handle_deadlock(int res, int detect_deadlock,
 	if (build_ww_mutex() && w->ww_ctx)
 		return;
 
-	/*
-	 * Yell loudly and stop the task right here.
-	 */
+	raw_spin_unlock_irq(&lock->wait_lock);
+
 	WARN(1, "rtmutex deadlock detected\n");
+
 	while (1) {
 		set_current_state(TASK_INTERRUPTIBLE);
 		rt_mutex_schedule();
@@ -1713,7 +1714,7 @@ static int __sched __rt_mutex_slowlock(struct rt_mutex_base *lock,
 	} else {
 		__set_current_state(TASK_RUNNING);
 		remove_waiter(lock, waiter);
-		rt_mutex_handle_deadlock(ret, chwalk, waiter);
+		rt_mutex_handle_deadlock(ret, chwalk, lock, waiter);
 	}
 
 	/*
Re: [GIT pull] locking/urgent for v6.11-rc7
Posted by pr-tracker-bot@kernel.org 1 year, 5 months ago
The pull request you sent on Sun,  1 Sep 2024 13:44:01 +0200 (CEST):

> git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git locking-urgent-2024-08-25

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/51859c5aa6daa96340a81a1ea2de1b48ccadccf1

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html