Software watchdog patch
Sean Kelly
smkelly at zombie.org
Fri Jun 20 19:47:22 PDT 2003
Greetings.
I've been working on a patch which adds software watchdog to the FreeBSD
5.1-CURRENT kernel. Below is an URL to the patch to my work, and I'd
appreciate it if anybody interested in this venture would give me their
feedback on what I've got and also help debug it.
The patch is available here: http://www.sean-kelly.org/watchdog.diff
My watchdog patch is two pieces. One half is a kernel patch which adds the
watchdog timer checker to hardclock() in sys/kern/kern_clock.c. It also
adds a watchdog_fire() function which performs various things on a watchdog
timeout.
The userland half of the patch adds a watchdogd daemon which periodically
wakes up from a sleep to "notify" the kernel that the userland is still
intact.
This patch also adds a watchdogd(8) manpage, a watchdog(4) manpage, and an
/etc/rc.d/watchdogd startup script.
In order to utilize the watchdog, you must build a kernel with
options WATCHDOG
It is also advised that you enable watchdogd to /etc/rc.conf:
watchdogd_enable="YES"
Three new sysctls are added:
debug.watchdog.enabled
When this is non-zero, the watchdog is active and hardclock() is
verifying that the watchdog timer has not timed out.
debug.watchdog.timeout: 20
This is the number of seconds the watchdog can go without a timer
update.
debug.watchdog.reset: 0
When this sysctl is "touched" (read/write), it resets the
watchdog_ticks kernel variable to the value of ticks. When
(ticks - watchdog_ticks) > watchdog.timeout seconds, the watchdog
fires by calling watchdog_fire().
When the watchdog fires (watchdog_fire()), different things happen
depending on the kernel configuration. First, interrupt counts are dumped
to the console. Then, if your kernel was built with DDB support, you will
get a backtrace and be dropped to the DDB prompt. If your kernel has no DDB
support, your kernel will panic and presumably reboot itself.
Note that I attempted to stick to style(9). If I did not, please point out
my mistakes and I'll be happy to fix them. Also note that this is my first
venture writing manpages from scratch, so feel free to tear them apart and
mock me. However, I did read mdoc(7) and check them for warnings.
I look forward to any feedback, whether positive or negative.
--
Sean Kelly | PGP KeyID: D2E5E296
smkelly at zombie.org | http://www.zombie.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20030620/f7157b4a/attachment.bin
More information about the freebsd-current
mailing list