[PATCH v2 2/3] power: reset: pscrr: add watchdog pretimeout reason tracking
From: Faruque Ansari
Date: Wed Jul 22 2026 - 11:21:57 EST
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 <faruque.ansari@xxxxxxxxxxxxxxxx>
---
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);
ret = backend->ops->write_reason(get_psc_reason());
if (ret)
pr_err("PSCRR: Failed to store reason %d (%s) at panic, err=%pe\n",
diff --git a/include/linux/power/power_on_reason.h b/include/linux/power/power_on_reason.h
index 4ac1bdfdc211..c5846c0ccde4 100644
--- a/include/linux/power/power_on_reason.h
+++ b/include/linux/power/power_on_reason.h
@@ -20,5 +20,6 @@
#define POWER_ON_REASON_OVER_TEMPERATURE "over temperature"
#define POWER_ON_REASON_EC_PANIC "EC panic"
#define POWER_ON_REASON_KERNEL_PANIC "kernel panic"
+#define POWER_ON_REASON_WATCHDOG_PRETIMEOUT "watchdog pretimeout"
#endif /* POWER_ON_REASON_H */
diff --git a/include/linux/reboot.h b/include/linux/reboot.h
index a492b1652038..fccbffc9dbef 100644
--- a/include/linux/reboot.h
+++ b/include/linux/reboot.h
@@ -237,6 +237,7 @@ enum psc_reason {
PSCR_OVER_TEMPERATURE,
PSCR_EC_PANIC,
PSCR_KERNEL_PANIC,
+ PSCR_WATCHDOG_PRETIMEOUT,
/* Number of reasons */
PSCR_REASON_COUNT,
diff --git a/kernel/reboot.c b/kernel/reboot.c
index f1df52f8773a..629002a951c2 100644
--- a/kernel/reboot.c
+++ b/kernel/reboot.c
@@ -1066,6 +1066,7 @@ static const char * const pscr_reason_strs[] = {
[PSCR_OVER_TEMPERATURE] = POWER_ON_REASON_OVER_TEMPERATURE,
[PSCR_EC_PANIC] = POWER_ON_REASON_EC_PANIC,
[PSCR_KERNEL_PANIC] = POWER_ON_REASON_KERNEL_PANIC,
+ [PSCR_WATCHDOG_PRETIMEOUT] = POWER_ON_REASON_WATCHDOG_PRETIMEOUT,
};
/**
--
2.34.1