linux
linux copied to clipboard
[aspeed_wdt] watchdog is auto-pinged by kernel thread
Watchdog is pinged by system thread (watchdogd) if it's either active or running, this code is implemented in watchdog_dev.c in watchdog_ping function:
if (!watchdog_active(wdd) && !watchdog_hw_running(wdd))
return 0;
The hardware driver synchronizes the status field of the device structure to the actual hardware status:
if (readl(wdt->base + WDT_CTRL) & WDT_CTRL_ENABLE) {
/*
* The watchdog is running, but invoke aspeed_wdt_start() to
* write wdt->ctrl to WDT_CTRL to ensure the watchdog's
* configuration conforms to the driver's expectations.
* Primarily, ensure we're using the 1MHz clock source.
*/
aspeed_wdt_start(&wdt->wdd);
set_bit(WDOG_HW_RUNNING, &wdt->wdd.status);
}
The issue here is that if we start the wdt in u-boot to protect from kernel hang or damaged ROFS, the kernel will ping the watchdog, so we loose the protection.
Looks like the WDOG_ACTIVE should also be set here:
set_bit(WDOG_HW_RUNNING, &wdt->wdd.status);
+ set_bit(WDOG_ACTIVE, &wdt->wdd.status);