From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B4A21EB3E for ; Fri, 14 Mar 2025 14:10:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741961439; cv=none; b=rFIX7DmbxSlVsgRynJJ1J2yjjoHU7ni31j+jsLxYIUul8g4cmvwVxk5zL+1mR/0R9811j+l9+bpVNMDN+dfaZ1QTEKswhj0MIlDXbFh0HyMzba3lEAX46kQMJ2jewiJcJT1HauKagXvemO6jPTxL1Sydh+JE0xlgEmE9xLw4RS0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741961439; c=relaxed/simple; bh=C5toxvwiwwhMhsd9e2XE4L4Jrk1EIjC5qUAeyoJngFo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=g2eFD7I86rcQoVGAgUUeOEXDrvloIWz3dudsKQ6SOM3ezBGSGPp2W6E+AY8uJ/My4kFJm0PC/uKG8XYFaY2iv72ZNgYOBkEQM8vn++QFYCMrh8V5q3BbmIShB/rHF9HH9Iqt+gfwGR1c/Ogj6AVC9fUiE74W0yd64UaRd1ICUso= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tt5k1-0000lP-74; Fri, 14 Mar 2025 15:10:25 +0100 Received: from pty.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::c5]) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tt5jz-005iXB-2e; Fri, 14 Mar 2025 15:10:23 +0100 Received: from ore by pty.whiteo.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1tt5jz-00DBIm-2G; Fri, 14 Mar 2025 15:10:23 +0100 Date: Fri, 14 Mar 2025 15:10:23 +0100 From: Oleksij Rempel To: Matti Vaittinen Cc: Sebastian Reichel , Srinivas Kandagatla , Benson Leung , Tzung-Bi Shih , Daniel Lezcano , kernel@pengutronix.de, linux-kernel@vger.kernel.org, Liam Girdwood , Mark Brown , "Rafael J. Wysocki" , Zhang Rui , Lukasz Luba , linux-pm@vger.kernel.org, =?utf-8?B?U8O4cmVu?= Andersen , Guenter Roeck , Ahmad Fatoum , Andrew Morton , chrome-platform@lists.linux.dev Subject: Re: [PATCH v6 7/7] Documentation: Add sysfs documentation for PSCRR reboot reason tracking Message-ID: References: <20250314113604.1776201-1-o.rempel@pengutronix.de> <20250314113604.1776201-8-o.rempel@pengutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org 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 > > --- > > .../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 > > +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? -- 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 |