2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* linux/include/linux/nmi.h
|
|
|
|
*/
|
|
|
|
#ifndef LINUX_NMI_H
|
|
|
|
#define LINUX_NMI_H
|
|
|
|
|
2006-09-29 16:59:03 +08:00
|
|
|
#include <linux/sched.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#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.
|
|
|
|
*/
|
2012-03-24 06:01:51 +08:00
|
|
|
#if defined(CONFIG_HAVE_NMI_WATCHDOG) || defined(CONFIG_HARDLOCKUP_DETECTOR)
|
2006-12-07 09:14:01 +08:00
|
|
|
#include <asm/nmi.h>
|
2010-11-30 06:07:16 +08:00
|
|
|
extern void touch_nmi_watchdog(void);
|
|
|
|
#else
|
2007-02-13 20:26:24 +08:00
|
|
|
static inline void touch_nmi_watchdog(void)
|
|
|
|
{
|
|
|
|
touch_softlockup_watchdog();
|
|
|
|
}
|
2010-11-30 06:07:16 +08:00
|
|
|
#endif
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2014-10-14 06:55:35 +08:00
|
|
|
#if defined(CONFIG_HARDLOCKUP_DETECTOR)
|
2015-04-15 06:44:19 +08:00
|
|
|
extern void hardlockup_detector_disable(void);
|
2014-10-14 06:55:35 +08:00
|
|
|
#else
|
2015-09-05 06:45:12 +08:00
|
|
|
static inline void hardlockup_detector_disable(void) {}
|
2014-10-14 06:55:35 +08:00
|
|
|
#endif
|
|
|
|
|
2009-08-03 15:31:54 +08:00
|
|
|
/*
|
|
|
|
* 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)
|
|
|
|
{
|
2014-06-24 04:22:05 +08:00
|
|
|
arch_trigger_all_cpu_backtrace(true);
|
2009-08-03 15:31:54 +08:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2014-06-24 04:22:05 +08:00
|
|
|
static inline bool trigger_allbutself_cpu_backtrace(void)
|
|
|
|
{
|
|
|
|
arch_trigger_all_cpu_backtrace(false);
|
|
|
|
return true;
|
|
|
|
}
|
2014-09-04 06:57:13 +08:00
|
|
|
|
|
|
|
/* generic implementation */
|
|
|
|
void nmi_trigger_all_cpu_backtrace(bool include_self,
|
|
|
|
void (*raise)(cpumask_t *mask));
|
|
|
|
bool nmi_cpu_backtrace(struct pt_regs *regs);
|
|
|
|
|
2009-08-03 15:31:54 +08:00
|
|
|
#else
|
|
|
|
static inline bool trigger_all_cpu_backtrace(void)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2014-06-24 04:22:05 +08:00
|
|
|
static inline bool trigger_allbutself_cpu_backtrace(void)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2006-12-07 09:14:01 +08:00
|
|
|
#endif
|
|
|
|
|
2010-05-08 05:11:44 +08:00
|
|
|
#ifdef CONFIG_LOCKUP_DETECTOR
|
2010-02-06 10:47:05 +08:00
|
|
|
int hw_nmi_is_cpu_stuck(struct pt_regs *);
|
2011-05-23 13:10:23 +08:00
|
|
|
u64 hw_nmi_get_sample_period(int watchdog_thresh);
|
2015-04-15 06:43:55 +08:00
|
|
|
extern int nmi_watchdog_enabled;
|
|
|
|
extern int soft_watchdog_enabled;
|
2013-05-20 02:45:15 +08:00
|
|
|
extern int watchdog_user_enabled;
|
2011-05-23 13:10:22 +08:00
|
|
|
extern int watchdog_thresh;
|
2015-06-25 07:55:45 +08:00
|
|
|
extern unsigned long *watchdog_cpumask_bits;
|
2014-06-24 04:22:05 +08:00
|
|
|
extern int sysctl_softlockup_all_cpu_backtrace;
|
2015-11-06 10:44:41 +08:00
|
|
|
extern int sysctl_hardlockup_all_cpu_backtrace;
|
2010-02-13 06:19:19 +08:00
|
|
|
struct ctl_table;
|
2015-04-15 06:44:08 +08:00
|
|
|
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 *);
|
2015-06-25 07:55:45 +08:00
|
|
|
extern int proc_watchdog_cpumask(struct ctl_table *, int,
|
|
|
|
void __user *, size_t *, loff_t *);
|
2015-09-05 06:45:28 +08:00
|
|
|
extern int lockup_detector_suspend(void);
|
|
|
|
extern void lockup_detector_resume(void);
|
2015-09-05 06:45:25 +08:00
|
|
|
#else
|
2015-09-05 06:45:28 +08:00
|
|
|
static inline int lockup_detector_suspend(void)
|
2015-09-05 06:45:25 +08:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-09-05 06:45:28 +08:00
|
|
|
static inline void lockup_detector_resume(void)
|
2015-09-05 06:45:25 +08:00
|
|
|
{
|
|
|
|
}
|
2010-02-06 10:47:05 +08:00
|
|
|
#endif
|
|
|
|
|
2014-07-22 17:20:12 +08:00
|
|
|
#ifdef CONFIG_HAVE_ACPI_APEI_NMI
|
|
|
|
#include <asm/nmi.h>
|
|
|
|
#endif
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
#endif
|