All of lore.kernel.org
 help / color / mirror / Atom feed
From: Carlos Bilbao <carlos.bilbao.osdev@gmail.com>
To: Sean Christopherson <seanjc@google.com>, carlos.bilbao@kernel.org
Cc: tglx@linutronix.de, jan.glauber@gmail.com, bilbao@vt.edu,
	pmladek@suse.com, akpm@linux-foundation.org,
	jani.nikula@intel.com, linux-kernel@vger.kernel.org,
	gregkh@linuxfoundation.org, takakura@valinux.co.jp,
	john.ogness@linutronix.de
Subject: Re: [PATCH v2 2/2] x86/panic: Add x86_panic_handler as default post-panic behavior
Date: Tue, 29 Apr 2025 09:25:35 -0500	[thread overview]
Message-ID: <575bdc12-be65-42a9-9581-e2a31e6ce810@gmail.com> (raw)
In-Reply-To: <aBDox0dlo6S7KzSI@google.com>

Hello,

On 4/29/25 09:57, Sean Christopherson wrote:
> On Mon, Apr 28, 2025, carlos.bilbao@kernel.org wrote:
>> From: Carlos Bilbao <carlos.bilbao@kernel.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@kernel.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.


Agree, will fix in v3.


>
>> +		console_unlock();
>> +		safe_halt();
>> +	}
>> +}


Thanks,

Carlos


  reply	other threads:[~2025-04-29 16:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-28 21:59 [PATCH v2 0/2] panic: Reduce CPU consumption after panic carlos.bilbao
2025-04-28 21:59 ` [PATCH v2 1/2] panic: Allow for dynamic custom behavior " carlos.bilbao
2025-04-29 14:54   ` Sean Christopherson
2025-04-29 14:25     ` Carlos Bilbao
2025-04-28 21:59 ` [PATCH v2 2/2] x86/panic: Add x86_panic_handler as default post-panic behavior carlos.bilbao
2025-04-29 14:57   ` Sean Christopherson
2025-04-29 14:25     ` Carlos Bilbao [this message]
2025-04-29 16:53   ` John Ogness
2025-04-29 15:25     ` Carlos Bilbao
2025-04-30  7:58       ` John Ogness
2025-05-07 19:56         ` Carlos Bilbao

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=575bdc12-be65-42a9-9581-e2a31e6ce810@gmail.com \
    --to=carlos.bilbao.osdev@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=bilbao@vt.edu \
    --cc=carlos.bilbao@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jan.glauber@gmail.com \
    --cc=jani.nikula@intel.com \
    --cc=john.ogness@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmladek@suse.com \
    --cc=seanjc@google.com \
    --cc=takakura@valinux.co.jp \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.