[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <7b6d3226-4422-415a-9146-16c421463ac5@gmail.com>
Date: Wed, 22 Jan 2025 13:28:12 +0200
From: Matti Vaittinen <mazziesaccount@...il.com>
To: Ahmad Fatoum <a.fatoum@...gutronix.de>,
Andrew Morton <akpm@...ux-foundation.org>,
Daniel Lezcano <daniel.lezcano@...aro.org>, Fabio Estevam
<festevam@...x.de>, "Rafael J. Wysocki" <rafael@...nel.org>,
Zhang Rui <rui.zhang@...el.com>, Lukasz Luba <lukasz.luba@....com>,
Jonathan Corbet <corbet@....net>, Serge Hallyn <serge@...lyn.com>,
Liam Girdwood <lgirdwood@...il.com>, Mark Brown <broonie@...nel.org>,
Benson Leung <bleung@...omium.org>, Tzung-Bi Shih <tzungbi@...nel.org>,
Guenter Roeck <groeck@...omium.org>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>
Cc: linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org,
linux-doc@...r.kernel.org, linux-security-module@...r.kernel.org,
chrome-platform@...ts.linux.dev, devicetree@...r.kernel.org,
kernel@...gutronix.de
Subject: Re: [PATCH v2 02/12] reboot: reboot, not shutdown, on
hw_protection_reboot timeout
On 13/01/2025 18:25, Ahmad Fatoum wrote:
> hw_protection_shutdown() will kick off an orderly shutdown and if that
> takes longer than a configurable amount of time, an emergency shutdown
> will occur.
>
> Recently, hw_protection_reboot() was added for those systems that don't
> implement a proper shutdown and are better served by rebooting and
> having the boot firmware worry about doing something about the critical
> condition.
>
> On timeout of the orderly reboot of hw_protection_reboot(), the system
> would go into shutdown, instead of reboot. This is not a good idea, as
> going into shutdown was explicitly not asked for.
>
> Fix this by always doing an emergency reboot if hw_protection_reboot()
> is called and the orderly reboot takes too long.
>
> Fixes: 79fa723ba84c ("reboot: Introduce thermal_zone_device_critical_reboot()")
> Signed-off-by: Ahmad Fatoum <a.fatoum@...gutronix.de>
> ---
> kernel/reboot.c | 70 ++++++++++++++++++++++++++++++++++++++++-----------------
> 1 file changed, 49 insertions(+), 21 deletions(-)
>
> diff --git a/kernel/reboot.c b/kernel/reboot.c
> index 847ac5d17a659981c6765699eac323f5e87f48c1..222b63dfd31020d0e2bc1b1402dbfa82adc71990 100644
> --- a/kernel/reboot.c
> +++ b/kernel/reboot.c
> @@ -932,48 +932,76 @@ void orderly_reboot(void)
> }
> EXPORT_SYMBOL_GPL(orderly_reboot);
>
> +static const char *hw_protection_action_str(enum hw_protection_action action)
> +{
> + switch (action) {
> + case HWPROT_ACT_SHUTDOWN:
> + return "shutdown";
> + case HWPROT_ACT_REBOOT:
> + return "reboot";
> + default:
> + return "undefined";
> + }
> +}
> +
> +static enum hw_protection_action hw_failure_emergency_action;
nit: Do we have a (theoretical) possibility that two emergency restarts
get scheduled with different actions? Should the action be allocated
(maybe not) for each caller, or should there be a check if an operation
with conflicting action is already scheduled?
If this was already considered and thought it is not an issue:
Reviewed-by: Matti Vaittinen <mazziesaccount@...il.com>
Yours,
-- Matti
Powered by blists - more mailing lists