From: Oleksij Rempel <o.rempel@pengutronix.de>
To: Sebastian Reichel <sebastian.reichel@collabora.com>
Cc: "Srinivas Kandagatla" <srinivas.kandagatla@linaro.org>,
"Benson Leung" <bleung@chromium.org>,
"Tzung-Bi Shih" <tzungbi@kernel.org>,
"Daniel Lezcano" <daniel.lezcano@linaro.org>,
"Matti Vaittinen" <mazziesaccount@gmail.com>,
kernel@pengutronix.de, linux-kernel@vger.kernel.org,
"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>,
linux-pm@vger.kernel.org, "Søren Andersen" <san@skov.dk>,
"Guenter Roeck" <groeck@chromium.org>,
"Ahmad Fatoum" <a.fatoum@pengutronix.de>,
"Andrew Morton" <akpm@linux-foundation.org>,
chrome-platform@lists.linux.dev
Subject: Re: [PATCH v9 3/7] power: reset: Introduce PSCR Recording Framework for Non-Volatile Storage
Date: Fri, 2 May 2025 07:22:55 +0200 [thread overview]
Message-ID: <aBRWrwY6YN0526SN@pengutronix.de> (raw)
In-Reply-To: <bumx6ma3kjanapwaf3oc3mdjnekatvc2cmavt6secfkaapgjpz@kouqjidbl47k>
Hi Sebastian,
Thanks for the feedback.
On Fri, May 02, 2025 at 01:20:50AM +0200, Sebastian Reichel wrote:
> Hi,
>
> On Tue, Apr 22, 2025 at 10:57:13AM +0200, Oleksij Rempel wrote:
> > This commit introduces the Power State Change Reasons Recording (PSCRR)
> > framework. It provides a generic mechanism to store shutdown or reboot
> > reasons, such as under-voltage, thermal events, or software-triggered
> > actions, into non-volatile storage.
> >
> > PSCRR is primarily intended for systems where software is able to detect
> > a power event in time and store the reason—typically when backup power
> > (e.g., capacitors) allows a short window before shutdown. This enables
> > reliable postmortem diagnostics, even on devices where traditional storage
> > like eMMC or NAND may not survive abrupt power loss.
> >
> > In its current form, PSCRR focuses on software-reported reasons. However,
> > the framework is also designed with future extensibility in mind and could
> > serve as a central frontend for exposing hardware-reported reset reasons
> > from sources such as PMICs, watchdogs, or SoC-specific registers.
> >
> > This version does not yet integrate such hardware-based reporting.
>
> This adds quite some complex code for a very specific problem while
> mostly ignoring the common case of hardware reported reasons. I think
> having at least one hardware-reported reasons (e.g. WDOG) is mandatory
> to make sure the framework can really handle it.
The initial purpose of the PSCRR framework is to record power state
change reasons such as *undervoltage* or *regulator failures*, which can
be detected and stored by software just before shutdown. Supporting
hardware-reported reset reasons (like watchdog, PMIC, or SoC registers)
is possible by design — the interface allows it — but it’s not something
I consider mandatory for the initial version.
I’d prefer to focus on solving one concrete problem at a time, and the
current use case is already well-supported with software-side logic.
> I also see you extended power_on_reason.h and included it here
You're right — the `#include <linux/power/power_on_reason.h>` is no
longer used directly in `pscrr.c` and will be removed in the next
revision.
> but
> don't actually use the defined strings at all. Also you create the
> new enum, but don't handle the existing reasons and just add the new
> codes you need instead of making sure things are properly in-sync :(
Could you please clarify what exactly you mean here? The strings defined
in `power_on_reason.h` are still used indirectly via
`psc_reason_to_str()`, which is called in the reboot core and used by
PSCRR for logging (e.g., in `pscrr_reboot_notifier()` and
`pscrr_core_init()`). If your concern is about the enum values
themselves or something else, I'd appreciate a bit more detail.
> > [...]
>
> > +struct pscrr_core {
> > + struct mutex lock;
> > + struct pscrr_backend *backend;
> > + /* Kobject for sysfs */
> > + struct kobject *kobj;
> > + struct notifier_block reboot_nb;
> > +} g_pscrr = {
> > + .lock = __MUTEX_INITIALIZER(g_pscrr.lock),
> > +};
>
> Apart from the highlevel problems I have with this:
>
> g_pscrr can be static
>
> -- Sebastian
Best regards,
Oleksij
--
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 |
next prev parent reply other threads:[~2025-05-02 5:23 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-22 8:57 [PATCH v9 0/7] Introduction of PSCR Framework and Related Components Oleksij Rempel
2025-04-22 8:57 ` [PATCH v9 1/7] power: Extend power_on_reason.h for upcoming PSCRR framework Oleksij Rempel
2025-04-22 9:05 ` Oleksij Rempel
2025-05-01 20:55 ` Sebastian Reichel
2025-04-22 8:57 ` [PATCH v9 2/7] reboot: hw_protection_trigger: use standardized numeric shutdown/reboot reasons instead of strings Oleksij Rempel
2025-04-30 8:57 ` Daniel Lezcano
2025-05-01 20:55 ` Sebastian Reichel
2025-04-22 8:57 ` [PATCH v9 3/7] power: reset: Introduce PSCR Recording Framework for Non-Volatile Storage Oleksij Rempel
2025-05-01 23:20 ` Sebastian Reichel
2025-05-02 5:22 ` Oleksij Rempel [this message]
2025-05-07 9:15 ` kernel test robot
2025-04-22 8:57 ` [PATCH v9 4/7] nvmem: provide consumer access to cell size metrics Oleksij Rempel
2025-05-01 20:59 ` Sebastian Reichel
2025-04-22 8:57 ` [PATCH v9 5/7] nvmem: add support for device and sysfs-based cell lookups Oleksij Rempel
2025-04-22 8:57 ` [PATCH v9 6/7] power: reset: add PSCR NVMEM Driver for Recording Power State Change Reasons Oleksij Rempel
2025-04-22 8:57 ` [PATCH v9 7/7] Documentation: Add sysfs documentation for PSCRR reboot reason tracking Oleksij Rempel
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=aBRWrwY6YN0526SN@pengutronix.de \
--to=o.rempel@pengutronix.de \
--cc=a.fatoum@pengutronix.de \
--cc=akpm@linux-foundation.org \
--cc=bleung@chromium.org \
--cc=broonie@kernel.org \
--cc=chrome-platform@lists.linux.dev \
--cc=daniel.lezcano@linaro.org \
--cc=groeck@chromium.org \
--cc=kernel@pengutronix.de \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=mazziesaccount@gmail.com \
--cc=rafael@kernel.org \
--cc=rui.zhang@intel.com \
--cc=san@skov.dk \
--cc=sebastian.reichel@collabora.com \
--cc=srinivas.kandagatla@linaro.org \
--cc=tzungbi@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.