From: "tip-bot2 for Karl Mehltretter" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Karl Mehltretter <kmehltretter@gmail.com>,
"Peter Zijlstra (Intel)" <peterz@infradead.org>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: locking/core] lockdep/selftests: Restore migrate_disable() state on PREEMPT_RT
Date: Wed, 03 Jun 2026 14:25:14 -0000 [thread overview]
Message-ID: <178049671424.710.9993597816881772724.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20260523185123.17482-2-kmehltretter@gmail.com>
The following commit has been merged into the locking/core branch of tip:
Commit-ID: d8c897b20bf4d4cbb1e935a8ceb666bcc0f82580
Gitweb: https://git.kernel.org/tip/d8c897b20bf4d4cbb1e935a8ceb666bcc0f82580
Author: Karl Mehltretter <kmehltretter@gmail.com>
AuthorDate: Sat, 23 May 2026 20:51:22 +02:00
Committer: Peter Zijlstra <peterz@infradead.org>
CommitterDate: Wed, 03 Jun 2026 11:38:47 +02:00
lockdep/selftests: Restore migrate_disable() state on PREEMPT_RT
The lockdep selftests deliberately run unbalanced locking patterns.
dotest() restores the task state they leave behind before running the
next testcase.
On PREEMPT_RT, spin_lock() uses migrate_disable() instead of disabling
preemption. dotest() cleans up the resulting migration-disabled state, but
that cleanup is still guarded by CONFIG_SMP.
That used to match the scheduler data model, where migration_disabled was
also CONFIG_SMP-only. The commit referenced below made SMP scheduler state
unconditional, so CONFIG_SMP=n PREEMPT_RT kernels with
CONFIG_DEBUG_LOCKING_API_SELFTESTS=y report success from the selftests and
then trip over stale current->migration_disabled state:
releasing a pinned lock
bad: scheduling from the idle thread!
Kernel panic - not syncing: Fatal exception
Save and restore current->migration_disabled for every PREEMPT_RT build.
Fixes: cac5cefbade9 ("sched/smp: Make SMP unconditional")
Assisted-by: Codex:gpt-5
Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Link: https://patch.msgid.link/20260523185123.17482-2-kmehltretter@gmail.com
---
lib/locking-selftest.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/lib/locking-selftest.c b/lib/locking-selftest.c
index d939403..cb806b6 100644
--- a/lib/locking-selftest.c
+++ b/lib/locking-selftest.c
@@ -1431,9 +1431,7 @@ static void dotest(void (*testcase_fn)(void), int expected, int lockclass_mask)
{
int saved_preempt_count = preempt_count();
#ifdef CONFIG_PREEMPT_RT
-#ifdef CONFIG_SMP
int saved_mgd_count = current->migration_disabled;
-#endif
int saved_rcu_count = current->rcu_read_lock_nesting;
#endif
@@ -1471,10 +1469,8 @@ static void dotest(void (*testcase_fn)(void), int expected, int lockclass_mask)
preempt_count_set(saved_preempt_count);
#ifdef CONFIG_PREEMPT_RT
-#ifdef CONFIG_SMP
while (current->migration_disabled > saved_mgd_count)
migrate_enable();
-#endif
while (current->rcu_read_lock_nesting > saved_rcu_count)
rcu_read_unlock();
next prev parent reply other threads:[~2026-06-03 14:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-23 18:51 [PATCH 0/2] lockdep/selftests: Restore PREEMPT_RT task state Karl Mehltretter
2026-05-23 18:51 ` [PATCH 1/2] lockdep/selftests: Restore migrate_disable() state on PREEMPT_RT Karl Mehltretter
2026-06-03 14:25 ` tip-bot2 for Karl Mehltretter [this message]
2026-05-23 18:51 ` [PATCH 2/2] lockdep/selftests: Restore sched_rt_mutex " Karl Mehltretter
2026-06-03 14:25 ` [tip: locking/core] " tip-bot2 for Karl Mehltretter
2026-06-01 8:43 ` [PATCH 0/2] lockdep/selftests: Restore PREEMPT_RT task state Sebastian Andrzej Siewior
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=178049671424.710.9993597816881772724.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=bigeasy@linutronix.de \
--cc=kmehltretter@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=x86@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®