nmi.c (2d0740c4562493b60f59ca9b0330a2d5e01d43ec) nmi.c (59abbd1e7cfd6018fb8e58a96aa562aaff8711e7)
1/* Pseudo NMI support on sparc64 systems.
2 *
3 * Copyright (C) 2009 David S. Miller <davem@davemloft.net>
4 *
5 * The NMI watchdog support and infrastructure is based almost
6 * entirely upon the x86 NMI support code.
7 */
8#include <linux/kernel.h>

--- 5 unchanged lines hidden (view full) ---

14#include <linux/kprobes.h>
15#include <linux/kernel_stat.h>
16#include <linux/reboot.h>
17#include <linux/slab.h>
18#include <linux/kdebug.h>
19#include <linux/delay.h>
20#include <linux/smp.h>
21
1/* Pseudo NMI support on sparc64 systems.
2 *
3 * Copyright (C) 2009 David S. Miller <davem@davemloft.net>
4 *
5 * The NMI watchdog support and infrastructure is based almost
6 * entirely upon the x86 NMI support code.
7 */
8#include <linux/kernel.h>

--- 5 unchanged lines hidden (view full) ---

14#include <linux/kprobes.h>
15#include <linux/kernel_stat.h>
16#include <linux/reboot.h>
17#include <linux/slab.h>
18#include <linux/kdebug.h>
19#include <linux/delay.h>
20#include <linux/smp.h>
21
22#include <asm/perf_counter.h>
22#include <asm/ptrace.h>
23#include <asm/local.h>
24#include <asm/pcr.h>
25
26/* We don't have a real NMI on sparc64, but we can fake one
27 * up using profiling counter overflow interrupts and interrupt
28 * levels.
29 *

--- 121 unchanged lines hidden (view full) ---

151 "Please report this to bugzilla.kernel.org,\n");
152 printk(KERN_WARNING
153 "and attach the output of the 'dmesg' command.\n");
154
155 per_cpu(wd_enabled, cpu) = 0;
156 atomic_dec(&nmi_active);
157}
158
23#include <asm/ptrace.h>
24#include <asm/local.h>
25#include <asm/pcr.h>
26
27/* We don't have a real NMI on sparc64, but we can fake one
28 * up using profiling counter overflow interrupts and interrupt
29 * levels.
30 *

--- 121 unchanged lines hidden (view full) ---

152 "Please report this to bugzilla.kernel.org,\n");
153 printk(KERN_WARNING
154 "and attach the output of the 'dmesg' command.\n");
155
156 per_cpu(wd_enabled, cpu) = 0;
157 atomic_dec(&nmi_active);
158}
159
159static void stop_nmi_watchdog(void *unused)
160void stop_nmi_watchdog(void *unused)
160{
161 pcr_ops->write(PCR_PIC_PRIV);
162 __get_cpu_var(wd_enabled) = 0;
163 atomic_dec(&nmi_active);
164}
165
166static int __init check_nmi_watchdog(void)
167{

--- 37 unchanged lines hidden (view full) ---

205
206 kfree(prev_nmi_count);
207 return 0;
208error:
209 on_each_cpu(stop_nmi_watchdog, NULL, 1);
210 return err;
211}
212
161{
162 pcr_ops->write(PCR_PIC_PRIV);
163 __get_cpu_var(wd_enabled) = 0;
164 atomic_dec(&nmi_active);
165}
166
167static int __init check_nmi_watchdog(void)
168{

--- 37 unchanged lines hidden (view full) ---

206
207 kfree(prev_nmi_count);
208 return 0;
209error:
210 on_each_cpu(stop_nmi_watchdog, NULL, 1);
211 return err;
212}
213
213static void start_nmi_watchdog(void *unused)
214void start_nmi_watchdog(void *unused)
214{
215 __get_cpu_var(wd_enabled) = 1;
216 atomic_inc(&nmi_active);
217
218 pcr_ops->write(PCR_PIC_PRIV);
219 write_pic(picl_value(nmi_hz));
220
221 pcr_ops->write(pcr_enable);

--- 36 unchanged lines hidden (view full) ---

258 err = check_nmi_watchdog();
259 if (!err) {
260 err = register_reboot_notifier(&nmi_reboot_notifier);
261 if (err) {
262 on_each_cpu(stop_nmi_watchdog, NULL, 1);
263 atomic_set(&nmi_active, -1);
264 }
265 }
215{
216 __get_cpu_var(wd_enabled) = 1;
217 atomic_inc(&nmi_active);
218
219 pcr_ops->write(PCR_PIC_PRIV);
220 write_pic(picl_value(nmi_hz));
221
222 pcr_ops->write(pcr_enable);

--- 36 unchanged lines hidden (view full) ---

259 err = check_nmi_watchdog();
260 if (!err) {
261 err = register_reboot_notifier(&nmi_reboot_notifier);
262 if (err) {
263 on_each_cpu(stop_nmi_watchdog, NULL, 1);
264 atomic_set(&nmi_active, -1);
265 }
266 }
267 if (!err)
268 init_hw_perf_counters();
269
266 return err;
267}
268
269static int __init setup_nmi_watchdog(char *str)
270{
271 if (!strncmp(str, "panic", 5))
272 panic_on_timeout = 1;
273
274 return 0;
275}
276__setup("nmi_watchdog=", setup_nmi_watchdog);
270 return err;
271}
272
273static int __init setup_nmi_watchdog(char *str)
274{
275 if (!strncmp(str, "panic", 5))
276 panic_on_timeout = 1;
277
278 return 0;
279}
280__setup("nmi_watchdog=", setup_nmi_watchdog);