aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/nmi.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/nmi.h')
-rw-r--r--include/linux/nmi.h121
1 files changed, 62 insertions, 59 deletions
diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index a36abe2da13e..27e249ed7c5c 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -12,11 +12,31 @@
12 12
13#ifdef CONFIG_LOCKUP_DETECTOR 13#ifdef CONFIG_LOCKUP_DETECTOR
14void lockup_detector_init(void); 14void lockup_detector_init(void);
15void lockup_detector_soft_poweroff(void);
16void lockup_detector_cleanup(void);
17bool is_hardlockup(void);
18
19extern int watchdog_user_enabled;
20extern int nmi_watchdog_user_enabled;
21extern int soft_watchdog_user_enabled;
22extern int watchdog_thresh;
23extern unsigned long watchdog_enabled;
24
25extern struct cpumask watchdog_cpumask;
26extern unsigned long *watchdog_cpumask_bits;
27#ifdef CONFIG_SMP
28extern int sysctl_softlockup_all_cpu_backtrace;
29extern int sysctl_hardlockup_all_cpu_backtrace;
15#else 30#else
16static inline void lockup_detector_init(void) 31#define sysctl_softlockup_all_cpu_backtrace 0
17{ 32#define sysctl_hardlockup_all_cpu_backtrace 0
18} 33#endif /* !CONFIG_SMP */
19#endif 34
35#else /* CONFIG_LOCKUP_DETECTOR */
36static inline void lockup_detector_init(void) { }
37static inline void lockup_detector_soft_poweroff(void) { }
38static inline void lockup_detector_cleanup(void) { }
39#endif /* !CONFIG_LOCKUP_DETECTOR */
20 40
21#ifdef CONFIG_SOFTLOCKUP_DETECTOR 41#ifdef CONFIG_SOFTLOCKUP_DETECTOR
22extern void touch_softlockup_watchdog_sched(void); 42extern void touch_softlockup_watchdog_sched(void);
@@ -24,29 +44,17 @@ extern void touch_softlockup_watchdog(void);
24extern void touch_softlockup_watchdog_sync(void); 44extern void touch_softlockup_watchdog_sync(void);
25extern void touch_all_softlockup_watchdogs(void); 45extern void touch_all_softlockup_watchdogs(void);
26extern unsigned int softlockup_panic; 46extern unsigned int softlockup_panic;
27extern int soft_watchdog_enabled;
28extern atomic_t watchdog_park_in_progress;
29#else 47#else
30static inline void touch_softlockup_watchdog_sched(void) 48static inline void touch_softlockup_watchdog_sched(void) { }
31{ 49static inline void touch_softlockup_watchdog(void) { }
32} 50static inline void touch_softlockup_watchdog_sync(void) { }
33static inline void touch_softlockup_watchdog(void) 51static inline void touch_all_softlockup_watchdogs(void) { }
34{
35}
36static inline void touch_softlockup_watchdog_sync(void)
37{
38}
39static inline void touch_all_softlockup_watchdogs(void)
40{
41}
42#endif 52#endif
43 53
44#ifdef CONFIG_DETECT_HUNG_TASK 54#ifdef CONFIG_DETECT_HUNG_TASK
45void reset_hung_task_detector(void); 55void reset_hung_task_detector(void);
46#else 56#else
47static inline void reset_hung_task_detector(void) 57static inline void reset_hung_task_detector(void) { }
48{
49}
50#endif 58#endif
51 59
52/* 60/*
@@ -54,12 +62,12 @@ static inline void reset_hung_task_detector(void)
54 * 'watchdog_enabled' variable. Each lockup detector has its dedicated bit - 62 * 'watchdog_enabled' variable. Each lockup detector has its dedicated bit -
55 * bit 0 for the hard lockup detector and bit 1 for the soft lockup detector. 63 * bit 0 for the hard lockup detector and bit 1 for the soft lockup detector.
56 * 64 *
57 * 'watchdog_user_enabled', 'nmi_watchdog_enabled' and 'soft_watchdog_enabled' 65 * 'watchdog_user_enabled', 'nmi_watchdog_user_enabled' and
58 * are variables that are only used as an 'interface' between the parameters 66 * 'soft_watchdog_user_enabled' are variables that are only used as an
59 * in /proc/sys/kernel and the internal state bits in 'watchdog_enabled'. The 67 * 'interface' between the parameters in /proc/sys/kernel and the internal
60 * 'watchdog_thresh' variable is handled differently because its value is not 68 * state bits in 'watchdog_enabled'. The 'watchdog_thresh' variable is
61 * boolean, and the lockup detectors are 'suspended' while 'watchdog_thresh' 69 * handled differently because its value is not boolean, and the lockup
62 * is equal zero. 70 * detectors are 'suspended' while 'watchdog_thresh' is equal zero.
63 */ 71 */
64#define NMI_WATCHDOG_ENABLED_BIT 0 72#define NMI_WATCHDOG_ENABLED_BIT 0
65#define SOFT_WATCHDOG_ENABLED_BIT 1 73#define SOFT_WATCHDOG_ENABLED_BIT 1
@@ -73,17 +81,41 @@ extern unsigned int hardlockup_panic;
73static inline void hardlockup_detector_disable(void) {} 81static inline void hardlockup_detector_disable(void) {}
74#endif 82#endif
75 83
84#if defined(CONFIG_HAVE_NMI_WATCHDOG) || defined(CONFIG_HARDLOCKUP_DETECTOR)
85# define NMI_WATCHDOG_SYSCTL_PERM 0644
86#else
87# define NMI_WATCHDOG_SYSCTL_PERM 0444
88#endif
89
76#if defined(CONFIG_HARDLOCKUP_DETECTOR_PERF) 90#if defined(CONFIG_HARDLOCKUP_DETECTOR_PERF)
77extern void arch_touch_nmi_watchdog(void); 91extern void arch_touch_nmi_watchdog(void);
92extern void hardlockup_detector_perf_stop(void);
93extern void hardlockup_detector_perf_restart(void);
94extern void hardlockup_detector_perf_disable(void);
95extern void hardlockup_detector_perf_enable(void);
96extern void hardlockup_detector_perf_cleanup(void);
97extern int hardlockup_detector_perf_init(void);
78#else 98#else
79#if !defined(CONFIG_HAVE_NMI_WATCHDOG) 99static inline void hardlockup_detector_perf_stop(void) { }
100static inline void hardlockup_detector_perf_restart(void) { }
101static inline void hardlockup_detector_perf_disable(void) { }
102static inline void hardlockup_detector_perf_enable(void) { }
103static inline void hardlockup_detector_perf_cleanup(void) { }
104# if !defined(CONFIG_HAVE_NMI_WATCHDOG)
105static inline int hardlockup_detector_perf_init(void) { return -ENODEV; }
80static inline void arch_touch_nmi_watchdog(void) {} 106static inline void arch_touch_nmi_watchdog(void) {}
107# else
108static inline int hardlockup_detector_perf_init(void) { return 0; }
109# endif
81#endif 110#endif
82#endif 111
112void watchdog_nmi_stop(void);
113void watchdog_nmi_start(void);
114int watchdog_nmi_probe(void);
83 115
84/** 116/**
85 * touch_nmi_watchdog - restart NMI watchdog timeout. 117 * touch_nmi_watchdog - restart NMI watchdog timeout.
86 * 118 *
87 * If the architecture supports the NMI watchdog, touch_nmi_watchdog() 119 * If the architecture supports the NMI watchdog, touch_nmi_watchdog()
88 * may be used to reset the timeout - for code which intentionally 120 * may be used to reset the timeout - for code which intentionally
89 * disables interrupts for a long time. This call is stateless. 121 * disables interrupts for a long time. This call is stateless.
@@ -153,22 +185,6 @@ static inline bool trigger_single_cpu_backtrace(int cpu)
153u64 hw_nmi_get_sample_period(int watchdog_thresh); 185u64 hw_nmi_get_sample_period(int watchdog_thresh);
154#endif 186#endif
155 187
156#ifdef CONFIG_LOCKUP_DETECTOR
157extern int nmi_watchdog_enabled;
158extern int watchdog_user_enabled;
159extern int watchdog_thresh;
160extern unsigned long watchdog_enabled;
161extern struct cpumask watchdog_cpumask;
162extern unsigned long *watchdog_cpumask_bits;
163extern int __read_mostly watchdog_suspended;
164#ifdef CONFIG_SMP
165extern int sysctl_softlockup_all_cpu_backtrace;
166extern int sysctl_hardlockup_all_cpu_backtrace;
167#else
168#define sysctl_softlockup_all_cpu_backtrace 0
169#define sysctl_hardlockup_all_cpu_backtrace 0
170#endif
171
172#if defined(CONFIG_HARDLOCKUP_CHECK_TIMESTAMP) && \ 188#if defined(CONFIG_HARDLOCKUP_CHECK_TIMESTAMP) && \
173 defined(CONFIG_HARDLOCKUP_DETECTOR) 189 defined(CONFIG_HARDLOCKUP_DETECTOR)
174void watchdog_update_hrtimer_threshold(u64 period); 190void watchdog_update_hrtimer_threshold(u64 period);
@@ -176,7 +192,6 @@ void watchdog_update_hrtimer_threshold(u64 period);
176static inline void watchdog_update_hrtimer_threshold(u64 period) { } 192static inline void watchdog_update_hrtimer_threshold(u64 period) { }
177#endif 193#endif
178 194
179extern bool is_hardlockup(void);
180struct ctl_table; 195struct ctl_table;
181extern int proc_watchdog(struct ctl_table *, int , 196extern int proc_watchdog(struct ctl_table *, int ,
182 void __user *, size_t *, loff_t *); 197 void __user *, size_t *, loff_t *);
@@ -188,18 +203,6 @@ extern int proc_watchdog_thresh(struct ctl_table *, int ,
188 void __user *, size_t *, loff_t *); 203 void __user *, size_t *, loff_t *);
189extern int proc_watchdog_cpumask(struct ctl_table *, int, 204extern int proc_watchdog_cpumask(struct ctl_table *, int,
190 void __user *, size_t *, loff_t *); 205 void __user *, size_t *, loff_t *);
191extern int lockup_detector_suspend(void);
192extern void lockup_detector_resume(void);
193#else
194static inline int lockup_detector_suspend(void)
195{
196 return 0;
197}
198
199static inline void lockup_detector_resume(void)
200{
201}
202#endif
203 206
204#ifdef CONFIG_HAVE_ACPI_APEI_NMI 207#ifdef CONFIG_HAVE_ACPI_APEI_NMI
205#include <asm/nmi.h> 208#include <asm/nmi.h>