diff mbox series

kernel/panic: Use SYSTEM_RESET2 command for warm reset

Message ID 1557366432-352469-1-git-send-email-psodagud@codeaurora.org (mailing list archive)
State New, archived
Headers show
Series kernel/panic: Use SYSTEM_RESET2 command for warm reset | expand

Commit Message

Prasad Sodagudi May 9, 2019, 1:47 a.m. UTC
Some platforms may need warm reboot support when kernel crashed
for post mortem analysis instead of cold reboot. So use config
CONFIG_WARM_REBOOT_ON_PANIC and SYSTEM_RESET2 psci command
support for warm reset.

Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
---
 kernel/panic.c    |  4 ++++
 lib/Kconfig.debug | 10 ++++++++++
 2 files changed, 14 insertions(+)

Comments

Sudeep Holla May 9, 2019, 9:40 a.m. UTC | #1
On Wed, May 08, 2019 at 06:47:12PM -0700, Prasad Sodagudi wrote:
> Some platforms may need warm reboot support when kernel crashed
> for post mortem analysis instead of cold reboot. So use config
> CONFIG_WARM_REBOOT_ON_PANIC and SYSTEM_RESET2 psci command
> support for warm reset.
>

Please drop all the references to PSCI and SYSTEM_RESET2 including
in subject. This is more generic and PSCIv1.1 with SYSTEM_RESET2 can
make use of it.

> Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
> ---
>  kernel/panic.c    |  4 ++++
>  lib/Kconfig.debug | 10 ++++++++++
>  2 files changed, 14 insertions(+)
> 
> diff --git a/kernel/panic.c b/kernel/panic.c
> index c1fcaad..6ab6675 100644
> --- a/kernel/panic.c
> +++ b/kernel/panic.c
> @@ -198,6 +198,10 @@ void panic(const char *fmt, ...)
>  
>  	console_verbose();
>  	bust_spinlocks(1);
> +#ifdef CONFIG_WARM_REBOOT_ON_PANIC
> +	/* Configure for warm reboot instead of cold reboot. */
> +	reboot_mode = REBOOT_WARM;
> +#endif
>  	va_start(args, fmt);
>  	len = vscnprintf(buf, sizeof(buf), fmt, args);
>  	va_end(args);
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index d695ec1..2a727d8 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -1000,6 +1000,16 @@ config PANIC_TIMEOUT
>  	  value n > 0 will wait n seconds before rebooting, while a timeout
>  	  value n < 0 will reboot immediately.
>  
> +config WARM_REBOOT_ON_PANIC
> +	bool "Warm reboot instead of cold reboot for panic"
> +	default n
> +	help
> +	  Some vendor platform may need warm reboot instead of cold reboot
> +	  for debugging. Before vendor specific power off driver is
> +	  probed, platform always gets cold reset. By setting Y here and
> +	  support for PSCI V1.1 is present from firmware, platform would
> +	  get warm reset instead of cold reset.
> +

Ditto here, drop PSCI reference. Since it's being pushed as generic
solution, expecting anyone reading this to understand what is this PSCI
makes no sense and may be even confusing.

--
Regards,
Sudeep
Aaro Koskinen May 16, 2019, 6:29 p.m. UTC | #2
Hi,

On Wed, May 08, 2019 at 06:47:12PM -0700, Prasad Sodagudi wrote:
> Some platforms may need warm reboot support when kernel crashed
> for post mortem analysis instead of cold reboot. So use config
> CONFIG_WARM_REBOOT_ON_PANIC and SYSTEM_RESET2 psci command
> support for warm reset.

Please see commit b287a25a7148 - you can now use kernel command
line option reboot=panic_warm to get this.

A.
Prasad Sodagudi May 17, 2019, 6:03 p.m. UTC | #3
On 2019-05-16 11:29, Aaro Koskinen wrote:
> Hi,
> 
> On Wed, May 08, 2019 at 06:47:12PM -0700, Prasad Sodagudi wrote:
>> Some platforms may need warm reboot support when kernel crashed
>> for post mortem analysis instead of cold reboot. So use config
>> CONFIG_WARM_REBOOT_ON_PANIC and SYSTEM_RESET2 psci command
>> support for warm reset.
> 
> Please see commit b287a25a7148 - you can now use kernel command
> line option reboot=panic_warm to get this.

Thanks Aaro. Yes. I can use this option.  Thanks Sudeep and all for 
discussing.

> 
> A.
diff mbox series

Patch

diff --git a/kernel/panic.c b/kernel/panic.c
index c1fcaad..6ab6675 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -198,6 +198,10 @@  void panic(const char *fmt, ...)
 
 	console_verbose();
 	bust_spinlocks(1);
+#ifdef CONFIG_WARM_REBOOT_ON_PANIC
+	/* Configure for warm reboot instead of cold reboot. */
+	reboot_mode = REBOOT_WARM;
+#endif
 	va_start(args, fmt);
 	len = vscnprintf(buf, sizeof(buf), fmt, args);
 	va_end(args);
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index d695ec1..2a727d8 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -1000,6 +1000,16 @@  config PANIC_TIMEOUT
 	  value n > 0 will wait n seconds before rebooting, while a timeout
 	  value n < 0 will reboot immediately.
 
+config WARM_REBOOT_ON_PANIC
+	bool "Warm reboot instead of cold reboot for panic"
+	default n
+	help
+	  Some vendor platform may need warm reboot instead of cold reboot
+	  for debugging. Before vendor specific power off driver is
+	  probed, platform always gets cold reset. By setting Y here and
+	  support for PSCI V1.1 is present from firmware, platform would
+	  get warm reset instead of cold reset.
+
 config SCHED_DEBUG
 	bool "Collect scheduler debugging info"
 	depends on DEBUG_KERNEL && PROC_FS