2 * linux/include/linux/nmi.h
7 #include <linux/sched.h>
10 #ifdef CONFIG_LOCKUP_DETECTOR
11 extern void touch_softlockup_watchdog_sched(void);
12 extern void touch_softlockup_watchdog(void);
13 extern void touch_softlockup_watchdog_sync(void);
14 extern void touch_all_softlockup_watchdogs(void);
15 extern int proc_dowatchdog_thresh(struct ctl_table
*table
, int write
,
17 size_t *lenp
, loff_t
*ppos
);
18 extern unsigned int softlockup_panic
;
19 extern unsigned int hardlockup_panic
;
20 void lockup_detector_init(void);
22 static inline void touch_softlockup_watchdog_sched(void)
25 static inline void touch_softlockup_watchdog(void)
28 static inline void touch_softlockup_watchdog_sync(void)
31 static inline void touch_all_softlockup_watchdogs(void)
34 static inline void lockup_detector_init(void)
39 #ifdef CONFIG_DETECT_HUNG_TASK
40 void reset_hung_task_detector(void);
42 static inline void reset_hung_task_detector(void)
48 * The run state of the lockup detectors is controlled by the content of the
49 * 'watchdog_enabled' variable. Each lockup detector has its dedicated bit -
50 * bit 0 for the hard lockup detector and bit 1 for the soft lockup detector.
52 * 'watchdog_user_enabled', 'nmi_watchdog_enabled' and 'soft_watchdog_enabled'
53 * are variables that are only used as an 'interface' between the parameters
54 * in /proc/sys/kernel and the internal state bits in 'watchdog_enabled'. The
55 * 'watchdog_thresh' variable is handled differently because its value is not
56 * boolean, and the lockup detectors are 'suspended' while 'watchdog_thresh'
59 #define NMI_WATCHDOG_ENABLED_BIT 0
60 #define SOFT_WATCHDOG_ENABLED_BIT 1
61 #define NMI_WATCHDOG_ENABLED (1 << NMI_WATCHDOG_ENABLED_BIT)
62 #define SOFT_WATCHDOG_ENABLED (1 << SOFT_WATCHDOG_ENABLED_BIT)
65 * touch_nmi_watchdog - restart NMI watchdog timeout.
67 * If the architecture supports the NMI watchdog, touch_nmi_watchdog()
68 * may be used to reset the timeout - for code which intentionally
69 * disables interrupts for a long time. This call is stateless.
71 #if defined(CONFIG_HAVE_NMI_WATCHDOG) || defined(CONFIG_HARDLOCKUP_DETECTOR)
73 extern void touch_nmi_watchdog(void);
75 static inline void touch_nmi_watchdog(void)
77 touch_softlockup_watchdog();
81 #if defined(CONFIG_HARDLOCKUP_DETECTOR)
82 extern void hardlockup_detector_disable(void);
84 static inline void hardlockup_detector_disable(void) {}
88 * Create trigger_all_cpu_backtrace() out of the arch-provided
89 * base function. Return whether such support was available,
90 * to allow calling code to fall back to some other mechanism:
92 #ifdef arch_trigger_cpumask_backtrace
93 static inline bool trigger_all_cpu_backtrace(void)
95 arch_trigger_cpumask_backtrace(cpu_online_mask
, false);
99 static inline bool trigger_allbutself_cpu_backtrace(void)
101 arch_trigger_cpumask_backtrace(cpu_online_mask
, true);
105 static inline bool trigger_cpumask_backtrace(struct cpumask
*mask
)
107 arch_trigger_cpumask_backtrace(mask
, false);
111 static inline bool trigger_single_cpu_backtrace(int cpu
)
113 arch_trigger_cpumask_backtrace(cpumask_of(cpu
), false);
117 /* generic implementation */
118 void nmi_trigger_cpumask_backtrace(const cpumask_t
*mask
,
120 void (*raise
)(cpumask_t
*mask
));
121 bool nmi_cpu_backtrace(struct pt_regs
*regs
);
124 static inline bool trigger_all_cpu_backtrace(void)
128 static inline bool trigger_allbutself_cpu_backtrace(void)
132 static inline bool trigger_cpumask_backtrace(struct cpumask
*mask
)
136 static inline bool trigger_single_cpu_backtrace(int cpu
)
142 #ifdef CONFIG_LOCKUP_DETECTOR
143 u64
hw_nmi_get_sample_period(int watchdog_thresh
);
144 extern int nmi_watchdog_enabled
;
145 extern int soft_watchdog_enabled
;
146 extern int watchdog_user_enabled
;
147 extern int watchdog_thresh
;
148 extern unsigned long watchdog_enabled
;
149 extern unsigned long *watchdog_cpumask_bits
;
150 extern atomic_t watchdog_park_in_progress
;
152 extern int sysctl_softlockup_all_cpu_backtrace
;
153 extern int sysctl_hardlockup_all_cpu_backtrace
;
155 #define sysctl_softlockup_all_cpu_backtrace 0
156 #define sysctl_hardlockup_all_cpu_backtrace 0
158 extern bool is_hardlockup(void);
160 extern int proc_watchdog(struct ctl_table
*, int ,
161 void __user
*, size_t *, loff_t
*);
162 extern int proc_nmi_watchdog(struct ctl_table
*, int ,
163 void __user
*, size_t *, loff_t
*);
164 extern int proc_soft_watchdog(struct ctl_table
*, int ,
165 void __user
*, size_t *, loff_t
*);
166 extern int proc_watchdog_thresh(struct ctl_table
*, int ,
167 void __user
*, size_t *, loff_t
*);
168 extern int proc_watchdog_cpumask(struct ctl_table
*, int,
169 void __user
*, size_t *, loff_t
*);
170 extern int lockup_detector_suspend(void);
171 extern void lockup_detector_resume(void);
173 static inline int lockup_detector_suspend(void)
178 static inline void lockup_detector_resume(void)
183 #ifdef CONFIG_HAVE_ACPI_APEI_NMI