From cd28b7a0e2154259a393b239365ff9b3f4ef8fb5 Mon Sep 17 00:00:00 2001 From: John Ogness Date: Mon, 18 Sep 2023 20:27:41 +0000 Subject: [PATCH 143/204] lockdep: Mark emergency section in lockdep splats Mark an emergency section within print_usage_bug(), where lockdep bugs are printed. In this section, the CPU will not perform console output for the printk() calls. Instead, a flushing of the console output will triggered when exiting the emergency section. Signed-off-by: John Ogness Signed-off-by: Sebastian Andrzej Siewior --- kernel/locking/lockdep.c | 5 +++++ 1 file changed, 5 insertions(+) Index: linux-6.6.58-rt45/kernel/locking/lockdep.c =================================================================== --- linux-6.6.58-rt45.orig/kernel/locking/lockdep.c +++ linux-6.6.58-rt45/kernel/locking/lockdep.c @@ -56,6 +56,7 @@ #include #include #include +#include #include @@ -3971,6 +3972,8 @@ print_usage_bug(struct task_struct *curr if (!debug_locks_off() || debug_locks_silent) return; + nbcon_cpu_emergency_enter(); + pr_warn("\n"); pr_warn("================================\n"); pr_warn("WARNING: inconsistent lock state\n"); @@ -3999,6 +4002,8 @@ print_usage_bug(struct task_struct *curr pr_warn("\nstack backtrace:\n"); dump_stack(); + + nbcon_cpu_emergency_exit(); } /*