Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

sched/idle: Mark arch_cpu_idle_dead() __noreturn

Before commit 076cbf5d2163 ("x86/xen: don't let xen_pv_play_dead()
return"), in Xen, when a previously offlined CPU was brought back
online, it unexpectedly resumed execution where it left off in the
middle of the idle loop.

There were some hacks to make that work, but the behavior was surprising
as do_idle() doesn't expect an offlined CPU to return from the dead (in
arch_cpu_idle_dead()).

Now that Xen has been fixed, and the arch-specific implementations of
arch_cpu_idle_dead() also don't return, give it a __noreturn attribute.

This will cause the compiler to complain if an arch-specific
implementation might return. It also improves code generation for both
caller and callee.

Also fixes the following warning:

vmlinux.o: warning: objtool: do_idle+0x25f: unreachable instruction

Reported-by: Paul E. McKenney <paulmck@kernel.org>
Tested-by: Paul E. McKenney <paulmck@kernel.org>
Link: https://lore.kernel.org/r/60d527353da8c99d4cf13b6473131d46719ed16d.1676358308.git.jpoimboe@kernel.org
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>

+18 -17
+1 -1
arch/alpha/kernel/process.c
··· 60 60 wtint(0); 61 61 } 62 62 63 - void arch_cpu_idle_dead(void) 63 + void __noreturn arch_cpu_idle_dead(void) 64 64 { 65 65 wtint(INT_MAX); 66 66 BUG();
+1 -1
arch/arm/kernel/smp.c
··· 320 320 * of the other hotplug-cpu capable cores, so presumably coming 321 321 * out of idle fixes this. 322 322 */ 323 - void arch_cpu_idle_dead(void) 323 + void __noreturn arch_cpu_idle_dead(void) 324 324 { 325 325 unsigned int cpu = smp_processor_id(); 326 326
+1 -1
arch/arm64/kernel/process.c
··· 69 69 EXPORT_SYMBOL_GPL(pm_power_off); 70 70 71 71 #ifdef CONFIG_HOTPLUG_CPU 72 - void arch_cpu_idle_dead(void) 72 + void __noreturn arch_cpu_idle_dead(void) 73 73 { 74 74 cpu_die(); 75 75 }
+1 -1
arch/csky/kernel/smp.c
··· 300 300 pr_notice("CPU%u: shutdown\n", cpu); 301 301 } 302 302 303 - void arch_cpu_idle_dead(void) 303 + void __noreturn arch_cpu_idle_dead(void) 304 304 { 305 305 idle_task_exit(); 306 306
+1 -1
arch/ia64/kernel/process.c
··· 225 225 } 226 226 #endif /* CONFIG_HOTPLUG_CPU */ 227 227 228 - void arch_cpu_idle_dead(void) 228 + void __noreturn arch_cpu_idle_dead(void) 229 229 { 230 230 play_dead(); 231 231 }
+1 -1
arch/loongarch/kernel/process.c
··· 62 62 EXPORT_SYMBOL(boot_option_idle_override); 63 63 64 64 #ifdef CONFIG_HOTPLUG_CPU 65 - void arch_cpu_idle_dead(void) 65 + void __noreturn arch_cpu_idle_dead(void) 66 66 { 67 67 play_dead(); 68 68 }
+1 -1
arch/mips/kernel/process.c
··· 40 40 #include <asm/stacktrace.h> 41 41 42 42 #ifdef CONFIG_HOTPLUG_CPU 43 - void arch_cpu_idle_dead(void) 43 + void __noreturn arch_cpu_idle_dead(void) 44 44 { 45 45 play_dead(); 46 46 }
+1 -1
arch/parisc/kernel/process.c
··· 159 159 /* 160 160 * Called from the idle thread for the CPU which has been shutdown. 161 161 */ 162 - void arch_cpu_idle_dead(void) 162 + void __noreturn arch_cpu_idle_dead(void) 163 163 { 164 164 #ifdef CONFIG_HOTPLUG_CPU 165 165 idle_task_exit();
+1 -1
arch/powerpc/kernel/smp.c
··· 1752 1752 smp_ops->cpu_die(cpu); 1753 1753 } 1754 1754 1755 - void arch_cpu_idle_dead(void) 1755 + void __noreturn arch_cpu_idle_dead(void) 1756 1756 { 1757 1757 /* 1758 1758 * Disable on the down path. This will be re-enabled by
+1 -1
arch/riscv/kernel/cpu-hotplug.c
··· 71 71 /* 72 72 * Called from the idle thread for the CPU which has been shutdown. 73 73 */ 74 - void arch_cpu_idle_dead(void) 74 + void __noreturn arch_cpu_idle_dead(void) 75 75 { 76 76 idle_task_exit(); 77 77
+1 -1
arch/s390/kernel/idle.c
··· 88 88 { 89 89 } 90 90 91 - void arch_cpu_idle_dead(void) 91 + void __noreturn arch_cpu_idle_dead(void) 92 92 { 93 93 cpu_die(); 94 94 }
+1 -1
arch/sh/kernel/idle.c
··· 30 30 clear_bl_bit(); 31 31 } 32 32 33 - void arch_cpu_idle_dead(void) 33 + void __noreturn arch_cpu_idle_dead(void) 34 34 { 35 35 play_dead(); 36 36 }
+1 -1
arch/sparc/kernel/process_64.c
··· 95 95 } 96 96 97 97 #ifdef CONFIG_HOTPLUG_CPU 98 - void arch_cpu_idle_dead(void) 98 + void __noreturn arch_cpu_idle_dead(void) 99 99 { 100 100 sched_preempt_enable_no_resched(); 101 101 cpu_play_dead();
+1 -1
arch/x86/kernel/process.c
··· 727 727 local_touch_nmi(); 728 728 } 729 729 730 - void arch_cpu_idle_dead(void) 730 + void __noreturn arch_cpu_idle_dead(void) 731 731 { 732 732 play_dead(); 733 733 }
+1 -1
arch/xtensa/kernel/smp.c
··· 322 322 pr_err("CPU%u: unable to kill\n", cpu); 323 323 } 324 324 325 - void arch_cpu_idle_dead(void) 325 + void __noreturn arch_cpu_idle_dead(void) 326 326 { 327 327 cpu_die(); 328 328 }
+1 -1
include/linux/cpu.h
··· 182 182 void arch_cpu_idle_prepare(void); 183 183 void arch_cpu_idle_enter(void); 184 184 void arch_cpu_idle_exit(void); 185 - void arch_cpu_idle_dead(void); 185 + void __noreturn arch_cpu_idle_dead(void); 186 186 187 187 int cpu_report_state(int cpu); 188 188 int cpu_check_up_prepare(int cpu);
+1 -1
kernel/sched/idle.c
··· 75 75 void __weak arch_cpu_idle_prepare(void) { } 76 76 void __weak arch_cpu_idle_enter(void) { } 77 77 void __weak arch_cpu_idle_exit(void) { } 78 - void __weak arch_cpu_idle_dead(void) { while (1); } 78 + void __weak __noreturn arch_cpu_idle_dead(void) { while (1); } 79 79 void __weak arch_cpu_idle(void) 80 80 { 81 81 cpu_idle_force_poll = 1;
+1
tools/objtool/check.c
··· 202 202 "__reiserfs_panic", 203 203 "__stack_chk_fail", 204 204 "__ubsan_handle_builtin_unreachable", 205 + "arch_cpu_idle_dead", 205 206 "cpu_bringup_and_idle", 206 207 "cpu_startup_entry", 207 208 "do_exit",