Commit 071c44e4 authored by Josh Poimboeuf's avatar Josh Poimboeuf
Browse files

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: default avatarPaul E. McKenney <paulmck@kernel.org>
Tested-by: default avatarPaul E. McKenney <paulmck@kernel.org>
Link: https://lore.kernel.org/r/60d527353da8c99d4cf13b6473131d46719ed16d.1676358308.git.jpoimboe@kernel.org


Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@kernel.org>
parent dfb0f170
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ void arch_cpu_idle(void)
	wtint(0);
}

void arch_cpu_idle_dead(void)
void __noreturn arch_cpu_idle_dead(void)
{
	wtint(INT_MAX);
	BUG();
+1 −1
Original line number Diff line number Diff line
@@ -320,7 +320,7 @@ void __cpu_die(unsigned int cpu)
 * of the other hotplug-cpu capable cores, so presumably coming
 * out of idle fixes this.
 */
void arch_cpu_idle_dead(void)
void __noreturn arch_cpu_idle_dead(void)
{
	unsigned int cpu = smp_processor_id();

+1 −1
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ void (*pm_power_off)(void);
EXPORT_SYMBOL_GPL(pm_power_off);

#ifdef CONFIG_HOTPLUG_CPU
void arch_cpu_idle_dead(void)
void __noreturn arch_cpu_idle_dead(void)
{
       cpu_die();
}
+1 −1
Original line number Diff line number Diff line
@@ -300,7 +300,7 @@ void __cpu_die(unsigned int cpu)
	pr_notice("CPU%u: shutdown\n", cpu);
}

void arch_cpu_idle_dead(void)
void __noreturn arch_cpu_idle_dead(void)
{
	idle_task_exit();

+1 −1
Original line number Diff line number Diff line
@@ -225,7 +225,7 @@ static inline void __noreturn play_dead(void)
}
#endif /* CONFIG_HOTPLUG_CPU */

void arch_cpu_idle_dead(void)
void __noreturn arch_cpu_idle_dead(void)
{
	play_dead();
}
Loading