[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250507104322.30700-4-feng.tang@linux.alibaba.com>
Date: Wed, 7 May 2025 18:43:22 +0800
From: Feng Tang <feng.tang@...ux.alibaba.com>
To: Andrew Morton <akpm@...ux-foundation.org>,
Petr Mladek <pmladek@...e.com>,
Steven Rostedt <rostedt@...dmis.org>,
Lance Yang <ioworker0@...il.com>,
linux-kernel@...r.kernel.org
Cc: Feng Tang <feng.tang@...ux.alibaba.com>
Subject: [PATCH RFC 3/3] kernel/watchdog: add option to dump system info when system is locked up
Kernel panic code utilizes sys_show_info() to dump needed system
information to help debugging. Similarly, add this debug option for
software/hardware lockup cases, and 'lockup_print' is the knob to
control what information should be printed out.
Signed-off-by: Feng Tang <feng.tang@...ux.alibaba.com>
---
kernel/watchdog.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 9fa2af9dbf2c..60afcb0247ab 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -52,6 +52,14 @@ static int __read_mostly watchdog_hardlockup_available;
struct cpumask watchdog_cpumask __read_mostly;
unsigned long *watchdog_cpumask_bits = cpumask_bits(&watchdog_cpumask);
+/*
+ * A bitmask to control what kinds of system info to be printed when a
+ * software/hardware lockup is detected, it could be task, memory, lock etc.
+ * Refer panic.h for details of bit definition.
+ */
+unsigned long lockup_print;
+core_param(lockup_print, lockup_print, ulong, 0644);
+
#ifdef CONFIG_HARDLOCKUP_DETECTOR
# ifdef CONFIG_SMP
@@ -212,6 +220,7 @@ void watchdog_hardlockup_check(unsigned int cpu, struct pt_regs *regs)
clear_bit_unlock(0, &hard_lockup_nmi_warn);
}
+ sys_show_info(lockup_print);
if (hardlockup_panic)
nmi_panic(regs, "Hard LOCKUP");
@@ -774,6 +783,8 @@ static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer)
}
add_taint(TAINT_SOFTLOCKUP, LOCKDEP_STILL_OK);
+
+ sys_show_info(lockup_print);
if (softlockup_panic)
panic("softlockup: hung tasks");
}
--
2.39.5 (Apple Git-154)
Powered by blists - more mailing lists