Skip to contentSkip to conversation

s390/smp: Mark pcpu_delegate as __noreturn

PATCH New Thorsten Blum 1 participant 2 messages Oct 30, 2025 s390

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 s390/smp: Mark pcpu_delegate as __noreturn

pcpu_delegate() never returns to its caller. If the target CPU is the current CPU, it calls __pcpu_delegate(), whose delegate function is not supposed to return. In any case, even if __pcpu_delegate() unexpectedly returns, pcpu_delegate() sends SIGP_STOP to the current CPU and waits in an infinite loop. Annotate pcpu_delegate() with the __noreturn attribute to improve compiler optimizations.

---
 arch/s390/kernel/smp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/s390/kernel/smp.c +3 -3
index da84c0dc6b7e..93ac451db6f9 100644
@@ -305,9 +305,9 @@ static void __pcpu_delegate(pcpu_delegate_fn *func, void *data)
 	func(data);	/* should not return */
 }
 
-static void pcpu_delegate(struct pcpu *pcpu, int cpu,
-			  pcpu_delegate_fn *func,
-			  void *data, unsigned long stack)
+static void __noreturn pcpu_delegate(struct pcpu *pcpu, int cpu,
+				     pcpu_delegate_fn *func,
+				     void *data, unsigned long stack)
 {
 	struct lowcore *lc, *abs_lc;
 	unsigned int source_cpu;
Signature · 1 line
2.51.0
#1 lore raw

PATCH 2/2 s390/smp: Mark smp_call_ipl_cpu as __noreturn

smp_call_ipl_cpu() ends by calling the non-returning function pcpu_delegate() and therefore also never returns. Annotate it with the __noreturn attribute to improve compiler optimizations.

Add an identifier name to the function declaration to silence a checkpatch warning.

---
 arch/s390/include/asm/smp.h | 2 +-
 arch/s390/kernel/smp.c      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/s390/include/asm/smp.h +1 -1
index 03f4d01664f8..fb2bdbf35da5 100644
@@ -43,7 +43,7 @@ extern int __cpu_up(unsigned int cpu, struct task_struct *tidle);
 extern void arch_send_call_function_single_ipi(int cpu);
 extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
 
-extern void smp_call_ipl_cpu(void (*func)(void *), void *);
+extern void __noreturn smp_call_ipl_cpu(void (*func)(void *), void *data);
 extern void smp_emergency_stop(void);
 
 extern int smp_find_processor_id(u16 address);
arch/s390/kernel/smp.c +1 -1
index 93ac451db6f9..49c8cb718210 100644
@@ -370,7 +370,7 @@ static int pcpu_set_smt(unsigned int mtid)
 /*
  * Call function on the ipl CPU.
  */
-void smp_call_ipl_cpu(void (*func)(void *), void *data)
+void __noreturn smp_call_ipl_cpu(void (*func)(void *), void *data)
 {
 	struct lowcore *lc = lowcore_ptr[0];
 
Signature · 1 line
2.51.0