nmi.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * linux/include/linux/nmi.h
  3. */
  4. #ifndef LINUX_NMI_H
  5. #define LINUX_NMI_H
  6. #include <linux/sched.h>
  7. #include <asm/irq.h>
  8. /**
  9. * touch_nmi_watchdog - restart NMI watchdog timeout.
  10. *
  11. * If the architecture supports the NMI watchdog, touch_nmi_watchdog()
  12. * may be used to reset the timeout - for code which intentionally
  13. * disables interrupts for a long time. This call is stateless.
  14. */
  15. #if defined(CONFIG_HAVE_NMI_WATCHDOG) || defined(CONFIG_HARDLOCKUP_DETECTOR_NMI)
  16. #include <asm/nmi.h>
  17. #endif
  18. #if defined(CONFIG_HAVE_NMI_WATCHDOG) || defined(CONFIG_HARDLOCKUP_DETECTOR)
  19. extern void touch_nmi_watchdog(void);
  20. #else
  21. static inline void touch_nmi_watchdog(void)
  22. {
  23. touch_softlockup_watchdog();
  24. }
  25. #endif
  26. #if defined(CONFIG_HARDLOCKUP_DETECTOR)
  27. extern void watchdog_enable_hardlockup_detector(bool val);
  28. extern bool watchdog_hardlockup_detector_is_enabled(void);
  29. #else
  30. static inline void watchdog_enable_hardlockup_detector(bool val)
  31. {
  32. }
  33. static inline bool watchdog_hardlockup_detector_is_enabled(void)
  34. {
  35. return true;
  36. }
  37. #endif
  38. /*
  39. * Create trigger_all_cpu_backtrace() out of the arch-provided
  40. * base function. Return whether such support was available,
  41. * to allow calling code to fall back to some other mechanism:
  42. */
  43. #ifdef arch_trigger_all_cpu_backtrace
  44. static inline bool trigger_all_cpu_backtrace(void)
  45. {
  46. #if defined(CONFIG_ARM)
  47. arch_trigger_all_cpu_backtrace();
  48. #else
  49. arch_trigger_all_cpu_backtrace(true);
  50. #endif
  51. return true;
  52. }
  53. static inline bool trigger_allbutself_cpu_backtrace(void)
  54. {
  55. #if defined(CONFIG_ARM)
  56. arch_trigger_all_cpu_backtrace();
  57. #else
  58. arch_trigger_all_cpu_backtrace(false);
  59. #endif
  60. return true;
  61. }
  62. #else
  63. static inline bool trigger_all_cpu_backtrace(void)
  64. {
  65. return false;
  66. }
  67. static inline bool trigger_allbutself_cpu_backtrace(void)
  68. {
  69. return false;
  70. }
  71. #endif
  72. #ifdef CONFIG_LOCKUP_DETECTOR
  73. int hw_nmi_is_cpu_stuck(struct pt_regs *);
  74. u64 hw_nmi_get_sample_period(int watchdog_thresh);
  75. extern int watchdog_user_enabled;
  76. extern int watchdog_thresh;
  77. extern int sysctl_softlockup_all_cpu_backtrace;
  78. struct ctl_table;
  79. extern int proc_dowatchdog(struct ctl_table *, int ,
  80. void __user *, size_t *, loff_t *);
  81. #endif
  82. #ifdef CONFIG_HAVE_ACPI_APEI_NMI
  83. #include <asm/nmi.h>
  84. #endif
  85. #endif