From 7e48c8182dac8f0b57b7decfabcb0f858a7cff41 Mon Sep 17 00:00:00 2001 From: mpvader Date: Fri, 17 Aug 2018 13:15:23 +0200 Subject: [PATCH] watchdog: prioritize stopping it over all else during reboot 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 https://github.com/victronenergy/venus/issues/312 --- meta-venus/recipes-extended/watchdog/files/init | 1 + meta-venus/recipes-extended/watchdog/watchdog_%.bbappend | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/meta-venus/recipes-extended/watchdog/files/init b/meta-venus/recipes-extended/watchdog/files/init index 9c5d74a53..56f9d73b9 100644 --- a/meta-venus/recipes-extended/watchdog/files/init +++ b/meta-venus/recipes-extended/watchdog/files/init @@ -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) diff --git a/meta-venus/recipes-extended/watchdog/watchdog_%.bbappend b/meta-venus/recipes-extended/watchdog/watchdog_%.bbappend index 8b6dc7cb6..96a3edb35 100644 --- a/meta-venus/recipes-extended/watchdog/watchdog_%.bbappend +++ b/meta-venus/recipes-extended/watchdog/watchdog_%.bbappend @@ -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} \