Skip to content

Commit 5ab6876

Browse files
jpoimboePeter Zijlstra
authored andcommitted
arm64/cpu: Mark cpu_park_loop() and friends __noreturn
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> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/r/55787d3193ea3e295ccbb097abfab0a10ae49d45.1681342859.git.jpoimboe@kernel.org
1 parent 4208d2d commit 5ab6876

5 files changed

Lines changed: 12 additions & 11 deletions

File tree

arch/arm64/include/asm/exception.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ static inline unsigned long disr_to_esr(u64 disr)
3131
return esr;
3232
}
3333

34-
asmlinkage void handle_bad_stack(struct pt_regs *regs);
34+
asmlinkage void __noreturn handle_bad_stack(struct pt_regs *regs);
3535

3636
asmlinkage void el1t_64_sync_handler(struct pt_regs *regs);
3737
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);
8080
void do_serror(struct pt_regs *regs, unsigned long esr);
8181
void do_notify_resume(struct pt_regs *regs, unsigned long thread_flags);
8282

83-
void panic_bad_stack(struct pt_regs *regs, unsigned long esr, unsigned long far);
83+
void __noreturn panic_bad_stack(struct pt_regs *regs, unsigned long esr, unsigned long far);
8484
#endif /* __ASM_EXCEPTION_H */

arch/arm64/include/asm/smp.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ extern int __cpu_disable(void);
101101

102102
extern void __cpu_die(unsigned int cpu);
103103
extern void __noreturn cpu_die(void);
104-
extern void cpu_die_early(void);
104+
extern void __noreturn cpu_die_early(void);
105105

106-
static inline void cpu_park_loop(void)
106+
static inline void __noreturn cpu_park_loop(void)
107107
{
108108
for (;;) {
109109
wfe();
@@ -123,7 +123,7 @@ static inline void update_cpu_boot_status(int val)
123123
* which calls for a kernel panic. Update the boot status and park the calling
124124
* CPU.
125125
*/
126-
static inline void cpu_panic_kernel(void)
126+
static inline void __noreturn cpu_panic_kernel(void)
127127
{
128128
update_cpu_boot_status(CPU_PANIC_KERNEL);
129129
cpu_park_loop();

arch/arm64/kernel/entry-common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,7 @@ UNHANDLED(el0t, 32, error)
840840
#endif /* CONFIG_COMPAT */
841841

842842
#ifdef CONFIG_VMAP_STACK
843-
asmlinkage void noinstr handle_bad_stack(struct pt_regs *regs)
843+
asmlinkage void noinstr __noreturn handle_bad_stack(struct pt_regs *regs)
844844
{
845845
unsigned long esr = read_sysreg(esr_el1);
846846
unsigned long far = read_sysreg(far_el1);

arch/arm64/kernel/smp.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ static void __cpu_try_die(int cpu)
398398
* Kill the calling secondary CPU, early in bringup before it is turned
399399
* online.
400400
*/
401-
void cpu_die_early(void)
401+
void __noreturn cpu_die_early(void)
402402
{
403403
int cpu = smp_processor_id();
404404

@@ -816,7 +816,7 @@ void arch_irq_work_raise(void)
816816
}
817817
#endif
818818

819-
static void local_cpu_stop(void)
819+
static void __noreturn local_cpu_stop(void)
820820
{
821821
set_cpu_online(smp_processor_id(), false);
822822

@@ -839,7 +839,7 @@ void panic_smp_self_stop(void)
839839
static atomic_t waiting_for_crash_ipi = ATOMIC_INIT(0);
840840
#endif
841841

842-
static void ipi_cpu_crash_stop(unsigned int cpu, struct pt_regs *regs)
842+
static void __noreturn ipi_cpu_crash_stop(unsigned int cpu, struct pt_regs *regs)
843843
{
844844
#ifdef CONFIG_KEXEC_CORE
845845
crash_save_cpu(regs, cpu);
@@ -854,6 +854,8 @@ static void ipi_cpu_crash_stop(unsigned int cpu, struct pt_regs *regs)
854854

855855
/* just in case */
856856
cpu_park_loop();
857+
#else
858+
BUG();
857859
#endif
858860
}
859861

arch/arm64/kernel/traps.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ void bad_el0_sync(struct pt_regs *regs, int reason, unsigned long esr)
863863
DEFINE_PER_CPU(unsigned long [OVERFLOW_STACK_SIZE/sizeof(long)], overflow_stack)
864864
__aligned(16);
865865

866-
void panic_bad_stack(struct pt_regs *regs, unsigned long esr, unsigned long far)
866+
void __noreturn panic_bad_stack(struct pt_regs *regs, unsigned long esr, unsigned long far)
867867
{
868868
unsigned long tsk_stk = (unsigned long)current->stack;
869869
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)
905905
nmi_panic(regs, "Asynchronous SError Interrupt");
906906

907907
cpu_park_loop();
908-
unreachable();
909908
}
910909

911910
bool arm64_is_fatal_ras_serror(struct pt_regs *regs, unsigned long esr)

0 commit comments

Comments
 (0)