mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Josh Poimboeuf <jpoimboe@kernel.org>
To: x86@kernel.org
Cc: linux-kernel@vger.kernel.org,
	Peter Zijlstra <peterz@infradead.org>,
	Miroslav Benes <mbenes@suse.cz>,
	linux-btrfs@vger.kernel.org, Mark Rutland <mark.rutland@arm.com>,
	linux-scsi@vger.kernel.org, linux-hyperv@vger.kernel.org,
	Arnd Bergmann <arnd@arndb.de>,
	"Guilherme G . Piccoli" <gpiccoli@igalia.com>,
	Michael Kelley <mikelley@microsoft.com>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Nathan Chancellor <nathan@kernel.org>
Subject: [PATCH v2 04/11] arm64/cpu: Mark cpu_park_loop() and friends __noreturn
Date: Wed, 12 Apr 2023 16:49:34 -0700	[thread overview]
Message-ID: <55787d3193ea3e295ccbb097abfab0a10ae49d45.1681342859.git.jpoimboe@kernel.org> (raw)
In-Reply-To: <cover.1681342859.git.jpoimboe@kernel.org>

In preparation for marking panic_smp_self_stop() __noreturn across the
kernel, first mark the arm64 implementation of cpu_park_loop() and
related functions __noreturn.

Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
---
 arch/arm64/include/asm/exception.h | 4 ++--
 arch/arm64/include/asm/smp.h       | 6 +++---
 arch/arm64/kernel/entry-common.c   | 2 +-
 arch/arm64/kernel/smp.c            | 8 +++++---
 arch/arm64/kernel/traps.c          | 3 +--
 5 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/arch/arm64/include/asm/exception.h b/arch/arm64/include/asm/exception.h
index 92963f98afec..e73af709cb7a 100644
--- a/arch/arm64/include/asm/exception.h
+++ b/arch/arm64/include/asm/exception.h
@@ -31,7 +31,7 @@ static inline unsigned long disr_to_esr(u64 disr)
 	return esr;
 }
 
-asmlinkage void handle_bad_stack(struct pt_regs *regs);
+asmlinkage void __noreturn handle_bad_stack(struct pt_regs *regs);
 
 asmlinkage void el1t_64_sync_handler(struct pt_regs *regs);
 asmlinkage void el1t_64_irq_handler(struct pt_regs *regs);
@@ -80,5 +80,5 @@ void do_el1_fpac(struct pt_regs *regs, unsigned long esr);
 void do_serror(struct pt_regs *regs, unsigned long esr);
 void do_notify_resume(struct pt_regs *regs, unsigned long thread_flags);
 
-void panic_bad_stack(struct pt_regs *regs, unsigned long esr, unsigned long far);
+void __noreturn panic_bad_stack(struct pt_regs *regs, unsigned long esr, unsigned long far);
 #endif	/* __ASM_EXCEPTION_H */
diff --git a/arch/arm64/include/asm/smp.h b/arch/arm64/include/asm/smp.h
index 5733a31bab08..07f4ea1490f4 100644
--- a/arch/arm64/include/asm/smp.h
+++ b/arch/arm64/include/asm/smp.h
@@ -101,9 +101,9 @@ extern int __cpu_disable(void);
 
 extern void __cpu_die(unsigned int cpu);
 extern void __noreturn cpu_die(void);
-extern void cpu_die_early(void);
+extern void __noreturn cpu_die_early(void);
 
