From nobody Wed Dec 17 08:56:25 2025 Received: from out30-133.freemail.mail.aliyun.com (out30-133.freemail.mail.aliyun.com [115.124.30.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C6CFF13774D for ; Sun, 11 May 2025 08:53:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.133 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746953590; cv=none; b=FyHHW0LSLV7f84cVvATsZIYBoMyXkdlIrGMnz+XbyrRz1gzU/5wKdPJocJ3DAOHc7bBvTaNXK8jXplFmGb9giUeN1H7aGkNCIWLcrGnlDx0D/KlwFiNwIFow/mLClOmZ33kThbwYZFmRztyrtVIszVu44dy1eiwCidIT+tPXCZA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746953590; c=relaxed/simple; bh=pQMJWVRUMVyvz7B2ekqfQBMAivgPV7lC6XIAofMoIUI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=EmuT16HyVW6EQ69CQL0Zmo4qZ6dr7zElpO7JU9BZYkSEoj/zuopWgDeTXQUhqWVnMeOJbOZBtjANhMPrPvfkXhBt1/lHx6SdKmeoygVNC/IhJWd3Fpz4oYPZL5JPN8BbUrBkPwqCysQC3pK+GhLWbFZAm+MmH0wdlUX/730MJ3o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=X/dLATPf; arc=none smtp.client-ip=115.124.30.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="X/dLATPf" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1746953578; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=3CD7z4IGopA0PcdO/426rEdhCuUyvCsxsp/UIYP1hKs=; b=X/dLATPfLsGdrYqawcopouSnV1JcsiILXvmVJ0uPzWJ+M/Cad8H8bPZ43gET6VuT2yv4n+vgllyYiv4v/7o0hkwzFTqA4x996grXfrhIa90mkE0HB2zgch1ZcrewVc9jqz5Vent8CfPjfoEwfLTrPsn7Yyi1G/eiW031qwkTe1I= Received: from localhost(mailfrom:feng.tang@linux.alibaba.com fp:SMTPD_---0WaABizR_1746953577 cluster:ay36) by smtp.aliyun-inc.com; Sun, 11 May 2025 16:52:58 +0800 From: Feng Tang To: Andrew Morton , Petr Mladek , Steven Rostedt , Lance Yang , linux-kernel@vger.kernel.org Cc: mhiramat@kernel.org, llong@redhat.com, Feng Tang Subject: [PATCH v1 1/3] kernel/panic: generalize panic_print's function to show sys info Date: Sun, 11 May 2025 16:52:52 +0800 Message-Id: <20250511085254.61446-2-feng.tang@linux.alibaba.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20250511085254.61446-1-feng.tang@linux.alibaba.com> References: <20250511085254.61446-1-feng.tang@linux.alibaba.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" panic_print was introduced to help debugging kernel panic by dumping different kinds of system information like tasks' call stack, memory, ftrace buffer etc. Acutually this function could help debugging cases like task-hung, soft/hard lockup too, where user may need the snapshot of system info at that time. Extract sys_show_info() function out to be used by other kernel parts for debugging. Signed-off-by: Feng Tang --- include/linux/panic.h | 11 ++++++++++ kernel/panic.c | 47 +++++++++++++++++++++++-------------------- 2 files changed, 36 insertions(+), 22 deletions(-) diff --git a/include/linux/panic.h b/include/linux/panic.h index 2494d51707ef..bb1796b64381 100644 --- a/include/linux/panic.h +++ b/include/linux/panic.h @@ -16,6 +16,17 @@ extern void oops_enter(void); extern void oops_exit(void); extern bool oops_may_print(void); =20 +#define SYS_PRINT_TASK_INFO 0x00000001 +#define SYS_PRINT_MEM_INFO 0x00000002 +#define SYS_PRINT_TIMER_INFO 0x00000004 +#define SYS_PRINT_LOCK_INFO 0x00000008 +#define SYS_PRINT_FTRACE_INFO 0x00000010 +#define SYS_PRINT_ALL_PRINTK_MSG 0x00000020 +#define SYS_PRINT_ALL_CPU_BT 0x00000040 +#define SYS_PRINT_BLOCKED_TASKS 0x00000080 + +extern void sys_show_info(unsigned long info_mask); + extern bool panic_triggering_all_cpu_backtrace; extern int panic_timeout; extern unsigned long panic_print; diff --git a/kernel/panic.c b/kernel/panic.c index a3889f38153d..2542ae3702f9 100644 --- a/kernel/panic.c +++ b/kernel/panic.c @@ -69,14 +69,6 @@ bool panic_triggering_all_cpu_backtrace; int panic_timeout =3D CONFIG_PANIC_TIMEOUT; EXPORT_SYMBOL_GPL(panic_timeout); =20 -#define PANIC_PRINT_TASK_INFO 0x00000001 -#define PANIC_PRINT_MEM_INFO 0x00000002 -#define PANIC_PRINT_TIMER_INFO 0x00000004 -#define PANIC_PRINT_LOCK_INFO 0x00000008 -#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; =20 ATOMIC_NOTIFIER_HEAD(panic_notifier_list); @@ -208,33 +200,44 @@ void nmi_panic(struct pt_regs *regs, const char *msg) } EXPORT_SYMBOL(nmi_panic); =20 -static void panic_print_sys_info(bool console_flush) +void sys_show_info(unsigned long info_mask) { - if (console_flush) { - if (panic_print & PANIC_PRINT_ALL_PRINTK_MSG) - console_flush_on_panic(CONSOLE_REPLAY_ALL); - return; - } - - if (panic_print & PANIC_PRINT_TASK_INFO) + if (info_mask & SYS_PRINT_TASK_INFO) show_state(); =20 - if (panic_print & PANIC_PRINT_MEM_INFO) + if (info_mask & SYS_PRINT_MEM_INFO) show_mem(); =20 - if (panic_print & PANIC_PRINT_TIMER_INFO) + if (info_mask & SYS_PRINT_TIMER_INFO) sysrq_timer_list_show(); =20 - if (panic_print & PANIC_PRINT_LOCK_INFO) + if (info_mask & SYS_PRINT_LOCK_INFO) debug_show_all_locks(); =20 - if (panic_print & PANIC_PRINT_FTRACE_INFO) + if (info_mask & SYS_PRINT_FTRACE_INFO) ftrace_dump(DUMP_ALL); =20 - if (panic_print & PANIC_PRINT_BLOCKED_TASKS) + if (panic_print & SYS_PRINT_ALL_PRINTK_MSG) + console_flush_on_panic(CONSOLE_REPLAY_ALL); + + if (info_mask & SYS_PRINT_ALL_CPU_BT) + trigger_all_cpu_backtrace(); + + if (info_mask & SYS_PRINT_BLOCKED_TASKS) show_state_filter(TASK_UNINTERRUPTIBLE); } =20 +static void panic_print_sys_info(bool console_flush) +{ + if (console_flush) { + if (panic_print & SYS_PRINT_ALL_PRINTK_MSG) + console_flush_on_panic(CONSOLE_REPLAY_ALL); + return; + } + + sys_show_info(panic_print & ~SYS_PRINT_ALL_PRINTK_MSG); +} + void check_panic_on_warn(const char *origin) { unsigned int limit; @@ -255,7 +258,7 @@ void check_panic_on_warn(const char *origin) */ static void panic_other_cpus_shutdown(bool crash_kexec) { - if (panic_print & PANIC_PRINT_ALL_CPU_BT) { + if (panic_print & SYS_PRINT_ALL_CPU_BT) { /* Temporary allow non-panic CPUs to write their backtraces. */ panic_triggering_all_cpu_backtrace =3D true; trigger_all_cpu_backtrace(); --=20 2.39.5 (Apple Git-154) From nobody Wed Dec 17 08:56:25 2025 Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 240E1194A73 for ; Sun, 11 May 2025 08:53:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746953590; cv=none; b=MKuwQqu7rUdNNxsHnsFPSZkBQBdKpv7wwwqNzQhdezhBLgfcYrFTrdigGSws0VUB5JDm5WgB+dKuYtbKYWkoai2qJ3KzU7UDR7D7YLtpu83s9YBgGA8dZvan86lMF4+wQhjCL+ZiBFUu9AsvwtICanhqRiAM4B+Pn3I9UYy33oA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746953590; c=relaxed/simple; bh=kzI+MuQkJcTTyCmrVNWQ/8SgYRK5zQJZsGidEdOxkeM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=tuRBc2PcD1YjpdomN/JgFKsPyZ+kq7fXpsu0Or9Utj7glriC6nic5+fb/y3FW+r2AZp+ZHfduWCYhFOA4mVtkVWudCDEb6shYjWOOwOKXJs4vJDr3Jdgq2MuMRrxxrNk4J6EJFp9yyo0A9EwDHO9VmyW7rXcfTAjmCe0Ayj6diw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=R1+J9Ueb; arc=none smtp.client-ip=115.124.30.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="R1+J9Ueb" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1746953580; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=J+Izptv443yw1YuFeuFq9CG1fp5LXsIrzm6WXIAqqRI=; b=R1+J9Uebuq5t2GBe8JPDRTmxeP+BgHUHtIrQUMy94iQYua+OAGpCdDIKQBa+2vnhuO3+RwHkQ2dOQQOL17nxwRvudi4GiSXHNCnNCciA0k9DL/qSDIyeAD/lsdfVvRGlNwlCfjIC4lugnaeosTLX4iMUT+z/pby9jl8Ha2eRAtM= Received: from localhost(mailfrom:feng.tang@linux.alibaba.com fp:SMTPD_---0WaA7MWV_1746953578 cluster:ay36) by smtp.aliyun-inc.com; Sun, 11 May 2025 16:52:59 +0800 From: Feng Tang To: Andrew Morton , Petr Mladek , Steven Rostedt , Lance Yang , linux-kernel@vger.kernel.org Cc: mhiramat@kernel.org, llong@redhat.com, Feng Tang Subject: [PATCH v1 2/3] kernel/hung_task: add option to dump system info when hung task detected Date: Sun, 11 May 2025 16:52:53 +0800 Message-Id: <20250511085254.61446-3-feng.tang@linux.alibaba.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20250511085254.61446-1-feng.tang@linux.alibaba.com> References: <20250511085254.61446-1-feng.tang@linux.alibaba.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Kernel panic code utilizes sys_show_info() to dump needed system information to help debugging. Similarly, add this debug option for task hung case, and 'hungtask_print_mask' is the control knob and a bitmask to control what information should be printed out: bit 0: print all tasks info bit 1: print system memory info bit 2: print timer info bit 3: print locks info if CONFIG_LOCKDEP is on bit 4: print ftrace buffer bit 5: print all printk messages in buffer bit 6: print all CPUs backtrace (if available in the arch) bit 7: print only tasks in uninterruptible (blocked) state Also simplify the code about dumping locks and triggering backtrace for all CPUs by leveraging sys_show_info(). Signed-off-by: Feng Tang --- .../admin-guide/kernel-parameters.txt | 5 +++ kernel/hung_task.c | 42 +++++++++++++------ 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentatio= n/admin-guide/kernel-parameters.txt index d9fd26b95b34..d35d8101bee9 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -4488,6 +4488,11 @@ Use this option carefully, maybe worth to setup a bigger log buffer with "log_buf_len" along with this. =20 + hungtask_print_mask=3D + Bitmask for printing system info when hung task is detected. + Details of bits definition is the same as panic_print's + definition above. + parkbd.port=3D [HW] Parallel port number the keyboard adapter is connected to, default is 0. Format: diff --git a/kernel/hung_task.c b/kernel/hung_task.c index dc898ec93463..3907e3c6fefa 100644 --- a/kernel/hung_task.c +++ b/kernel/hung_task.c @@ -58,12 +58,29 @@ static unsigned long __read_mostly sysctl_hung_task_che= ck_interval_secs; static int __read_mostly sysctl_hung_task_warnings =3D 10; =20 static int __read_mostly did_panic; -static bool hung_task_show_lock; static bool hung_task_call_panic; -static bool hung_task_show_all_bt; =20 static struct task_struct *watchdog_task; =20 +/* + * A bitmask to control what kinds of system info to be printed when a + * hung task is detected, it could be task, memory, lock etc. And the bit + * definition (from panic.h) is: + * + * #define SYS_PRINT_TASK_INFO 0x00000001 + * #define SYS_PRINT_MEM_INFO 0x00000002 + * #define SYS_PRINT_TIMER_INFO 0x00000004 + * #define SYS_PRINT_LOCK_INFO 0x00000008 + * #define SYS_PRINT_FTRACE_INFO 0x00000010 + * #define SYS_PRINT_ALL_PRINTK_MSG 0x00000020 + * #define SYS_PRINT_ALL_CPU_BT 0x00000040 + * #define SYS_PRINT_BLOCKED_TASKS 0x00000080 + */ +unsigned long hungtask_print_mask; +core_param(hungtask_print_mask, hungtask_print_mask, ulong, 0644); + +static unsigned long cur_print_mask; + #ifdef CONFIG_SMP /* * Should we dump all CPUs backtraces in a hung task event? @@ -163,11 +180,16 @@ static void check_hung_task(struct task_struct *t, un= signed long timeout) */ sysctl_hung_task_detect_count++; =20 + cur_print_mask =3D hungtask_print_mask; + + if (!sysctl_hung_task_all_cpu_backtrace) + cur_print_mask &=3D ~SYS_PRINT_ALL_CPU_BT; + trace_sched_process_hang(t); =20 if (sysctl_hung_task_panic) { console_verbose(); - hung_task_show_lock =3D true; + cur_print_mask |=3D SYS_PRINT_LOCK_INFO; hung_task_call_panic =3D true; } =20 @@ -190,10 +212,10 @@ static void check_hung_task(struct task_struct *t, un= signed long timeout) " disables this message.\n"); sched_show_task(t); debug_show_blocker(t); - hung_task_show_lock =3D true; + cur_print_mask |=3D SYS_PRINT_LOCK_INFO; =20 if (sysctl_hung_task_all_cpu_backtrace) - hung_task_show_all_bt =3D true; + cur_print_mask |=3D SYS_PRINT_ALL_CPU_BT; if (!sysctl_hung_task_warnings) pr_info("Future hung task reports are suppressed, see sysctl kernel.hun= g_task_warnings\n"); } @@ -242,7 +264,7 @@ static void check_hung_uninterruptible_tasks(unsigned l= ong timeout) if (test_taint(TAINT_DIE) || did_panic) return; =20 - hung_task_show_lock =3D false; + cur_print_mask =3D 0; rcu_read_lock(); for_each_process_thread(g, t) { unsigned int state; @@ -266,14 +288,8 @@ static void check_hung_uninterruptible_tasks(unsigned = long timeout) } unlock: rcu_read_unlock(); - if (hung_task_show_lock) - debug_show_all_locks(); - - if (hung_task_show_all_bt) { - hung_task_show_all_bt =3D false; - trigger_all_cpu_backtrace(); - } =20 + sys_show_info(cur_print_mask); if (hung_task_call_panic) panic("hung_task: blocked tasks"); } --=20 2.39.5 (Apple Git-154) From nobody Wed Dec 17 08:56:25 2025 Received: from out30-119.freemail.mail.aliyun.com (out30-119.freemail.mail.aliyun.com [115.124.30.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E989D1BEF6D for ; Sun, 11 May 2025 08:53:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.119 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746953592; cv=none; b=O9UtcqjC8sahNwUEA//MIBNPYxZrR7cOh1jZDY/j921IRqoxXouH4lIPcmJ34bZZtGURueOXdMWt5CKIvop9bsBFSQbJre+LxIUP+HPHj1Vr7sJZubPpUUh7NSisgJAAC51HDKD1q/7PEcivYbqDNoAhCcYhnj7wMUsVIdRJQic= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746953592; c=relaxed/simple; bh=/3Ry2gB5rFGVaRFhCZm51kn3qdGjnjINXMCiUDzbJRE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=dwiB11mdx2iEvx+tAM5/8G2Z2IB9RO5NXE5T2sHw+a4xd7MKcbsVwFaaZnHwxAquxRf8LeTzvykbvoU9iWP8gtiCcl8fHt4vZVKeJUSLq6c7drWQ0HO2pcbwqvnnPMQLuRxn9cP+AjWMrSlrkxtfYaEn4oxUdfO6rNsEBvZA6Ac= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=aKVVNaST; arc=none smtp.client-ip=115.124.30.119 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="aKVVNaST" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1746953581; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=8t92E5KWjqXNVLiB/b284RDqI4JT9H4sLibraRXrnJU=; b=aKVVNaSTwX6FxVROXSeIHFn9b3AR8fl8RBntYMDLNjqRDtHKDC1DcMs4OThoTJTJ2YyirNaPsBsZn+CvQC8rZ6kif++JINSh8qvYXkcMLWYb2miR8To146PP6mdqrB4LOnAw96NqSh0H5zgWGDoNbvl1RQTT/bJ0Ppno1JiMf1I= Received: from localhost(mailfrom:feng.tang@linux.alibaba.com fp:SMTPD_---0WaA7MWw_1746953580 cluster:ay36) by smtp.aliyun-inc.com; Sun, 11 May 2025 16:53:01 +0800 From: Feng Tang To: Andrew Morton , Petr Mladek , Steven Rostedt , Lance Yang , linux-kernel@vger.kernel.org Cc: mhiramat@kernel.org, llong@redhat.com, Feng Tang Subject: [PATCH v1 3/3] kernel/watchdog: add option to dump system info when system is locked up Date: Sun, 11 May 2025 16:52:54 +0800 Message-Id: <20250511085254.61446-4-feng.tang@linux.alibaba.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20250511085254.61446-1-feng.tang@linux.alibaba.com> References: <20250511085254.61446-1-feng.tang@linux.alibaba.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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_mask' is the control knob and a bitmask to control what information should be printed out: bit 0: print all tasks info bit 1: print system memory info bit 2: print timer info bit 3: print locks info if CONFIG_LOCKDEP is on bit 4: print ftrace buffer bit 5: print all printk messages in buffer bit 6: print all CPUs backtrace (if available in the arch) bit 7: print only tasks in uninterruptible (blocked) state Signed-off-by: Feng Tang --- .../admin-guide/kernel-parameters.txt | 11 +++++++--- kernel/watchdog.c | 20 +++++++++++++++++++ 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentatio= n/admin-guide/kernel-parameters.txt index d35d8101bee9..2b8bda2b5f0b 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -4489,9 +4489,14 @@ bigger log buffer with "log_buf_len" along with this. =20 hungtask_print_mask=3D - Bitmask for printing system info when hung task is detected. - Details of bits definition is the same as panic_print's - definition above. + Bitmask for printing system info when hung task is + detected. Details of bits definition is the same as + panic_print's definition above. + + lockup_print_mask=3D + Bitmask for printing system info when software/hardware + system lockup is detected. Details of bits definition + is the same as panic_print's definition above. =20 parkbd.port=3D [HW] Parallel port number the keyboard adapter is connected to, default is 0. diff --git a/kernel/watchdog.c b/kernel/watchdog.c index 9fa2af9dbf2c..fb1b94929c3b 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c @@ -52,6 +52,23 @@ static int __read_mostly watchdog_hardlockup_available; struct cpumask watchdog_cpumask __read_mostly; unsigned long *watchdog_cpumask_bits =3D cpumask_bits(&watchdog_cpumask); =20 +/* + * 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. And the bit definition (from panic.h) is: + * + * #define SYS_PRINT_TASK_INFO 0x00000001 + * #define SYS_PRINT_MEM_INFO 0x00000002 + * #define SYS_PRINT_TIMER_INFO 0x00000004 + * #define SYS_PRINT_LOCK_INFO 0x00000008 + * #define SYS_PRINT_FTRACE_INFO 0x00000010 + * #define SYS_PRINT_ALL_PRINTK_MSG 0x00000020 + * #define SYS_PRINT_ALL_CPU_BT 0x00000040 + * #define SYS_PRINT_BLOCKED_TASKS 0x00000080 + */ +unsigned long lockup_print_mask; +core_param(lockup_print_mask, lockup_print_mask, ulong, 0644); + #ifdef CONFIG_HARDLOCKUP_DETECTOR =20 # ifdef CONFIG_SMP @@ -212,6 +229,7 @@ void watchdog_hardlockup_check(unsigned int cpu, struct= pt_regs *regs) clear_bit_unlock(0, &hard_lockup_nmi_warn); } =20 + sys_show_info(lockup_print_mask); if (hardlockup_panic) nmi_panic(regs, "Hard LOCKUP"); =20 @@ -774,6 +792,8 @@ static enum hrtimer_restart watchdog_timer_fn(struct hr= timer *hrtimer) } =20 add_taint(TAINT_SOFTLOCKUP, LOCKDEP_STILL_OK); + + sys_show_info(lockup_print_mask); if (softlockup_panic) panic("softlockup: hung tasks"); } --=20 2.39.5 (Apple Git-154)