Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

watchdog: softlockup: panic when lockup duration exceeds N thresholds

The softlockup_panic sysctl is currently a binary option: panic
immediately or never panic on soft lockups.

Panicking on any soft lockup, regardless of duration, can be overly
aggressive for brief stalls that may be caused by legitimate operations.
Conversely, never panicking may allow severe system hangs to persist
undetected.

Extend softlockup_panic to accept an integer threshold, allowing the
kernel to panic only when the normalized lockup duration exceeds N
watchdog threshold periods. This provides finer-grained control to
distinguish between transient delays and persistent system failures.

The accepted values are:
- 0: Don't panic (unchanged)
- 1: Panic when duration >= 1 * threshold (20s default, original behavior)
- N > 1: Panic when duration >= N * threshold (e.g., 2 = 40s, 3 = 60s.)

The original behavior is preserved for values 0 and 1, maintaining full
backward compatibility while allowing systems to tolerate brief lockups
while still catching severe, persistent hangs.

[lirongqing@baidu.com: v2]
Link: https://lkml.kernel.org/r/20251218074300.4080-1-lirongqing@baidu.com
Link: https://lkml.kernel.org/r/20251216074521.2796-1-lirongqing@baidu.com
Signed-off-by: Li RongQing <lirongqing@baidu.com>
Cc: Eduard Zingerman <eddyz87@gmail.com>
Cc: Hao Luo <haoluo@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Fastabend <john.fastabend@gmail.com>
Cc: KP Singh <kpsingh@kernel.org>
Cc: Lance Yang <lance.yang@linux.dev>
Cc: Martin KaFai Lau <martin.lau@linux.dev>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Song Liu <song@kernel.org>
Cc: Stanislav Fomichev <sdf@fomichev.me>
Cc: Yonghong Song <yonghong.song@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Li RongQing and committed by
Andrew Morton
e700f5d1 b5bfcc1f

