public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matti Vaittinen <mazziesaccount@gmail.com>
To: Oleksij Rempel <o.rempel@pengutronix.de>
Cc: "Sebastian Reichel" <sre@kernel.org>,
	"Srinivas Kandagatla" <srinivas.kandagatla@linaro.org>,
	"Benson Leung" <bleung@chromium.org>,
	"Tzung-Bi Shih" <tzungbi@kernel.org>,
	"Daniel Lezcano" <daniel.lezcano@linaro.org>,
	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 v6 7/7] Documentation: Add sysfs documentation for PSCRR reboot reason tracking
Date: Mon, 17 Mar 2025 10:46:01 +0200	[thread overview]
Message-ID: <a34c14c1-875d-40a4-8019-67f7b9aa4133@gmail.com> (raw)
In-Reply-To: <Z9Q4z2dPdpqVcu6u@pengutronix.de>

On 14/03/2025 16:10, Oleksij Rempel wrote:
> On Fri, Mar 14, 2025 at 03:38:55PM +0200, Matti Vaittinen wrote:
>> On 14/03/2025 13:36, Oleksij Rempel wrote:
>>> Add documentation for the Power State Change Reason Recorder (PSCRR)
>>> sysfs interface, which allows tracking of system shutdown and reboot
>>> reasons. The documentation provides details on available sysfs entries
>>> under `/sys/kernel/pscrr/`, explaining their functionality, example usage,
>>> and how they interact with different backend storage options (e.g., NVMEM).
>>>
>>> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
>>> ---
>>>    .../ABI/testing/sysfs-kernel-reboot-pscrr     | 46 +++++++++++++++++++
>>>    1 file changed, 46 insertions(+)
>>>    create mode 100644 Documentation/ABI/testing/sysfs-kernel-reboot-pscrr
>>>
>>> diff --git a/Documentation/ABI/testing/sysfs-kernel-reboot-pscrr b/Documentation/ABI/testing/sysfs-kernel-reboot-pscrr
>>> new file mode 100644
>>> index 000000000000..7cc643f89675
>>> --- /dev/null
>>> +++ b/Documentation/ABI/testing/sysfs-kernel-reboot-pscrr
>>> @@ -0,0 +1,46 @@
>>> +What:		/sys/kernel/pscrr/reason
>>> +Date:		April 2025
>>> +KernelVersion:  6.15
>>> +Contact:	Oleksij Rempel <o.rempel@pengutronix.de>
>>> +Description:
>>> +		This file provides access to the last recorded power state
>>> +		change reason. The storage backend is configurable and, if
>>> +		supported, the reason may be stored persistently in an
>>> +		NVMEM cell or another backend.
>>> +
>>> +		Reading this file returns an integer representing the last
>>> +		recorded shutdown or reboot cause.
>>> +
>>> +		Writing an integer value to this file sets the reason to be
>>> +		stored and recorded for system analysis.
>>> +
>>> +		Example usage (values are for illustration and may not reflect
>>> +		actual reasons used in a given system):
>>> +		  Read:
>>> +			$ cat /sys/kernel/pscrr/reason
>>> +			3   # (Example: Power loss event, may differ per system)
>>> +
>>> +		  Write:
>>> +			$ echo 5 > /sys/kernel/pscrr/reason
>>> +			# Sets the reason to 5 (Example: User-triggered reboot,
>>> +			# this may not be a real value in your system)
>>> +
>>> +		Values are defined in:
>>> +		  - `include/linux/reboot.h` (enum psc_reason)
>>
>> Is it possible to provide the reason (also) as string?
>>
>> I believe we should fix the meaning of the numbers so the ABI is not
>> changing for the users. Hence we could as well document the meaning of the
>> values(?) If I read the suggestion right, we will in any case have
>> predefined set of reasons in the kernel side.
>>
>> Or, am I missing something?
> 
> Yes, it is correct, the values should be fixed for user space. Should
> they be documented in this documentation too?

I believe it could be helpful for both the user-space users and 
potential pscrr provider driver writers. It could also set things to stone.

But, I don't have much experience on the documentation like this so 
please treat this as a suggestion - but do as you see fits best.

Yours,
	-- Matti


  reply	other threads:[~2025-03-17  8:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-14 11:35 [PATCH v6 0/7] Introduction of PSCR Framework and Related Components Oleksij Rempel
2025-03-14 11:35 ` [PATCH v6 1/7] power: Extend power_on_reason.h for upcoming PSCRR framework Oleksij Rempel
2025-03-14 11:35 ` [PATCH v6 2/7] reboot: hw_protection_trigger: use standardized numeric shutdown/reboot reasons instead of strings Oleksij Rempel
2025-03-14 11:36 ` [PATCH v6 3/7] power: reset: Introduce PSCR Recording Framework for Non-Volatile Storage Oleksij Rempel
2025-03-14 12:22   ` Matti Vaittinen
2025-03-14 13:58     ` Oleksij Rempel
2025-03-17  7:55       ` Matti Vaittinen
2025-03-14 11:36 ` [PATCH v6 4/7] nvmem: provide consumer access to cell size metrics Oleksij Rempel
2025-03-14 11:36 ` [PATCH v6 5/7] nvmem: add support for device and sysfs-based cell lookups Oleksij Rempel
2025-03-14 11:36 ` [PATCH v6 6/7] power: reset: add PSCR NVMEM Driver for Recording Power State Change Reasons Oleksij Rempel
2025-03-14 11:36 ` [PATCH v6 7/7] Documentation: Add sysfs documentation for PSCRR reboot reason tracking Oleksij Rempel
2025-03-14 13:38   ` Matti Vaittinen
2025-03-14 14:10     ` Oleksij Rempel
2025-03-17  8:46       ` Matti Vaittinen [this message]
2025-03-18  9:22         ` 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=a34c14c1-875d-40a4-8019-67f7b9aa4133@gmail.com \
    --to=mazziesaccount@gmail.com \
    --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=o.rempel@pengutronix.de \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=san@skov.dk \
    --cc=sre@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox