mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Oleksij Rempel <o.rempel@pengutronix.de>,
	Sebastian Reichel <sre@kernel.org>,
	Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: 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>
Subject: Re: [PATCH v4 7/7] thermal: core: Record PSCR before hw_protection_shutdown()
Date: Wed, 12 Mar 2025 16:35:51 +0100	[thread overview]
Message-ID: <726c6ffc-a8d4-4328-a849-2d59f3a0a1c9@linaro.org> (raw)
In-Reply-To: <20250306093900.2199442-8-o.rempel@pengutronix.de>


Hi Oleksij,


On 06/03/2025 10:38, Oleksij Rempel wrote:
> Enhance the thermal core to record the Power State Change Reason (PSCR)
> prior to invoking hw_protection_shutdown(). This change integrates the
> PSCR framework with the thermal subsystem, ensuring that reasons for
> power state changes, such as overtemperature events, are stored in a
> dedicated non-volatile memory (NVMEM) cell.
> 
> This 'black box' recording is crucial for post-mortem analysis, enabling
> a deeper understanding of system failures and abrupt shutdowns,
> especially in scenarios where PMICs or watchdog timers are incapable of
> logging such events.  The recorded data can be utilized during system
> recovery routines in the bootloader or early kernel stages of subsequent
> boots, significantly enhancing system diagnostics, reliability, and
> debugging capabilities.
> 
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
>   drivers/thermal/thermal_core.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
> index 2328ac0d8561..af4e9cf22bf6 100644
> --- a/drivers/thermal/thermal_core.c
> +++ b/drivers/thermal/thermal_core.c
> @@ -16,6 +16,7 @@
>   #include <linux/kdev_t.h>
>   #include <linux/idr.h>
>   #include <linux/thermal.h>
> +#include <linux/pscrr.h>
>   #include <linux/reboot.h>
>   #include <linux/string.h>
>   #include <linux/of.h>
> @@ -380,6 +381,8 @@ static void thermal_zone_device_halt(struct thermal_zone_device *tz, bool shutdo
>   
>   	dev_emerg(&tz->device, "%s: critical temperature reached\n", tz->type);
>   
> +	set_power_state_change_reason(PSCR_OVERTEMPERATURE);
> +
>   	if (shutdown)
>   		hw_protection_shutdown(msg, poweroff_delay_ms);
>   	else

In the future could you add me as recipient to the series instead of 
this one ? so I can get more context.

Given there are no so much hw_protection_shutdown() users in the kernel, 
it could be more interesting to change the function to receive a enum 
pscr_reason and then in the hw_protection_shutdown() call 
pscrr_reason_to_str().



-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

  reply	other threads:[~2025-03-12 15:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-06  9:38 [PATCH v4 0/7] Introduction of PSCR Framework and Related Components Oleksij Rempel
2025-03-06  9:38 ` [PATCH v4 1/7] power: Extend power_on_reason.h for upcoming PSCRR framework Oleksij Rempel
2025-03-06  9:38 ` [PATCH v4 2/7] power: reset: Introduce PSCR Recording Framework for Non-Volatile Storage Oleksij Rempel
2025-03-06  9:38 ` [PATCH v4 3/7] nvmem: provide consumer access to cell size metrics Oleksij Rempel
2025-03-06  9:38 ` [PATCH v4 4/7] nvmem: add support for device and sysfs-based cell lookups Oleksij Rempel
2025-03-07 12:35   ` kernel test robot
2025-03-07 15:04   ` kernel test robot
2025-03-08 17:06   ` kernel test robot
2025-03-06  9:38 ` [PATCH v4 5/7] power: reset: add PSCR NVMEM Driver for Recording Power State Change Reasons Oleksij Rempel
2025-03-06  9:38 ` [PATCH v4 6/7] regulator: set Power State Change Reason before hw_protection_shutdown() Oleksij Rempel
2025-03-06  9:38 ` [PATCH v4 7/7] thermal: core: Record PSCR " Oleksij Rempel
2025-03-12 15:35   ` Daniel Lezcano [this message]
2025-03-12 16:51     ` Oleksij Rempel
2025-03-12 17:22       ` Daniel Lezcano

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=726c6ffc-a8d4-4328-a849-2d59f3a0a1c9@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=broonie@kernel.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 \
    /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

all inboxes | Powered by JetHome®