Hi,
the lockdep selftests deliberately run broken locking patterns. On
PREEMPT_RT, some of those paths also leave task-local RT state behind, and
dotest() has to restore that state before the next testcase.
Patch 1 restores current->migration_disabled on all PREEMPT_RT builds.
The missing restore is visible with CONFIG_SMP=n as a pinned-lock warning,
"bad: scheduling from the idle thread!" and a panic after the selftests.
Patch 2 restores current->sched_rt_mutex after WW-mutex selftests. Without
that, stale RT-mutex scheduler state produces rt_mutex_pre_schedule()
warnings in later testcases.
Both changes are in dotest()'s PREEMPT_RT cleanup path in
lib/locking-selftest.c.
Tested on x86_64 QEMU with CONFIG_PREEMPT_RT=y,
CONFIG_DEBUG_LOCKING_API_SELFTESTS=y, CONFIG_LOCKDEP=y and
CONFIG_PROVE_LOCKING=y. Both CONFIG_SMP=n and CONFIG_SMP=y configurations
boot to userspace without the pinned-lock panic or rt_mutex_pre_schedule()
warnings.
Karl Mehltretter (2):
lockdep/selftests: Restore migrate_disable() state on PREEMPT_RT
lockdep/selftests: Restore sched_rt_mutex state on PREEMPT_RT
lib/locking-selftest.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)