hugetlb: introduce generic version of hugetlb_free_pgd_range
[linux/fpc-iii.git] / arch / x86 / kernel / apic / hw_nmi.c
blobd1fc62a6732074dca8a376664a80e8a7099dcae0
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * HW NMI watchdog support
5 * started by Don Zickus, Copyright (C) 2010 Red Hat, Inc.
7 * Arch specific calls to support NMI watchdog
9 * Bits copied from original nmi.c file
12 #include <asm/apic.h>
13 #include <asm/nmi.h>
15 #include <linux/cpumask.h>
16 #include <linux/kdebug.h>
17 #include <linux/notifier.h>
18 #include <linux/kprobes.h>
19 #include <linux/nmi.h>
20 #include <linux/init.h>
21 #include <linux/delay.h>
23 #ifdef CONFIG_HARDLOCKUP_DETECTOR_PERF
24 u64 hw_nmi_get_sample_period(int watchdog_thresh)
26 return (u64)(cpu_khz) * 1000 * watchdog_thresh;
28 #endif
30 #ifdef arch_trigger_cpumask_backtrace
31 static void nmi_raise_cpu_backtrace(cpumask_t *mask)
33 apic->send_IPI_mask(mask, NMI_VECTOR);
36 void arch_trigger_cpumask_backtrace(const cpumask_t *mask, bool exclude_self)
38 nmi_trigger_cpumask_backtrace(mask, exclude_self,
39 nmi_raise_cpu_backtrace);
42 static int nmi_cpu_backtrace_handler(unsigned int cmd, struct pt_regs *regs)
44 if (nmi_cpu_backtrace(regs))
45 return NMI_HANDLED;
47 return NMI_DONE;
49 NOKPROBE_SYMBOL(nmi_cpu_backtrace_handler);
51 static int __init register_nmi_cpu_backtrace_handler(void)
53 register_nmi_handler(NMI_LOCAL, nmi_cpu_backtrace_handler,
54 0, "arch_bt");
55 return 0;
57 early_initcall(register_nmi_cpu_backtrace_handler);
58 #endif