kernel/watchdog: split up config options
Subsystems (4)
[email protected]
maintainerPATCH 55/96 kernel/watchdog: split up config options
From: Nicholas Piggin <[email protected]>
Subject: kernel/watchdog: split up config options
Split SOFTLOCKUP_DETECTOR from LOCKUP_DETECTOR, and split HARDLOCKUP_DETECTOR_PERF from HARDLOCKUP_DETECTOR.
LOCKUP_DETECTOR implies the general boot, sysctl, and programming interfaces for the lockup detectors.
An architecture that wants to use a hard lockup detector must define HAVE_HARDLOCKUP_DETECTOR_PERF or HAVE_HARDLOCKUP_DETECTOR_ARCH.
Alternatively an arch can define HAVE_NMI_WATCHDOG, which provides the minimum arch_touch_nmi_watchdog, and it otherwise does its own thing and does not implement the LOCKUP_DETECTOR interfaces.
sparc is unusual in that it has started to implement some of the interfaces, but not fully yet. It should probably be converted to a full HAVE_HARDLOCKUP_DETECTOR_ARCH.
---
arch/Kconfig | 25 ++- arch/powerpc/Kconfig | 1 arch/powerpc/kernel/setup_64.c | 2 arch/x86/Kconfig | 1 arch/x86/kernel/apic/hw_nmi.c | 2 include/linux/nmi.h | 29 ++- kernel/Makefile | 2 kernel/sysctl.c | 31 ++- kernel/watchdog.c | 243 ++++++++++++++++++++----------- kernel/watchdog_hld.c | 32 ---- lib/Kconfig.debug | 45 +++-- 11 files changed, 251 insertions(+), 162 deletions(-)
arch/Kconfig renamed from arch/Kconfig~watchdog-split-up-config-options +22 -3
@@ -198,9 +198,6 @@ config HAVE_KPROBES_ON_FTRACE config HAVE_NMI bool -config HAVE_NMI_WATCHDOG - depends on HAVE_NMI - bool # # An arch should select this if it provides all these things: #
@@ -288,6 +285,28 @@ config HAVE_PERF_EVENTS_NMI subsystem. Also has support for calculating CPU cycle events to determine how many clock cycles in a given period. +config HAVE_HARDLOCKUP_DETECTOR_PERF + bool + depends on HAVE_PERF_EVENTS_NMI + help + The arch chooses to use the generic perf-NMI-based hardlockup + detector. Must define HAVE_PERF_EVENTS_NMI. + +config HAVE_NMI_WATCHDOG + depends on HAVE_NMI + bool + help + The arch provides a low level NMI watchdog. It provides + asm/nmi.h, and defines its own arch_touch_nmi_watchdog(). + +config HAVE_HARDLOCKUP_DETECTOR_ARCH + bool + select HAVE_NMI_WATCHDOG + help + The arch chooses to provide its own hardlockup detector, which is + a superset of the HAVE_NMI_WATCHDOG. It also conforms to config + interfaces and parameters provided by hardlockup detector subsystem. + config HAVE_PERF_REGS bool help
arch/powerpc/Kconfig renamed from arch/powerpc/Kconfig~watchdog-split-up-config-options +1 -0
@@ -197,6 +197,7 @@ config PPC select HAVE_OPTPROBES if PPC64 select HAVE_PERF_EVENTS select HAVE_PERF_EVENTS_NMI if PPC64 + select HAVE_HARDLOCKUP_DETECTOR_PERF if HAVE_PERF_EVENTS_NMI select HAVE_PERF_REGS select HAVE_PERF_USER_STACK_DUMP select HAVE_RCU_TABLE_FREE if SMP
arch/powerpc/kernel/setup_64.c renamed from arch/powerpc/kernel/setup_64.c~watchdog-split-up-config-options +1 -1
@@ -752,7 +752,7 @@ struct ppc_pci_io ppc_pci_io;EXPORT_SYMBOL (ppc_pci_io);#endif -#ifdef CONFIG_HARDLOCKUP_DETECTOR +#ifdef CONFIG_HARDLOCKUP_DETECTOR_PERF u64 hw_nmi_get_sample_period (int watchdog_thresh) {return ppc_proc_freq * watchdog_thresh;
arch/x86/Kconfig renamed from arch/x86/Kconfig~watchdog-split-up-config-options +1 -0
@@ -162,6 +162,7 @@ config X86 select HAVE_PCSPKR_PLATFORM select HAVE_PERF_EVENTS select HAVE_PERF_EVENTS_NMI + select HAVE_HARDLOCKUP_DETECTOR_PERF if HAVE_PERF_EVENTS_NMI select HAVE_PERF_REGS select HAVE_PERF_USER_STACK_DUMP select HAVE_REGS_AND_STACK_ACCESS_API
arch/x86/kernel/apic/hw_nmi.c renamed from arch/x86/kernel/apic/hw_nmi.c~watchdog-split-up-config-options +1 -1
@@ -19,7 +19,7 @@#include <linux/init.h> #include <linux/delay.h> -#ifdef CONFIG_HARDLOCKUP_DETECTOR +#ifdef CONFIG_HARDLOCKUP_DETECTOR_PERF u64 hw_nmi_get_sample_period (int watchdog_thresh) {return (u64)(cpu_khz) *1000 * watchdog_thresh;
include/linux/nmi.h renamed from include/linux/nmi.h~watchdog-split-up-config-options +20 -9
@@ -11,13 +11,21 @@#endif #ifdef CONFIG_LOCKUP_DETECTOR +void lockup_detector_init (void ); +#else +static inline void lockup_detector_init (void ) +{ +} +#endif + +#ifdef CONFIG_SOFTLOCKUP_DETECTOR extern void touch_softlockup_watchdog_sched (void );extern void touch_softlockup_watchdog (void );extern void touch_softlockup_watchdog_sync (void );extern void touch_all_softlockup_watchdogs (void );extern unsigned int softlockup_panic; -extern unsigned int hardlockup_panic; -void lockup_detector_init (void ); +extern int soft_watchdog_enabled; +extern atomic_t watchdog_park_in_progress;#else static inline void touch_softlockup_watchdog_sched (void ) {
@@ -31,9 +39,6 @@ static inline void touch_softlockup_watcstatic inline void touch_all_softlockup_watchdogs (void ) { } -static inline void lockup_detector_init (void ) -{ -}#endif #ifdef CONFIG_DETECT_HUNG_TASK
@@ -63,15 +68,18 @@ static inline void reset_hung_task_detec#if defined(CONFIG_HARDLOCKUP_DETECTOR )extern void hardlockup_detector_disable (void ); +extern unsigned int hardlockup_panic;#else static inline void hardlockup_detector_disable (void ) {}#endif -#if defined(CONFIG_HARDLOCKUP_DETECTOR ) || defined(CONFIG_HAVE_NMI_WATCHDOG ) +#if defined(CONFIG_HARDLOCKUP_DETECTOR_PERF )extern void arch_touch_nmi_watchdog (void );#else +#if !defined(CONFIG_HAVE_NMI_WATCHDOG )static inline void arch_touch_nmi_watchdog (void ) {}#endif +#endif /** * touch_nmi_watchdog - restart NMI watchdog timeout.
@@ -141,15 +149,18 @@ static inline bool trigger_single_cpu_ba }#endif -#ifdef CONFIG_LOCKUP_DETECTOR +#ifdef CONFIG_HARDLOCKUP_DETECTOR_PERF u64 hw_nmi_get_sample_period (int watchdog_thresh); +#endif + +#ifdef CONFIG_LOCKUP_DETECTOR extern int nmi_watchdog_enabled; -extern int soft_watchdog_enabled;extern int watchdog_user_enabled;extern int watchdog_thresh;extern unsigned long watchdog_enabled; +extern struct cpumask watchdog_cpumask;extern unsigned long *watchdog_cpumask_bits; -extern atomic_t watchdog_park_in_progress; +extern int __read_mostly watchdog_suspended;#ifdef CONFIG_SMP extern int sysctl_softlockup_all_cpu_backtrace;extern int sysctl_hardlockup_all_cpu_backtrace;
kernel/Makefile renamed from kernel/Makefile~watchdog-split-up-config-options +1 -1
@@ -82,7 +82,7 @@ obj-$(CONFIG_KPROBES) += kprobes.o obj-$(CONFIG_KGDB) += debug/ obj-$(CONFIG_DETECT_HUNG_TASK) += hung_task.o obj-$(CONFIG_LOCKUP_DETECTOR) += watchdog.o -obj-$(CONFIG_HARDLOCKUP_DETECTOR) += watchdog_hld.o +obj-$(CONFIG_HARDLOCKUP_DETECTOR_PERF) += watchdog_hld.o obj-$(CONFIG_SECCOMP) += seccomp.o obj-$(CONFIG_RELAY) += relay.o obj-$(CONFIG_SYSCTL) += utsname_sysctl.o
kernel/sysctl.c renamed from kernel/sysctl.c~watchdog-split-up-config-options +18 -13
@@ -901,6 +901,14 @@ static struct ctl_table kern_table[] = {#endif }, { + .procname = "watchdog_cpumask", + .data = &watchdog_cpumask_bits, + .maxlen = NR_CPUS, + .mode = 0644, + .proc_handler = proc_watchdog_cpumask, + }, +#ifdef CONFIG_SOFTLOCKUP_DETECTOR + { .procname = "soft_watchdog", .data = &soft_watchdog_enabled, .maxlen = sizeof (int),
@@ -910,13 +918,6 @@ static struct ctl_table kern_table[] = { .extra2 = &one, }, { - .procname = "watchdog_cpumask", - .data = &watchdog_cpumask_bits, - .maxlen = NR_CPUS, - .mode = 0644, - .proc_handler = proc_watchdog_cpumask, - }, - { .procname = "softlockup_panic", .data = &softlockup_panic, .maxlen = sizeof(int),
@@ -925,27 +926,29 @@ static struct ctl_table kern_table[] = { .extra1 = &zero, .extra2 = &one, }, -#ifdef CONFIG_HARDLOCKUP_DETECTOR +#ifdef CONFIG_SMP { - .procname = "hardlockup_panic", - .data = &hardlockup_panic, + .procname = "softlockup_all_cpu_backtrace", + .data = &sysctl_softlockup_all_cpu_backtrace, .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dointvec_minmax, .extra1 = &zero, .extra2 = &one, }, +#endif /* CONFIG_SMP */ #endif -#ifdef CONFIG_SMP +#ifdef CONFIG_HARDLOCKUP_DETECTOR { - .procname = "softlockup_all_cpu_backtrace", - .data = &sysctl_softlockup_all_cpu_backtrace, + .procname = "hardlockup_panic", + .data = &hardlockup_panic, .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dointvec_minmax, .extra1 = &zero, .extra2 = &one, }, +#ifdef CONFIG_SMP { .procname = "hardlockup_all_cpu_backtrace", .data = &sysctl_hardlockup_all_cpu_backtrace,
@@ -957,6 +960,8 @@ static struct ctl_table kern_table[] = { },#endif /* CONFIG_SMP */ #endif +#endif +#if defined(CONFIG_X86_LOCAL_APIC ) && defined(CONFIG_X86 ) { .procname = "unknown_nmi_panic",
kernel/watchdog.c renamed from kernel/watchdog.c~watchdog-split-up-config-options +158 -85
318 lines not on this page · raw message
kernel/watchdog_hld.c renamed from kernel/watchdog_hld.c~watchdog-split-up-config-options +0 -32
@@ -22,39 +22,7 @@ static DEFINE_PER_CPU(bool, hard_watchdo static DEFINE_PER_CPU(bool, watchdog_nmi_touch); static DEFINE_PER_CPU(struct perf_event *, watchdog_ev); -/* boot commands */ -/* -* Should we panic when a soft-lockup or hard-lockup occurs: -*/ -unsigned int __read_mostly hardlockup_panic = -CONFIG_BOOTPARAM_HARDLOCKUP_PANIC_VALUE ;static unsigned long hardlockup_allcpu_dumped; -/* -* We may not want to enable hard lockup detection by default in all cases, -* for example when running the kernel as a guest on a hypervisor. In these -* cases this function can be called to disable hard lockup detection. This -* function should only be executed once by the boot processor before the -* kernel command line parameters are parsed, because otherwise it is not -* possible to override this in hardlockup_panic_setup(). -*/ -void hardlockup_detector_disable (void ) -{ - watchdog_enabled &= ~NMI_WATCHDOG_ENABLED ; -} - -static int __init hardlockup_panic_setup (char *str) -{ -if (!strncmp (str,"panic" ,5 )) - hardlockup_panic =1 ; -else if (!strncmp (str,"nopanic" ,7 )) - hardlockup_panic =0 ; -else if (!strncmp (str,"0" ,1 )) - watchdog_enabled &= ~NMI_WATCHDOG_ENABLED ; -else if (!strncmp (str,"1" ,1 )) - watchdog_enabled |=NMI_WATCHDOG_ENABLED ; -return 1 ; -} -__setup ("nmi_watchdog=" , hardlockup_panic_setup);void arch_touch_nmi_watchdog (void ) {
lib/Kconfig.debug renamed from lib/Kconfig.debug~watchdog-split-up-config-options +28 -17
83 lines not on this page · raw message
_