kernel/watchdog: remove unused declaration
[linux-2.6-microblaze.git] / include / linux / nmi.h
1 /*
2  *  linux/include/linux/nmi.h
3  */
4 #ifndef LINUX_NMI_H
5 #define LINUX_NMI_H
6
7 #include <linux/sched.h>
8 #include <asm/irq.h>
9
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 unsigned int  softlockup_panic;
16 extern unsigned int  hardlockup_panic;
17 void lockup_detector_init(void);
18 #else
19 static inline void touch_softlockup_watchdog_sched(void)
20 {
21 }
22 static inline void touch_softlockup_watchdog(void)
23 {
24 }
25 static inline void touch_softlockup_watchdog_sync(void)
26 {
27 }
28 static inline void touch_all_softlockup_watchdogs(void)
29 {
30 }
31 static inline void lockup_detector_init(void)
32 {
33 }
34 #endif
35
36 #ifdef CONFIG_DETECT_HUNG_TASK
37 void reset_hung_task_detector(void);
38 #else
39 static inline void reset_hung_task_detector(void)
40 {
41 }
42 #endif
43
44 /*
45  * The run state of the lockup detectors is controlled by the content of the
46  * 'watchdog_enabled' variable. Each lockup detector has its dedicated bit -
47  * bit 0 for the hard lockup detector and bit 1 for the soft lockup detector.
48  *
49  * 'watchdog_user_enabled', 'nmi_watchdog_enabled' and 'soft_watchdog_enabled'
50  * are variables that are only used as an 'interface' between the parameters
51  * in /proc/sys/kernel and the internal state bits in 'watchdog_enabled'. The
52  * 'watchdog_thresh' variable is handled differently because its value is not
53  * boolean, and the lockup detectors are 'suspended' while 'watchdog_thresh'
54  * is equal zero.
55  */
56 #define NMI_WATCHDOG_ENABLED_BIT   0
57 #define SOFT_WATCHDOG_ENABLED_BIT  1
58 #define NMI_WATCHDOG_ENABLED      (1 << NMI_WATCHDOG_ENABLED_BIT)
59 #define SOFT_WATCHDOG_ENABLED     (1 << SOFT_WATCHDOG_ENABLED_BIT)
60
61 /**
62  * touch_nmi_watchdog - restart NMI watchdog timeout.
63  * 
64  * If the architecture supports the NMI watchdog, touch_nmi_watchdog()
65  * may be used to reset the timeout - for code which intentionally
66  * disables interrupts for a long time. This call is stateless.
67  */
68 #if defined(CONFIG_HAVE_NMI_WATCHDOG) || defined(CONFIG_HARDLOCKUP_DETECTOR)
69 #include <asm/nmi.h>
70 extern void touch_nmi_watchdog(void);
71 #else
72 static inline void touch_nmi_watchdog(void)
73 {
74         touch_softlockup_watchdog();
75 }
76 #endif
77
78 #if defined(CONFIG_HARDLOCKUP_DETECTOR)
79 extern void hardlockup_detector_disable(void);
80 #else
81 static inline void hardlockup_detector_disable(void) {}
82 #endif
83
84 /*
85  * Create trigger_all_cpu_backtrace() out of the arch-provided
86  * base function. Return whether such support was available,
87  * to allow calling code to fall back to some other mechanism:
88  */
89 #ifdef arch_trigger_cpumask_backtrace
90 static inline bool trigger_all_cpu_backtrace(void)
91 {
92         arch_trigger_cpumask_backtrace(cpu_online_mask, false);
93         return true;
94 }
95
96 static inline bool trigger_allbutself_cpu_backtrace(void)
97 {
98         arch_trigger_cpumask_backtrace(cpu_online_mask, true);
99         return true;
100 }
101
102 static inline bool trigger_cpumask_backtrace(struct cpumask *mask)
103 {
104         arch_trigger_cpumask_backtrace(mask, false);
105         return true;
106 }
107
108 static inline bool trigger_single_cpu_backtrace(int cpu)
109 {
110         arch_trigger_cpumask_backtrace(cpumask_of(cpu), false);
111         return true;
112 }
113
114 /* generic implementation */
115 void nmi_trigger_cpumask_backtrace(const cpumask_t *mask,
116                                    bool exclude_self,
117                                    void (*raise)(cpumask_t *mask));
118 bool nmi_cpu_backtrace(struct pt_regs *regs);
119
120 #else
121 static inline bool trigger_all_cpu_backtrace(void)
122 {
123         return false;
124 }
125 static inline bool trigger_allbutself_cpu_backtrace(void)
126 {
127         return false;
128 }
129 static inline bool trigger_cpumask_backtrace(struct cpumask *mask)
130 {
131         return false;
132 }
133 static inline bool trigger_single_cpu_backtrace(int cpu)
134 {
135         return false;
136 }
137 #endif
138
139 #ifdef CONFIG_LOCKUP_DETECTOR
140 u64 hw_nmi_get_sample_period(int watchdog_thresh);
141 extern int nmi_watchdog_enabled;
142 extern int soft_watchdog_enabled;
143 extern int watchdog_user_enabled;
144 extern int watchdog_thresh;
145 extern unsigned long watchdog_enabled;
146 extern unsigned long *watchdog_cpumask_bits;
147 extern atomic_t watchdog_park_in_progress;
148 #ifdef CONFIG_SMP
149 extern int sysctl_softlockup_all_cpu_backtrace;
150 extern int sysctl_hardlockup_all_cpu_backtrace;
151 #else
152 #define sysctl_softlockup_all_cpu_backtrace 0
153 #define sysctl_hardlockup_all_cpu_backtrace 0
154 #endif
155 extern bool is_hardlockup(void);
156 struct ctl_table;
157 extern int proc_watchdog(struct ctl_table *, int ,
158                          void __user *, size_t *, loff_t *);
159 extern int proc_nmi_watchdog(struct ctl_table *, int ,
160                              void __user *, size_t *, loff_t *);
161 extern int proc_soft_watchdog(struct ctl_table *, int ,
162                               void __user *, size_t *, loff_t *);
163 extern int proc_watchdog_thresh(struct ctl_table *, int ,
164                                 void __user *, size_t *, loff_t *);
165 extern int proc_watchdog_cpumask(struct ctl_table *, int,
166                                  void __user *, size_t *, loff_t *);
167 extern int lockup_detector_suspend(void);
168 extern void lockup_detector_resume(void);
169 #else
170 static inline int lockup_detector_suspend(void)
171 {
172         return 0;
173 }
174
175 static inline void lockup_detector_resume(void)
176 {
177 }
178 #endif
179
180 #ifdef CONFIG_HAVE_ACPI_APEI_NMI
181 #include <asm/nmi.h>
182 #endif
183
184 #endif