views:

481

answers:

3

Processor AT91SAM9G20 kernel 2.6 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 or bootloader or kernel board is taking reboot. But once kernel comes up even though watchdog is not refreshed in any of the application board is not taking reset after 16 seconds. It takes 15 minutes. Who is refreshing watchdog? For us watchdog should be refreshed in application, so that board can take reset if application hangs.

These are the process running

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

Here watchdog is for soft lockups available in kernel-2.6.25-ts.at91sam9g20\kernel\softlockup.c

A: 

Wouldn't the kernel be refreshing the watchdog timer? The watchdog is designed to reset the board if the whole system hangs, not just a single application.

mdm
I searched whole kernel code. I didn't find any such things in kernel. If that is the case why it is taking reset after 15 minutes?
Shashikiran
+2  A: 

This may give you a hint: http://www.mjmwired.net/kernel/Documentation/watchdog/watchdog-api.txt

It makes perfect sense to have a user space daemon handling the watchdog. It probably defaults to a 15 minute timeout.

Richard Pennington
In user space no watchdog daemon is running.
Shashikiran
So there is no message in the log when the system reboots after 15 minutes? That's strange.
Richard Pennington
The 9G20 is an embedded processor, and probably has a ramdisk root volume. It may not have a persistent log.
Mike D.
the tail -f /var/log/messages should perhaps show something
shodanex
In /var/log/messages, no such information is available. Only kernel messages are present.
Shashikiran
+4  A: 

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

If no application opens the /dev/watchdog file, then the kernel takes care of restting the watchdog. Since it is a timer, it won't appears as a dedicated kernel thread, but will be handled by the soft IRQ thread. Now if an applications 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.

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 ocurs.

shodanex
Watchdog register is configured in bootstrap. Mode register is write once. Where kernel is refreshing watchdog. In our kernel code static void at91_ping(unsigned long data) function is not present. Is it possible to block kernel to stop refreshing?
Shashikiran