写'V'到watchdog设备文件的意义
Meaning of writing 'V' to watchdog device file
我们做echo V > /dev/watchdog
是什么意思?一篇文章说它可以防止意外停止看门狗。我不清楚这个目的。
Documentation/watchdog/watchdog-api.txt
. However I think this document is partly obsolete since the watchdog driver unification 中(在某种程度上)对此进行了记录。向看门狗设备写入任何字符都会让看门狗知道系统处于活动状态。
如果没有进程写入/dev/watchdog
,则内核驱动不会ping硬件看门狗,看门狗超时后系统会重启。如果您想进行一些维护并且您更愿意确保维护完成而不冒重新启动的风险,即使这需要很长时间,这就是一个问题。如果写入字符V
,那么硬件看门狗将在writer进程关闭/dev/watchdog
时被禁用,并在/dev/watchdog
重新打开时重新启用。然后你想维护多久就维护多久
根据内核文档,这称为 'Magic Close' 功能
https://www.kernel.org/doc/Documentation/watchdog/watchdog-api.txt
Magic Close feature:
If a driver supports "Magic Close", the driver will not disable the
watchdog unless a specific magic character 'V' has been sent to
/dev/watchdog just before closing the file. If the userspace daemon
closes the file without sending this special character, the driver
will assume that the daemon (and userspace in general) died, and will
stop pinging the watchdog without disabling it first. This will then
cause a reboot if the watchdog is not re-opened in sufficient time.
我们做echo V > /dev/watchdog
是什么意思?一篇文章说它可以防止意外停止看门狗。我不清楚这个目的。
Documentation/watchdog/watchdog-api.txt
. However I think this document is partly obsolete since the watchdog driver unification 中(在某种程度上)对此进行了记录。向看门狗设备写入任何字符都会让看门狗知道系统处于活动状态。
如果没有进程写入/dev/watchdog
,则内核驱动不会ping硬件看门狗,看门狗超时后系统会重启。如果您想进行一些维护并且您更愿意确保维护完成而不冒重新启动的风险,即使这需要很长时间,这就是一个问题。如果写入字符V
,那么硬件看门狗将在writer进程关闭/dev/watchdog
时被禁用,并在/dev/watchdog
重新打开时重新启用。然后你想维护多久就维护多久
根据内核文档,这称为 'Magic Close' 功能 https://www.kernel.org/doc/Documentation/watchdog/watchdog-api.txt
Magic Close feature:
If a driver supports "Magic Close", the driver will not disable the
watchdog unless a specific magic character 'V' has been sent to
/dev/watchdog just before closing the file. If the userspace daemon
closes the file without sending this special character, the driver
will assume that the daemon (and userspace in general) died, and will
stop pinging the watchdog without disabling it first. This will then
cause a reboot if the watchdog is not re-opened in sufficient time.