procd: watchdog timeout is too high for sun8i
Username: Hal Martin
Origin: https://bugs.openwrt.org/index.php?do=details&task_id=2483
Device: Orange Pi M2 Ultra
Version: trunk
Steps to reproduce:
-
build trunk with the DTS for Orange Pi M2 Ultra
-
boot
-
wait 10 seconds
-
watchdog will reset the SoC
Problem:
- the default
wdt_drv_timeout
of procd is 30 seconds and cannot be changed in menuconfig (
https://git.openwrt.org/?p=project/procd.git;a=blob_plain;f=watchdog.c;hb=refs/heads/master
)
- the maximum timeout of the sun8i watchdog is 16 seconds (
)
wdt_frequency
is not low enough to prevent the sun8i watchdog from resetting the SoC
I was able to mitigate the watchdog reset with the following patch to procd:
--- a/watchdog.c 2019-09-06 06:13:52.293677306 +0000 +++ b/watchdog.c 2019-09-06 06:14:46.716987215 +0000 @@ -30,13 +30,13 @@
static struct uloop_timeout wdt_timeout; static int wdt_fd = -1; -static int wdt_drv_timeout = 30; -static int wdt_frequency = 5; +static int wdt_drv_timeout = 5; +static int wdt_frequency = 1; static bool wdt_magicclose = false;
void watchdog_ping(void) {
- DEBUG(4, "Ping\n");
-
DEBUG(4, "Ping watchdog\n"); if (wdt_fd >= 0 && write(wdt_fd, "X", 1) < 0) ERROR("WDT failed to write: %m\n"); } @@ -170,6 +170,7 @@ watchdog_timeout_cb(&wdt_timeout);
DEBUG(4, "Opened watchdog with timeout %ds\n", watchdog_timeout(0));
-
watchdog_ping(); }
I’m sorry but I don’t know enough C to provide a patch that includes a configurable watchdog timeout in the main menuconfig for procd.