[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aBDox0dlo6S7KzSI@google.com>
Date: Tue, 29 Apr 2025 07:57:11 -0700
From: Sean Christopherson <seanjc@...gle.com>
To: carlos.bilbao@...nel.org
Cc: tglx@...utronix.de, jan.glauber@...il.com, bilbao@...edu, pmladek@...e.com,
akpm@...ux-foundation.org, jani.nikula@...el.com,
linux-kernel@...r.kernel.org, gregkh@...uxfoundation.org,
takakura@...inux.co.jp, john.ogness@...utronix.de
Subject: Re: [PATCH v2 2/2] x86/panic: Add x86_panic_handler as default
post-panic behavior
On Mon, Apr 28, 2025, carlos.bilbao@...nel.org wrote:
> From: Carlos Bilbao <carlos.bilbao@...nel.org>
>
> Add function x86_panic_handler() as the default behavior for x86 for
> post-panic stage via panic_set_handling(). Instead of busy-wait loop, it
> will halt if there's no console to save CPU cycles.
>
> Signed-off-by: Carlos Bilbao (DigitalOcean) <carlos.bilbao@...nel.org>
> ---
> arch/x86/kernel/setup.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
> index 9d2a13b37833..3bfef55e9adb 100644
> --- a/arch/x86/kernel/setup.c
> +++ b/arch/x86/kernel/setup.c
> @@ -16,6 +16,7 @@
> #include <linux/initrd.h>
> #include <linux/iscsi_ibft.h>
> #include <linux/memblock.h>
> +#include <linux/panic.h>
> #include <linux/panic_notifier.h>
> #include <linux/pci.h>
> #include <linux/root_dev.h>
> @@ -837,6 +838,15 @@ static void __init x86_report_nx(void)
> }
> }
>
> +
Spurious newline.
> +static void x86_panic_handler(void)
> +{
> + if (console_trylock()) {
A comment here would be very helpful. Even with the changelog saying "if there's
no console", as an unfamiliar reader of console code, I have zero idea why being
able to lock the console is an effective test for no console.
> + console_unlock();
> + safe_halt();
> + }
> +}
Powered by blists - more mailing lists