1 // SPDX-License-Identifier: GPL-2.0
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
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
;
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
))
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
,
57 early_initcall(register_nmi_cpu_backtrace_handler
);