]>
Commit | Line | Data |
---|---|---|
1fb9d6ad DZ |
1 | /* |
2 | * HW NMI watchdog support | |
3 | * | |
4 | * started by Don Zickus, Copyright (C) 2010 Red Hat, Inc. | |
5 | * | |
6 | * Arch specific calls to support NMI watchdog | |
7 | * | |
8 | * Bits copied from original nmi.c file | |
9 | * | |
10 | */ | |
5e85391b | 11 | #include <asm/apic.h> |
b52e0a7c | 12 | #include <asm/nmi.h> |
1fb9d6ad | 13 | |
1fb9d6ad | 14 | #include <linux/cpumask.h> |
7cbb7e7f DZ |
15 | #include <linux/kdebug.h> |
16 | #include <linux/notifier.h> | |
17 | #include <linux/kprobes.h> | |
1fb9d6ad | 18 | #include <linux/nmi.h> |
186f4360 | 19 | #include <linux/init.h> |
ca444564 | 20 | #include <linux/delay.h> |
1fb9d6ad | 21 | |
5f2b0ba4 | 22 | #ifdef CONFIG_HARDLOCKUP_DETECTOR |
4eec42f3 | 23 | u64 hw_nmi_get_sample_period(int watchdog_thresh) |
504d7cf1 | 24 | { |
4eec42f3 | 25 | return (u64)(cpu_khz) * 1000 * watchdog_thresh; |
504d7cf1 | 26 | } |
5f2b0ba4 | 27 | #endif |
504d7cf1 | 28 | |
2c6cb105 | 29 | #ifdef arch_trigger_all_cpu_backtrace |
4d7489ff | 30 | static void nmi_raise_cpu_backtrace(cpumask_t *mask) |
a9edc880 | 31 | { |
4d7489ff | 32 | apic->send_IPI_mask(mask, NMI_VECTOR); |
a9edc880 SRRH |
33 | } |
34 | ||
f3aca3d0 | 35 | void arch_trigger_all_cpu_backtrace(bool include_self) |
1fb9d6ad | 36 | { |
4d7489ff | 37 | nmi_trigger_all_cpu_backtrace(include_self, nmi_raise_cpu_backtrace); |
a9edc880 SRRH |
38 | } |
39 | ||
9326638c | 40 | static int |
9c48f1c6 | 41 | arch_trigger_all_cpu_backtrace_handler(unsigned int cmd, struct pt_regs *regs) |
7cbb7e7f | 42 | { |
4d7489ff | 43 | if (nmi_cpu_backtrace(regs)) |
9c48f1c6 | 44 | return NMI_HANDLED; |
7cbb7e7f | 45 | |
9c48f1c6 | 46 | return NMI_DONE; |
7cbb7e7f | 47 | } |
9326638c | 48 | NOKPROBE_SYMBOL(arch_trigger_all_cpu_backtrace_handler); |
7cbb7e7f | 49 | |
7cbb7e7f DZ |
50 | static int __init register_trigger_all_cpu_backtrace(void) |
51 | { | |
9c48f1c6 DZ |
52 | register_nmi_handler(NMI_LOCAL, arch_trigger_all_cpu_backtrace_handler, |
53 | 0, "arch_bt"); | |
7cbb7e7f DZ |
54 | return 0; |
55 | } | |
56 | early_initcall(register_trigger_all_cpu_backtrace); | |
2cc4452b | 57 | #endif |