mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-04 20:19:47 +08:00

'panic_print' was introduced to help debugging kernel panic by dumping different kinds of system information like tasks' call stack, memory, ftrace buffer, etc. Actually this function could also be used to help debugging other cases like task-hung, soft/hard lockup, etc. where user may need the snapshot of system info at that time. Extract system info dump function related code from panic.c to separate file sys_info.[ch], for wider usage by other kernel parts for debugging. Also modify the macro names about singulars/plurals. Link: https://lkml.kernel.org/r/20250703021004.42328-3-feng.tang@linux.alibaba.com Signed-off-by: Feng Tang <feng.tang@linux.alibaba.com> Suggested-by: Petr Mladek <pmladek@suse.com> Cc: John Ogness <john.ogness@linutronix.de> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Lance Yang <lance.yang@linux.dev> Cc: "Paul E . McKenney" <paulmck@kernel.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
33 lines
663 B
C
33 lines
663 B
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
#include <linux/sched/debug.h>
|
|
#include <linux/console.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/ftrace.h>
|
|
#include <linux/nmi.h>
|
|
|
|
#include <linux/sys_info.h>
|
|
|
|
void sys_info(unsigned long si_mask)
|
|
{
|
|
if (si_mask & SYS_INFO_TASKS)
|
|
show_state();
|
|
|
|
if (si_mask & SYS_INFO_MEM)
|
|
show_mem();
|
|
|
|
if (si_mask & SYS_INFO_TIMERS)
|
|
sysrq_timer_list_show();
|
|
|
|
if (si_mask & SYS_INFO_LOCKS)
|
|
debug_show_all_locks();
|
|
|
|
if (si_mask & SYS_INFO_FTRACE)
|
|
ftrace_dump(DUMP_ALL);
|
|
|
|
if (si_mask & SYS_INFO_ALL_CPU_BT)
|
|
trigger_all_cpu_backtrace();
|
|
|
|
if (si_mask & SYS_INFO_BLOCKED_TASKS)
|
|
show_state_filter(TASK_UNINTERRUPTIBLE);
|
|
}
|