-static inline void cpu_park_loop(void)
+static inline void __noreturn cpu_park_loop(void)
 {
 	for (;;) {
 		wfe();
@@ -123,7 +123,7 @@ static inline void update_cpu_boot_status(int val)
  * which calls for a kernel panic. Update the boot status and park the calling
  * CPU.
  */
-static inline void cpu_panic_kernel(void)
+static inline void __noreturn cpu_panic_kernel(void)
 {
 	update_cpu_boot_status(CPU_PANIC_KERNEL);
 	cpu_park_loop();
diff --git a/arch/arm64/kernel/entry-common.c b/arch/arm64/kernel/entry-common.c
index cce1167199e3..3af3c01c93a6 100644
--- a/arch/arm64/kernel/entry-common.c
+++ b/arch/arm64/kernel/entry-common.c
@@ -840,7 +840,7 @@ UNHANDLED(el0t, 32, error)
 #endif /* CONFIG_COMPAT */
 
 #ifdef CONFIG_VMAP_STACK
-asmlinkage void noinstr handle_bad_stack(struct pt_regs *regs)
+asmlinkage void noinstr __noreturn handle_bad_stack(struct pt_regs *regs)
 {
 	unsigned long esr = read_sysreg(esr_el1);
 	unsigned long far = read_sysreg(far_el1);
diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
index d5d09a18b4f8..07d156fddb5f 100644
--- a/arch/arm64/kernel/smp.c
+++ b/arch/arm64/kernel/smp.c
@@ -398,7 +398,7 @@ static void __cpu_try_die(int cpu)
  * Kill the calling secondary CPU, early in bringup before it is turned
  * online.
  */
-void cpu_die_early(void)
+void __noreturn cpu_die_early(void)
 {
 	int cpu = smp_processor_id();
 
@@ -816,7 +816,7 @@ void arch_irq_work_raise(void)
 }
 #endif
 
-static void local_cpu_stop(void)
+static void __noreturn local_cpu_stop(void)
 {
 	set_cpu_online(smp_processor_id(), false);
 
@@ -839,7 +839,7 @@ void panic_smp_self_stop(void)
 static atomic_t waiting_for_crash_ipi = ATOMIC_INIT(0);
 #endif
 
-static void ipi_cpu_crash_stop(unsigned int cpu, struct pt_regs *regs)
+static void __noreturn ipi_cpu_crash_stop(unsigned int cpu, struct pt_regs *regs)
 {
 #ifdef CONFIG_KEXEC_CORE
 	crash_save_cpu(regs, cpu);
@@ -854,6 +854,8 @@ static void ipi_cpu_crash_stop(unsigned int cpu, struct pt_regs *regs)
 
 	/* just in case */
 	cpu_park_loop();
+#else
+	BUG();
 #endif
 }
 
diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
index 4a79ba100799..4bb1b8f47298 100644
--- a/arch/arm64/kernel/traps.c
+++ b/arch/arm64/kernel/traps.c
@@ -863,7 +863,7 @@ void bad_el0_sync(struct pt_regs *regs, int reason, unsigned long esr)
 DEFINE_PER_CPU(unsigned long [OVERFLOW_STACK_SIZE/sizeof(long)], overflow_stack)
 	__aligned(16);
 
-void panic_bad_stack(struct pt_regs *regs, unsigned long esr, unsigned long far)
+void __noreturn panic_bad_stack(struct pt_regs *regs, unsigned long esr, unsigned long far)
 {
 	unsigned long tsk_stk = (unsigned long)current->stack;
 	unsigned long irq_stk = (unsigned long)this_cpu_read(irq_stack_ptr);
@@ -905,7 +905,6 @@ void __noreturn arm64_serror_panic(struct pt_regs *regs, unsigned long esr)
 	nmi_panic(regs, "Asynchronous SError Interrupt");
 
 	cpu_park_loop();
-	unreachable();
 }
 
 bool arm64_is_fatal_ras_serror(struct pt_regs *regs, unsigned long esr)
-- 
2.39.2


  parent reply	other threads:[~2023-04-12 23:50 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-12 23:49 [PATCH v2 00/11] Sprinkle more __noreturn Josh Poimboeuf
2023-04-12 23:49 ` [PATCH v2 01/11] init: Mark [arch_call_]rest_init() __noreturn Josh Poimboeuf
2023-04-17 10:46   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2023-04-12 23:49 ` [PATCH v2 02/11] init: Mark start_kernel() __noreturn Josh Poimboeuf
2023-04-17 10:46   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2023-04-12 23:49 ` [PATCH v2 03/11] x86/head: Mark *_start_kernel() __noreturn Josh Poimboeuf
2023-04-17 10:46   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2023-04-12 23:49 ` Josh Poimboeuf [this message]
2023-04-17 10:46   ` [tip: objtool/core] arm64/cpu: Mark cpu_park_loop() and friends __noreturn tip-bot2 for Josh Poimboeuf
2023-04-12 23:49 ` [PATCH v2 05/11] cpu: Mark panic_smp_self_stop() __noreturn Josh Poimboeuf
2023-04-17 10:46   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2023-04-12 23:49 ` [PATCH v2 06/11] cpu: Mark nmi_panic_self_stop() __noreturn Josh Poimboeuf
2023-04-17 10:46   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2023-04-12 23:49 ` [PATCH v2 07/11] objtool: Include weak functions in global_noreturns check Josh Poimboeuf
2023-04-14 14:32   ` Miroslav Benes
2023-04-17 10:46   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2023-04-12 23:49 ` [PATCH v2 08/11] btrfs: Mark btrfs_assertfail() __noreturn Josh Poimboeuf
2023-04-13 14:57   ` David Sterba
2023-04-15  7:19   ` Anand Jain
2023-04-17 10:46   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2023-04-12 23:49 ` [PATCH v2 09/11] x86/cpu: Mark {hlt,resume}_play_dead() __noreturn Josh Poimboeuf
2023-04-17 10:46   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2023-04-12 23:49 ` [PATCH v2 10/11] scsi: message: fusion: Mark mpt_halt_firmware() __noreturn Josh Poimboeuf
2023-04-17 10:46   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2023-04-12 23:49 ` [PATCH v2 11/11] x86/hyperv: Mark hv_ghcb_terminate() as noreturn Josh Poimboeuf
2023-04-17 10:46   ` [tip: objtool/core] " tip-bot2 for Guilherme G. Piccoli

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=55787d3193ea3e295ccbb097abfab0a10ae49d45.1681342859.git.jpoimboe@kernel.org \
    --to=jpoimboe@kernel.org \
    --cc=arnd@arndb.de \
    --cc=gpiccoli@igalia.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mbenes@suse.cz \
    --cc=mikelley@microsoft.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=peterz@infradead.org \
    --cc=x86@kernel.org \
    /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®