Linux Power Management development
 help / color / mirror / Atom feed
From: Oleksij Rempel <o.rempel@pengutronix.de>
To: Matti Vaittinen <mazziesaccount@gmail.com>
Cc: "Faruque Ansari" <faruque.ansari@oss.qualcomm.com>,
	"Sebastian Reichel" <sre@kernel.org>,
	"Wim Van Sebroeck" <wim@linux-watchdog.org>,
	"Guenter Roeck" <linux@roeck-us.net>,
	"Benson Leung" <bleung@chromium.org>,
	"Tzung-Bi Shih" <tzungbi@kernel.org>,
	"Srinivas Kandagatla" <srini@kernel.org>,
	"Daniel Lezcano" <daniel.lezcano@kernel.org>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-watchdog@vger.kernel.org, linux-arm-msm@vger.org,
	kernel@pengutronix.de, "Liam Girdwood" <lgirdwood@gmail.com>,
	"Mark Brown" <broonie@kernel.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	"Zhang Rui" <rui.zhang@intel.com>,
	"Lukasz Luba" <lukasz.luba@arm.com>,
	"Søren Andersen" <san@skov.dk>,
	"Guenter Roeck" <groeck@chromium.org>,
	"Ahmad Fatoum" <a.fatoum@pengutronix.de>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	avaneesh.dwivedi@oss.qualcomm.com,
	"Umang Chheda" <umang.chheda@oss.qualcomm.com>,
	linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH v2 2/3] power: reset: pscrr: add watchdog pretimeout reason tracking
Date: Thu, 30 Jul 2026 07:24:28 +0200	[thread overview]
Message-ID: <amrgDC0s3rb5Xv4N@pengutronix.de> (raw)
In-Reply-To: <98e65507-3084-4948-8096-4e2d8d20dc81@gmail.com>

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 <faruque.ansari@oss.qualcomm.com>
> > ---
> >   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? For some
> reason I think the PSCRR was designed to be able to store multiple
> reasons(?)

It depends on the backed. A simple nvmem cell, would be able to hold
only one reason.

> Could you just add one more instead of overwriting existing - or
> should the check be more generic (to ensure the reason is only set if there
> is nothing to overwrite).

So, depending on the backed, we will have different policies. For
example, with one slot storage, we need to decided what to store:
first one or the last one.

In most cases, the initial one is most interesting. But, if we are
debugging system reset/reboot behavior, the last one.

> 
> If I am just completely lost (which happens), could you then improve the
> comment a bit to explain why WDG timeout is special and shouldn't be
> overwritten. The checking code itself is quite self-explatonary ;)

Good question. I included this patch to my refactoring, but didn't had
strong opinion haw to handle it. I guess, after introducing record
policy, this issue will be partially addressed:

https://github.com/olerem/linux-2.6/blob/v7.2/topic/pscr/Documentation/ABI/testing/sysfs-kernel-pscrr#L95

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

  reply	other threads:[~2026-07-30  5:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-22 15:12 [PATCH v2 0/3] power: reset: pscrr: record reset cause on panic and watchdog pretimeout Faruque Ansari
2026-07-22 15:13 ` [PATCH v2 1/3] power: reset: pscrr: add kernel panic reason tracking Faruque Ansari
2026-07-22 15:13 ` [PATCH v2 2/3] power: reset: pscrr: add watchdog pretimeout " Faruque Ansari
2026-07-30  4:49   ` Matti Vaittinen
2026-07-30  5:24     ` Oleksij Rempel [this message]
2026-07-22 15:13 ` [PATCH v2 3/3] watchdog: pretimeout: record PSC reason on watchdog pretimeout Faruque Ansari
2026-07-30  5:03   ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=amrgDC0s3rb5Xv4N@pengutronix.de \
    --to=o.rempel@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=akpm@linux-foundation.org \
    --cc=avaneesh.dwivedi@oss.qualcomm.com \
    --cc=bleung@chromium.org \
    --cc=broonie@kernel.org \
    --cc=daniel.lezcano@kernel.org \
    --cc=faruque.ansari@oss.qualcomm.com \
    --cc=groeck@chromium.org \
    --cc=kernel@pengutronix.de \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-arm-msm@vger.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=lukasz.luba@arm.com \
    --cc=mazziesaccount@gmail.com \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=san@skov.dk \
    --cc=sre@kernel.org \
    --cc=srini@kernel.org \
    --cc=tzungbi@kernel.org \
    --cc=umang.chheda@oss.qualcomm.com \
    --cc=wim@linux-watchdog.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox