summaryrefslogtreecommitdiff
path: root/kernel/panic.c
diff options
context:
space:
mode:
authorFeng Tang <feng.tang@intel.com>2024-02-02 21:20:42 +0800
committerAndrew Morton <akpm@linux-foundation.org>2024-02-22 15:38:55 -0800
commit2e3fc6ca521499a985a1829a21759ac25359c0f3 (patch)
tree52552999d8a198094d755328291be4cd13464c0e /kernel/panic.c
parentac4db926e17a669c788efc89b81a4a0f40648445 (diff)
panic: add option to dump blocked tasks in panic_print
For debugging kernel panics and other bugs, there is already an option of panic_print to dump all tasks' call stacks. On today's large servers running many containers, there could be thousands of tasks or more, and this will print out huge amount of call stacks, taking a lot of time (for serial console which is main target user case of panic_print). And in many cases, only those several tasks being blocked are key for the panic, so add an option to only dump blocked tasks' call stacks. [akpm@linux-foundation.org: clarify documentation a little] Link: https://lkml.kernel.org/r/20240202132042.3609657-1-feng.tang@intel.com Signed-off-by: Feng Tang <feng.tang@intel.com> Tested-by: Guilherme G. Piccoli <gpiccoli@igalia.com> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Josh Poimboeuf <jpoimboe@kernel.org> Cc: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'kernel/panic.c')
-rw-r--r--kernel/panic.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/panic.c b/kernel/panic.c
index d49b68184c56..d4cb86d97f8f 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -73,6 +73,7 @@ EXPORT_SYMBOL_GPL(panic_timeout);
#define PANIC_PRINT_FTRACE_INFO 0x00000010
#define PANIC_PRINT_ALL_PRINTK_MSG 0x00000020
#define PANIC_PRINT_ALL_CPU_BT 0x00000040
+#define PANIC_PRINT_BLOCKED_TASKS 0x00000080
unsigned long panic_print;
ATOMIC_NOTIFIER_HEAD(panic_notifier_list);
@@ -227,6 +228,9 @@ static void panic_print_sys_info(bool console_flush)
if (panic_print & PANIC_PRINT_FTRACE_INFO)
ftrace_dump(DUMP_ALL);
+
+ if (panic_print & PANIC_PRINT_BLOCKED_TASKS)
+ show_state_filter(TASK_UNINTERRUPTIBLE);
}
void check_panic_on_warn(const char *origin)