Re: [PATCH v2 2/3] power: reset: pscrr: add watchdog pretimeout reason tracking
Faruque Ansari <[email protected]> Fri, 31 Jul 2026 11:06:03 +0530
| 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]> |
Hi Matti, On 30-Jul-26 10:54 AM, Oleksij Rempel wrote: > Hi Matti, > > On Thu, Jul 30, 2026 at 07:49:41AM +0300, Matti Vaittinen wrote: >> On 22/07/2026 18:13, Faruque Ansari wrote: >>> Watchdog pretimeout resets are not recorded with a dedicated reset >>> reason, causing subsequent boots to report PSCR_UNKNOWN and making it >>> difficult to distinguish them from other unexpected resets. >>> >>> Add PSCR_WATCHDOG_PRETIMEOUT as a dedicated reset reason code and >>> prevent the panic notifier from overwriting a watchdog pretimeout >>> reason with PSCR_KERNEL_PANIC when the pretimeout governor triggers a >>> panic. >>> >>> Signed-off-by: Faruque Ansari <[email protected]> >>> --- >>> drivers/power/reset/pscrr.c | 7 ++++++- >>> include/linux/power/power_on_reason.h | 1 + >>> include/linux/reboot.h | 1 + >>> kernel/reboot.c | 1 + >>> 4 files changed, 9 insertions(+), 1 deletion(-) >>> >>> diff --git a/drivers/power/reset/pscrr.c b/drivers/power/reset/pscrr.c >>> index b5906f127e88..5b107c62fe82 100644 >>> --- a/drivers/power/reset/pscrr.c >>> +++ b/drivers/power/reset/pscrr.c >>> @@ -149,7 +149,12 @@ static int pscrr_panic_notifier(struct notifier_block *nb, >>> if (!backend || !backend->ops || !backend->ops->write_reason) >>> return NOTIFY_OK; >>> - set_psc_reason(PSCR_KERNEL_PANIC); >>> + /* >>> + * Do not overwrite a previously recorded watchdog pretimeout reason >>> + * during panic handling. >>> + */ >>> + if (get_psc_reason() != PSCR_WATCHDOG_PRETIMEOUT) >>> + set_psc_reason(PSCR_KERNEL_PANIC); >> >> Hi Faruque, >> >> I like the idea of adding WDG pretimeout resets in pscrr. I am just >> wondering what makes WDG reason so special, that it shouldn't be overwritten >> while other reasons can be? Can this notifier be called (now or in the >> future) so, that there are other reasons getting overwritten? I agree. WDG is not a special case - it is just one scenario that I have tested. There are many similar cases in the kernel. In the case of WDG, the WDG is the primary reason for the system reboot. The kernel panic is only a side effect of the WDG event. Therefore, I am recording the reboot reason based on the actual root cause, which is the reboot initiated by WDG. Yes, the notifier will still be called and may overwrite the reboot reason with another reason. Thanks, Faruque Ansari