+28 -25
+5 -5
Documentation/admin-guide/kernel-parameters.txt
··· 6969 6969 6970 6970 softlockup_panic= 6971 6971 [KNL] Should the soft-lockup detector generate panics. 6972 - Format: 0 | 1 6972 + Format: <int> 6973 6973 6974 - A value of 1 instructs the soft-lockup detector 6975 - to panic the machine when a soft-lockup occurs. It is 6976 - also controlled by the kernel.softlockup_panic sysctl 6977 - and CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC, which is the 6974 + A value of non-zero instructs the soft-lockup detector 6975 + to panic the machine when a soft-lockup duration exceeds 6976 + N thresholds. It is also controlled by the kernel.softlockup_panic 6977 + sysctl and CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC, which is the 6978 6978 respective build-time switch to that functionality. 6979 6979 6980 6980 softlockup_all_cpu_backtrace=
+1 -1
arch/arm/configs/aspeed_g5_defconfig
··· 306 306 CONFIG_PANIC_ON_OOPS=y 307 307 CONFIG_PANIC_TIMEOUT=-1 308 308 CONFIG_SOFTLOCKUP_DETECTOR=y 309 - CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=y 309 + CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=1 310 310 CONFIG_BOOTPARAM_HUNG_TASK_PANIC=1 311 311 CONFIG_WQ_WATCHDOG=y 312 312 # CONFIG_SCHED_DEBUG is not set
+1 -1
arch/arm/configs/pxa3xx_defconfig
··· 100 100 CONFIG_DEBUG_KERNEL=y 101 101 CONFIG_MAGIC_SYSRQ=y 102 102 CONFIG_DEBUG_SHIRQ=y 103 - CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=y 103 + CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=1 104 104 # CONFIG_SCHED_DEBUG is not set 105 105 CONFIG_DEBUG_SPINLOCK=y 106 106 CONFIG_DEBUG_SPINLOCK_SLEEP=y
+1 -1
arch/openrisc/configs/or1klitex_defconfig
··· 52 52 CONFIG_PRINTK_TIME=y 53 53 CONFIG_PANIC_ON_OOPS=y 54 54 CONFIG_SOFTLOCKUP_DETECTOR=y 55 - CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=y 55 + CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=1 56 56 CONFIG_BUG_ON_DATA_CORRUPTION=y
+1 -1
arch/powerpc/configs/skiroot_defconfig
··· 289 289 CONFIG_DEBUG_STACKOVERFLOW=y 290 290 CONFIG_PANIC_ON_OOPS=y 291 291 CONFIG_SOFTLOCKUP_DETECTOR=y 292 - CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=y 292 + CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=1 293 293 CONFIG_HARDLOCKUP_DETECTOR=y 294 294 CONFIG_BOOTPARAM_HARDLOCKUP_PANIC=y 295 295 CONFIG_WQ_WATCHDOG=y
+1 -1
drivers/gpu/drm/ci/arm.config
··· 52 52 CONFIG_PROVE_LOCKING=n 53 53 CONFIG_DEBUG_LOCKDEP=n 54 54 CONFIG_SOFTLOCKUP_DETECTOR=n 55 - CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=n 55 + CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=0 56 56 57 57 CONFIG_FW_LOADER_COMPRESS=y 58 58
+1 -1
drivers/gpu/drm/ci/arm64.config
··· 161 161 CONFIG_PROVE_LOCKING=n 162 162 CONFIG_DEBUG_LOCKDEP=n 163 163 CONFIG_SOFTLOCKUP_DETECTOR=y 164 - CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=y 164 + CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=1 165 165 166 166 CONFIG_DETECT_HUNG_TASK=y 167 167
+1 -1
drivers/gpu/drm/ci/x86_64.config
··· 47 47 CONFIG_PROVE_LOCKING=n 48 48 CONFIG_DEBUG_LOCKDEP=n 49 49 CONFIG_SOFTLOCKUP_DETECTOR=y 50 - CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=y 50 + CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=1 51 51 52 52 CONFIG_DETECT_HUNG_TASK=y 53 53
+1 -1
kernel/configs/debug.config
··· 84 84 # Debug Oops, Lockups and Hangs 85 85 # 86 86 CONFIG_BOOTPARAM_HUNG_TASK_PANIC=0 87 - # CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set 87 + CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=0 88 88 CONFIG_DEBUG_ATOMIC_SLEEP=y 89 89 CONFIG_DETECT_HUNG_TASK=y 90 90 CONFIG_PANIC_ON_OOPS=y
+6 -4
kernel/watchdog.c
··· 363 363 364 364 /* Global variables, exported for sysctl */ 365 365 unsigned int __read_mostly softlockup_panic = 366 - IS_ENABLED(CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC); 366 + CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC; 367 367 368 368 static bool softlockup_initialized __read_mostly; 369 369 static u64 __read_mostly sample_period; ··· 774 774 { 775 775 unsigned long touch_ts, period_ts, now; 776 776 struct pt_regs *regs = get_irq_regs(); 777 - int duration; 778 777 int softlockup_all_cpu_backtrace; 778 + int duration, thresh_count; 779 779 unsigned long flags; 780 780 781 781 if (!watchdog_enabled) ··· 879 879 880 880 add_taint(TAINT_SOFTLOCKUP, LOCKDEP_STILL_OK); 881 881 sys_info(softlockup_si_mask & ~SYS_INFO_ALL_BT); 882 - if (softlockup_panic) 882 + thresh_count = duration / get_softlockup_thresh(); 883 + 884 + if (softlockup_panic && thresh_count >= softlockup_panic) 883 885 panic("softlockup: hung tasks"); 884 886 } 885 887 ··· 1230 1228 .mode = 0644, 1231 1229 .proc_handler = proc_dointvec_minmax, 1232 1230 .extra1 = SYSCTL_ZERO, 1233 - .extra2 = SYSCTL_ONE, 1231 + .extra2 = SYSCTL_INT_MAX, 1234 1232 }, 1235 1233 { 1236 1234 .procname = "softlockup_sys_info",
+7 -6
lib/Kconfig.debug
··· 1110 1110 the CPU stats and the interrupt counts during the "soft lockups". 1111 1111 1112 1112 config BOOTPARAM_SOFTLOCKUP_PANIC 1113 - bool "Panic (Reboot) On Soft Lockups" 1113 + int "Panic (Reboot) On Soft Lockups" 1114 1114 depends on SOFTLOCKUP_DETECTOR 1115 + default 0 1115 1116 help 1116 - Say Y here to enable the kernel to panic on "soft lockups", 1117 - which are bugs that cause the kernel to loop in kernel 1118 - mode for more than 20 seconds (configurable using the watchdog_thresh 1119 - sysctl), without giving other tasks a chance to run. 1117 + Set to a non-zero value N to enable the kernel to panic on "soft 1118 + lockups", which are bugs that cause the kernel to loop in kernel 1119 + mode for more than (N * 20 seconds) (configurable using the 1120 + watchdog_thresh sysctl), without giving other tasks a chance to run. 1120 1121 1121 1122 The panic can be used in combination with panic_timeout, 1122 1123 to cause the system to reboot automatically after a ··· 1125 1124 high-availability systems that have uptime guarantees and 1126 1125 where a lockup must be resolved ASAP. 1127 1126 1128 - Say N if unsure. 1127 + Say 0 if unsure. 1129 1128 1130 1129 config HAVE_HARDLOCKUP_DETECTOR_BUDDY 1131 1130 bool
+1 -1
tools/testing/selftests/bpf/config
··· 1 1 CONFIG_BLK_DEV_LOOP=y 2 2 CONFIG_BOOTPARAM_HARDLOCKUP_PANIC=y 3 - CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=y 3 + CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=1 4 4 CONFIG_BPF=y 5 5 CONFIG_BPF_EVENTS=y 6 6 CONFIG_BPF_JIT=y
+1 -1
tools/testing/selftests/wireguard/qemu/kernel.config
··· 80 80 CONFIG_WQ_WATCHDOG=y 81 81 CONFIG_DETECT_HUNG_TASK=y 82 82 CONFIG_BOOTPARAM_HARDLOCKUP_PANIC=y 83 - CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=y 83 + CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=1 84 84 CONFIG_BOOTPARAM_HUNG_TASK_PANIC=1 85 85 CONFIG_PANIC_TIMEOUT=-1 86 86 CONFIG_STACKTRACE=y