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.

powerpc/watchdog: add support for hardlockup_sys_info sysctl

Commit a9af76a78760 ("watchdog: add sys_info sysctls to dump sys info on
system lockup") adds 'hardlock_sys_info' systcl knob for general kernel
watchdog to control what kinds of system debug info to be dumped on
hardlockup.

Add similar support in powerpc watchdog code to make the sysctl knob more
general, which also fixes a compiling warning in general watchdog code
reported by 0day bot.

Link: https://lkml.kernel.org/r/20251231080309.39642-1-feng.tang@linux.alibaba.com
Fixes: a9af76a78760 ("watchdog: add sys_info sysctls to dump sys info on system lockup")
Signed-off-by: Feng Tang <feng.tang@linux.alibaba.com>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202512030920.NFKtekA7-lkp@intel.com/
Suggested-by: Petr Mladek <pmladek@suse.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Feng Tang and committed by
Andrew Morton
e561383a f171b55f

+12 -6
+10 -5
arch/powerpc/kernel/watchdog.c
··· 26 26 #include <linux/delay.h> 27 27 #include <linux/processor.h> 28 28 #include <linux/smp.h> 29 + #include <linux/sys_info.h> 29 30 30 31 #include <asm/interrupt.h> 31 32 #include <asm/paca.h> ··· 236 235 pr_emerg("CPU %d TB:%lld, last SMP heartbeat TB:%lld (%lldms ago)\n", 237 236 cpu, tb, last_reset, tb_to_ns(tb - last_reset) / 1000000); 238 237 239 - if (!sysctl_hardlockup_all_cpu_backtrace) { 238 + if (sysctl_hardlockup_all_cpu_backtrace || 239 + (hardlockup_si_mask & SYS_INFO_ALL_BT)) { 240 + trigger_allbutcpu_cpu_backtrace(cpu); 241 + cpumask_clear(&wd_smp_cpus_ipi); 242 + } else { 240 243 /* 241 244 * Try to trigger the stuck CPUs, unless we are going to 242 245 * get a backtrace on all of them anyway. ··· 249 244 smp_send_nmi_ipi(c, wd_lockup_ipi, 1000000); 250 245 __cpumask_clear_cpu(c, &wd_smp_cpus_ipi); 251 246 } 252 - } else { 253 - trigger_allbutcpu_cpu_backtrace(cpu); 254 - cpumask_clear(&wd_smp_cpus_ipi); 255 247 } 256 248 249 + sys_info(hardlockup_si_mask & ~SYS_INFO_ALL_BT); 257 250 if (hardlockup_panic) 258 251 nmi_panic(NULL, "Hard LOCKUP"); 259 252 ··· 418 415 419 416 xchg(&__wd_nmi_output, 1); // see wd_lockup_ipi 420 417 421 - if (sysctl_hardlockup_all_cpu_backtrace) 418 + if (sysctl_hardlockup_all_cpu_backtrace || 419 + (hardlockup_si_mask & SYS_INFO_ALL_BT)) 422 420 trigger_allbutcpu_cpu_backtrace(cpu); 423 421 422 + sys_info(hardlockup_si_mask & ~SYS_INFO_ALL_BT); 424 423 if (hardlockup_panic) 425 424 nmi_panic(regs, "Hard LOCKUP"); 426 425
+1
include/linux/nmi.h
··· 83 83 #if defined(CONFIG_HARDLOCKUP_DETECTOR) 84 84 extern void hardlockup_detector_disable(void); 85 85 extern unsigned int hardlockup_panic; 86 + extern unsigned long hardlockup_si_mask; 86 87 #else 87 88 static inline void hardlockup_detector_disable(void) {} 88 89 #endif
+1 -1
kernel/watchdog.c
··· 71 71 * hard lockup is detected, it could be task, memory, lock etc. 72 72 * Refer include/linux/sys_info.h for detailed bit definition. 73 73 */ 74 - static unsigned long hardlockup_si_mask; 74 + unsigned long hardlockup_si_mask; 75 75 76 76 #ifdef CONFIG_SYSFS 77 77