谁在刷新 Linux 中的硬件看门狗? [英] Who is refreshing hardware watchdog in Linux?

查看:24
本文介绍了谁在刷新 Linux 中的硬件看门狗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个运行 2.6 内核的处理器 AT91SAM9G20.看门狗在引导级别启用并配置为 16 秒.看门狗模式寄存器只能配置一次.当代码在引导程序、引导加载程序或内核中挂起时,电路板会重新启动.但是一旦内核启动,即使在任何应用程序中没有刷新看门狗,16 秒后板也不会被重置,而是 15 分钟.

I have a processor AT91SAM9G20 running a 2.6 kernel. Watchdog is enabled at bootstrap level and configured for 16 seconds. Watchdog mode register can be configured only once. When code hangs either in bootstrap, bootloader or kernel, the board reboots. But once kernel comes up even though watchdog is not refreshed in any of the applications, the board is not being reset after 16 seconds, but 15 minutes.

谁在刷新看门狗?

在我们的例子中,看门狗应该受到应用程序的影响,以便在我们的应用程序挂起时电路板可以重置.

In our case, the watchdog should be influenced by applications, so that the board can reset if our application hangs.

这些是正在运行的进程:

These are the running processes:

1 root     init
2 root     [kthreadd]
3 root     [ksoftirqd/0]
4 root     [watchdog/0]
5 root     [events/0]
6 root     [khelper]
63 root     [kblockd/0]
72 root     [ksuspend_usbd]
78 root     [khubd]
85 root     [kmmcd]
107 root     [pdflush]
108 root     [pdflush]
109 root     [kswapd0]
110 root     [aio/0]
740 root     [mtdblockd]
828 root     [rpciod/0]
982 root     [jffs2_gcd_mtd10]
1003 root     /sbin/udevd -d
1145 daemon   portmap
1158 dbus     dbus-daemon --system
1178 root     /usr/sbin/ifplugd -i eth0 -fwI -u0 -d5 -l -q
1190 root     /usr/sbin/ifplugd -i eth1 -fwI -u0 -d5 -l -q
1221 default  avahi-daemon: running [SP14.local]
1226 root     /usr/sbin/dropbear
1246 root     /root/bin/host_app
1254 root     /root/bin/mini_httpd -c *.cgi -d /root/bin -u root -E /root/bin/
1256 root     -sh
1257 root     /sbin/syslogd -n -m 0
1258 root     /sbin/klogd -n
1259 root     /usr/bin/tail -f /var/log/messages
1265 root     ps -e

我们正在使用 kernel-2.6.25-ts.at91sam9g20/kernel/softlockup.c 中提供的软锁看门狗

We are using the watchdog for soft lockups available in kernel-2.6.25-ts.at91sam9g20/kernel/softlockup.c

推荐答案

如果您在内核中启用了看门狗驱动程序,那么看门狗驱动程序会设置一个内核定时器,负责重置看门狗.对应的代码在这里.所以它是这样工作的:

If you enabled the watchdog driver in your kernel, the watchdog driver sets up a kernel timer, in charge of resetting the watchdog. The corresponding code is here. So it works like this:

如果没有应用程序打开/dev/watchdog 文件,则内核会负责重置看门狗.由于它是一个定时器,它不会作为一个专用的内核线程出现,而是由软 IRQ 线程处理.现在,如果应用程序打开此文件,它将负责看门狗,并且可以通过写入文件来重置它,如 Richard 帖子中链接的文档所述.

If no application opens the /dev/watchdog file, then the kernel takes care of resetting the watchdog. Since it is a timer, it won't appear as a dedicated kernel thread, but handled by the soft IRQ thread. Now, if an application opens this file, it becomes responsible of the watchdog, and can reset it by writing to the file, as documented by the documentation linked in Richard's post.

您的内核中是否配置了看门狗驱动程序?如果没有,您应该配置它,并查看重置是否仍然发生.如果它仍然发生,很可能你的重置来自其他地方.

Is the watchdog driver configured in your kernel? If not, you should configure it, and see if the reset still happens. If it still happens, it is likely that your reset comes from somewhere else.

如果您的内核太旧而没有合适的看门狗驱动程序(2.6.25 中不存在),您应该从 2.6.28 向后移植它.或者,您可以尝试禁用引导加载程序中的看门狗,看看是否仍会发生重置.

If your kernel is too old to have a proper watchdog driver (not present in 2.6.25) you should backport it from 2.6.28. Or you can try to disable the watchdog in your bootloader and see if the reset still occurs.

这篇关于谁在刷新 Linux 中的硬件看门狗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