Re: [PATCH v2 3/3] watchdog: pretimeout: record PSC reason on watchdog pretimeout
Guenter Roeck <[email protected]> Wed, 29 Jul 2026 22:03:25 -0700
| Newsgroups | org.kernel.vger.linux-watchdog,org.kernel.vger.linux-arm-msm,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pm |
|---|---|
| Message-ID | <[email protected]> |
On 7/22/26 08:13, Faruque Ansari wrote: > Update the PSC reset reason by invoking set_psc_reason(PSCR_WATCHDOG_PRETIMEOUT) > from watchdog_notify_pretimeout() before either the panic or noop governor > runs, so the reset cause is committed to persistent storage before the > system goes down. > > Signed-off-by: Faruque Ansari <[email protected]> > --- > drivers/watchdog/watchdog_pretimeout.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/watchdog/watchdog_pretimeout.c b/drivers/watchdog/watchdog_pretimeout.c > index 02e09b9e396d..ea48d4eca4aa 100644 > --- a/drivers/watchdog/watchdog_pretimeout.c > +++ b/drivers/watchdog/watchdog_pretimeout.c > @@ -4,6 +4,7 @@ > */ > > #include <linux/list.h> > +#include <linux/reboot.h> > #include <linux/slab.h> > #include <linux/spinlock.h> > #include <linux/string.h> > @@ -103,6 +104,8 @@ void watchdog_notify_pretimeout(struct watchdog_device *wdd) > { > unsigned long flags; > > + set_psc_reason(PSCR_WATCHDOG_PRETIMEOUT); > + A call to watchdog_notify_pretimeout() does not necessarily reset the system. It only resets the system if the panic governor is active. Given that, I think this is a bit misleading. If the "noop" governor is active and the system crashes later due to a completely unrelated panic, the restart reason will be wrongly logged as pretimeout. Guenter > spin_lock_irqsave(&pretimeout_lock, flags); > if (!wdd->gov) { > spin_unlock_irqrestore(&pretimeout_lock, flags); >