nmi.h 2.7 KB
Newer Older
L
Linus Torvalds 已提交
1 2 3 4 5 6
/*
 *  linux/include/linux/nmi.h
 */
#ifndef LINUX_NMI_H
#define LINUX_NMI_H

7
#include <linux/sched.h>
L
Linus Torvalds 已提交
8 9 10 11 12 13 14 15 16
#include <asm/irq.h>

/**
 * touch_nmi_watchdog - restart NMI watchdog timeout.
 * 
 * If the architecture supports the NMI watchdog, touch_nmi_watchdog()
 * may be used to reset the timeout - for code which intentionally
 * disables interrupts for a long time. This call is stateless.
 */
17
#if defined(CONFIG_HAVE_NMI_WATCHDOG) || defined(CONFIG_HARDLOCKUP_DETECTOR)
A
Andrew Morton 已提交
18
#include <asm/nmi.h>
19 20
extern void touch_nmi_watchdog(void);
#else
21 22 23 24
static inline void touch_nmi_watchdog(void)
{
	touch_softlockup_watchdog();
}
25
#endif
L
Linus Torvalds 已提交
26

27
#if defined(CONFIG_HARDLOCKUP_DETECTOR)
28
extern void hardlockup_detector_disable(void);
29
#else
30
static inline void hardlockup_detector_disable(void) {}
31 32
#endif

33 34 35 36 37 38 39 40
/*
 * Create trigger_all_cpu_backtrace() out of the arch-provided
 * base function. Return whether such support was available,
 * to allow calling code to fall back to some other mechanism:
 */
#ifdef arch_trigger_all_cpu_backtrace
static inline bool trigger_all_cpu_backtrace(void)
{
41
	arch_trigger_all_cpu_backtrace(true);
42 43 44

	return true;
}
45 46 47 48 49
static inline bool trigger_allbutself_cpu_backtrace(void)
{
	arch_trigger_all_cpu_backtrace(false);
	return true;
}
50 51 52 53 54 55

/* generic implementation */
void nmi_trigger_all_cpu_backtrace(bool include_self,
				   void (*raise)(cpumask_t *mask));
bool nmi_cpu_backtrace(struct pt_regs *regs);

56 57 58 59 60
#else
static inline bool trigger_all_cpu_backtrace(void)
{
	return false;
}
61 62 63 64
static inline bool trigger_allbutself_cpu_backtrace(void)
{
	return false;
}
A
Andrew Morton 已提交
65 66
#endif

67
#ifdef CONFIG_LOCKUP_DETECTOR
68
u64 hw_nmi_get_sample_period(int watchdog_thresh);
69
int hw_nmi_get_event(void);
70 71
extern int nmi_watchdog_enabled;
extern int soft_watchdog_enabled;
72
extern int watchdog_user_enabled;
73
extern int watchdog_thresh;
74
extern unsigned long *watchdog_cpumask_bits;
75
extern int sysctl_softlockup_all_cpu_backtrace;
76
extern int sysctl_hardlockup_all_cpu_backtrace;
77
struct ctl_table;
78 79 80 81 82 83 84 85
extern int proc_watchdog(struct ctl_table *, int ,
			 void __user *, size_t *, loff_t *);
extern int proc_nmi_watchdog(struct ctl_table *, int ,
			     void __user *, size_t *, loff_t *);
extern int proc_soft_watchdog(struct ctl_table *, int ,
			      void __user *, size_t *, loff_t *);
extern int proc_watchdog_thresh(struct ctl_table *, int ,
				void __user *, size_t *, loff_t *);
86 87
extern int proc_watchdog_cpumask(struct ctl_table *, int,
				 void __user *, size_t *, loff_t *);
88 89
extern int lockup_detector_suspend(void);
extern void lockup_detector_resume(void);
90
#else
91
static inline int lockup_detector_suspend(void)
92 93 94 95
{
	return 0;
}

96
static inline void lockup_detector_resume(void)
97 98
{
}
99 100
#endif

101 102 103 104
#ifdef CONFIG_HAVE_ACPI_APEI_NMI
#include <asm/nmi.h>
#endif

L
Linus Torvalds 已提交
105
#endif