Skip to content

Commit

Permalink
watchdog: prioritize stopping it over all else during reboot
Browse files Browse the repository at this point in the history
A device hanging itself up during shutdown as part of a reboot is stupid.
Therefore, the first to do when initiating a reboot is to stop the watchdog.

The processes stopped before the watchdog where:
K15svscanboot.sh -> ../init.d/svscanboot.sh
K20dbus-1 -> ../init.d/dbus-1
K20dnsmasq -> ../init.d/dnsmasq
K20hwclock.sh -> ../init.d/hwclock.sh
K20resolv-watch -> ../init.d/resolv-watch
K20syslog -> ../init.d/syslog
K20watchdog -> ../init.d/watchdog

With this commit its the first thing.

Wouldn't this risk interrupting a reboot that was otherwise OK?

No the kernel driver expects a write to the watchdog device every minute.
The userland watchdog process updates the kernel every 10 seconds: stopping
it therefore leaves at least 50 seconds for the device to reboot.

Also add a message to the syslog, to make the log file clear:
Aug 17 11:07:07 ccgx user.notice shutdown[2127]: shutting down for system reboot
Aug 17 11:07:07 ccgx daemon.info init: Switching to runlevel: 6
Aug 17 11:07:07 ccgx user.notice root: Stopping watchdog (keeping hw watchdog alive)
Aug 17 11:07:07 ccgx user.crit kernel: [  236.577026] omap_wdt: Unexpected close, not stopping!

closes victronenergy/venus#312
  • Loading branch information
mpvader committed Aug 19, 2018
1 parent 4debdc1 commit 7e48c81
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions meta-venus/recipes-extended/watchdog/files/init
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ case "$1" in
stop)
# note: this forcefully kill the watchdog process, keeping the hw watchdog active
echo "Stopping $DESC (keeping hw watchdog alive)"
logger "Stopping $DESC (keeping hw watchdog alive)"
killall -9 watchdog
;;
disable)
Expand Down
2 changes: 1 addition & 1 deletion meta-venus/recipes-extended/watchdog/watchdog_%.bbappend
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SRC_URI += "\

INITSCRIPT_PACKAGES = "${PN}"
INITSCRIPT_NAME_${PN} = "watchdog"
INITSCRIPT_PARAMS_${PN} = "start 80 S . stop 20 0 1 6 ."
INITSCRIPT_PARAMS_${PN} = "start 80 S . stop 00 0 1 6 ."

do_compile_append () {
${CC} ${CFLAGS} ${LDFLAGS} -DMACH_${MACHINE} \
Expand Down

0 comments on commit 7e48c81

Please sign in to comment.