Skip to content

Commit eb3a9b4

Browse files
tobluxhcahca
authored andcommitted
s390/smp: Mark pcpu_delegate() and smp_call_ipl_cpu() 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. Also annotate smp_call_ipl_cpu() accordingly since it always calls pcpu_delegate(). [hca: Merge two patches from Thorsten Blum] Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
1 parent f07ebfa commit eb3a9b4

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

arch/s390/include/asm/smp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ extern int __cpu_up(unsigned int cpu, struct task_struct *tidle);
4343
extern void arch_send_call_function_single_ipi(int cpu);
4444
extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
4545

46-
extern void smp_call_ipl_cpu(void (*func)(void *), void *);
46+
extern void __noreturn smp_call_ipl_cpu(void (*func)(void *), void *data);
4747
extern void smp_emergency_stop(void);
4848

4949
extern int smp_find_processor_id(u16 address);

arch/s390/kernel/smp.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,9 +305,9 @@ static void __pcpu_delegate(pcpu_delegate_fn *func, void *data)
305305
func(data); /* should not return */
306306
}
307307

308-
static void pcpu_delegate(struct pcpu *pcpu, int cpu,
309-
pcpu_delegate_fn *func,
310-
void *data, unsigned long stack)
308+
static void __noreturn pcpu_delegate(struct pcpu *pcpu, int cpu,
309+
pcpu_delegate_fn *func,
310+
void *data, unsigned long stack)
311311
{
312312
struct lowcore *lc, *abs_lc;
313313
unsigned int source_cpu;
@@ -370,7 +370,7 @@ static int pcpu_set_smt(unsigned int mtid)
370370
/*
371371
* Call function on the ipl CPU.
372372
*/
373-
void smp_call_ipl_cpu(void (*func)(void *), void *data)
373+
void __noreturn smp_call_ipl_cpu(void (*func)(void *), void *data)
374374
{
375375
struct lowcore *lc = lowcore_ptr[0];
376376

0 commit comments

Comments
 (0)