From: carlos.bilbao@kernel.org
To: tglx@linutronix.de
Cc: bilbao@vt.edu, pmladek@suse.com, akpm@linux-foundation.org,
jan.glauber@gmail.com, jani.nikula@intel.com,
linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org,
takakura@valinux.co.jp, john.ogness@linutronix.de,
Carlos Bilbao <carlos.bilbao@kernel.org>
Subject: [PATCH 2/2] x86/panic: Use safe_halt() for CPU halt after panic
Date: Wed, 26 Mar 2025 10:12:04 -0500 [thread overview]
Message-ID: <20250326151204.67898-3-carlos.bilbao@kernel.org> (raw)
In-Reply-To: <20250326151204.67898-1-carlos.bilbao@kernel.org>
From: Carlos Bilbao <carlos.bilbao@kernel.org>
Include an arch/x86-specific function to halt CPU once the kernel has
finished handling a panic, by defining the weak function
cpu_halt_after_panic().
Signed-off-by: Carlos Bilbao (DigitalOcean) <carlos.bilbao@kernel.org>
Reviewed-by: Jan Glauber (DigitalOcean) <jan.glauber@gmail.com>
---
arch/x86/kernel/Makefile | 1 +
arch/x86/kernel/panic.c | 9 +++++++++
2 files changed, 10 insertions(+)
create mode 100644 arch/x86/kernel/panic.c
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index f7918980667a..0e4d87596f5d 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -85,6 +85,7 @@ obj-y += stacktrace.o
obj-y += cpu/
obj-y += acpi/
obj-y += reboot.o
+obj-y += panic.o
obj-$(CONFIG_X86_MSR) += msr.o
obj-$(CONFIG_X86_CPUID) += cpuid.o
obj-$(CONFIG_PCI) += early-quirks.o
diff --git a/arch/x86/kernel/panic.c b/arch/x86/kernel/panic.c
new file mode 100644
index 000000000000..0838bb7cf9a9
--- /dev/null
+++ b/arch/x86/kernel/panic.c
@@ -0,0 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0
+// Author Carlos Bilbao <carlos.bilbao@kernel.org>
+#include <linux/kernel.h>
+#include <asm/processor.h>
+
+void cpu_halt_after_panic(void)
+{
+ safe_halt();
+}
--
2.47.1
next prev parent reply other threads:[~2025-03-26 15:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-26 15:12 [PATCH 0/2] Reduce CPU usage when finished handling panic carlos.bilbao
2025-03-26 15:12 ` [PATCH 1/2] panic: Allow archs to reduce CPU consumption after panic carlos.bilbao
2025-04-11 14:03 ` Petr Mladek
2025-04-11 16:31 ` Sean Christopherson
2025-04-14 10:02 ` Jan Glauber
2025-04-22 12:44 ` Carlos Bilbao
2025-03-26 15:12 ` carlos.bilbao [this message]
2025-04-10 17:30 ` Reminder: [PATCH 0/2] Reduce CPU usage when finished handling panic 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=20250326151204.67898-3-carlos.bilbao@kernel.org \
--to=carlos.bilbao@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=bilbao@vt.edu \
--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=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 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®