linux - 关于 Linux NMI 看门狗

标签 linux performancecounter watchdog apic

现在我遇到一个关于 Linux NMI Watchdog 的问题。 我想使用 Linux NMI 看门狗来检测和恢复操作系统挂起。因此,我将“nmi_watchdog=1”添加到 grub.cfg 中。然后检查 /proc/interrupt,NMI 每秒触发一次。但是在我加载一个带有死锁(双获取自旋锁)的模块后,系统完全挂起,什么也没有发生(永远不要 panic !)。看起来 NMI 看门狗没有工作!

然后我阅读了 Documentation/nmi_watchdog.txt,它说:

Be aware that when using local APIC, the frequency of NMI interrupts it generates, depends on the system load. The local APIC NMI watchdog, lacking a better source, uses the "cycles unhalted" event.

什么是“cycles unhalted”事件?

它补充说:

but if your system locks up on anything but the "hlt" processor instruction, the watchdog will trigger very soon as the "cycles unhalted" event will happen every clock tick...If it locks up on "hlt", then you are out of luck -- the event will not happen at all and the watchdog won't trigger.

如果处理器执行“hlt”指令,看门狗似乎不会触发,然后我在“Intel 64 and IA-32 Architectures Software Developer's Manual, Volumn 2A”中搜索“hlt”,它描述如下:

Stops instruction execution and places the processor in a HALT state. An enabled interrupt (including NMI and SMI), a debug exception, the BINIT# signal, the INIT# signal, or the RESET# signal will resume execution.

然后我迷路了...

我的问题是:

  • Linux NMI 看门狗如何工作?
  • 触发了 NMI?

我的操作系统是 Ubuntu 10.04 LTS、Linux-2.6.32.21、CPU Pentium 4 双核 3.20 GHz。

我没有阅读有关 NMI watchdog 的整个源代码(没时间),如果我不能理解 NMI watchdog 是如何工作的,我想使用性能监控计数器中断inter - 处理器中断(由 APIC 提供)以发送 NMI 而不是 NMI 看门狗。

最佳答案

答案取决于您的硬件。

不可屏蔽中断 (NMI) 可以通过两种方式触发:1) 当内核达到无法被其他方法中断的暂停状态时,以及 2) 由硬件触发——使用 NMI 按钮。

例如,在某些戴尔服务器的正面,您会看到一个小圆圈,里面有一条锯齿形线。这是 NMI 符号。附近有一个洞。插入引脚以触发中断。如果您的内核是为支持它而构建的,这会将内核崩溃跟踪转储到控制台,然后重新启动系统。

这可能发生得非常快。因此,如果您没有连接控制台来将输出保存到文件,它可能看起来只是重新启动。

关于linux - 关于 Linux NMI 看门狗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9865952/

相关文章:

powershell - 创建性能计数器 PowerShell : The Counter layout for the Category specified is invalid

mongodb - 计数提高性能

c - STM32f429ZI 无需调试器即可记录调用堆栈

c - 将 watchdog_set_period 设置为最大值会导致重启

c - 如何在C代码中区分armhf(ARMv7)和armel(ARMv4)?

linux - 如何将我的本地 docker 图像导出到 tar 并在另一台计算机上加载

linux - 如何在 Intel CPU 上找到 L3 Cache 参数?

linux - 修改glibc的编译步骤

c# - 当前进程的性能计数器 CPU 使用率超过 100

systemd - 如何在 systemd 的看门狗停止服务之前运行特定程序