]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
x86/smpboot: Mark native_play_dead() as __noreturn
authorThorsten Blum <thorsten.blum@linux.dev>
Mon, 27 Oct 2025 15:51:02 +0000 (16:51 +0100)
committerJosh Poimboeuf <jpoimboe@kernel.org>
Thu, 30 Oct 2025 15:29:41 +0000 (08:29 -0700)
native_play_dead() ends by calling the non-returning function
hlt_play_dead() and therefore also never returns.

The !CONFIG_HOTPLUG_CPU stub version of native_play_dead()
unconditionally calls BUG() and does not return either.

Add the __noreturn attribute to both function definitions and their
declaration to document this behavior and to potentially improve
compiler optimizations.

Remove the obsolete comment, and add native_play_dead() to the objtool's
list of __noreturn functions.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Link: https://patch.msgid.link/20251027155107.183136-1-thorsten.blum@linux.dev
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
arch/x86/include/asm/smp.h
arch/x86/kernel/smpboot.c
tools/objtool/noreturns.h

index 22bfebe6776dab24bb301e055ee9fd1bf514d0cd..84951572ab8170578ca5c4a3437c66e9809f34c2 100644 (file)
@@ -109,7 +109,7 @@ int common_cpu_up(unsigned int cpunum, struct task_struct *tidle);
 int native_kick_ap(unsigned int cpu, struct task_struct *tidle);
 int native_cpu_disable(void);
 void __noreturn hlt_play_dead(void);
-void native_play_dead(void);
+void __noreturn native_play_dead(void);
 void play_dead_common(void);
 void wbinvd_on_cpu(int cpu);
 void wbinvd_on_all_cpus(void);
index eb289abece2370875e7243901df22c48d509c07f..a4ba735842a8a3230355ae8aa48b31b8eb78efd5 100644 (file)
@@ -1328,11 +1328,7 @@ void __noreturn hlt_play_dead(void)
                native_halt();
 }
 
-/*
- * native_play_dead() is essentially a __noreturn function, but it can't
- * be marked as such as the compiler may complain about it.
- */
-void native_play_dead(void)
+void __noreturn native_play_dead(void)
 {
        if (cpu_feature_enabled(X86_FEATURE_KERNEL_IBRS))
                __update_spec_ctrl(0);
@@ -1351,7 +1347,7 @@ int native_cpu_disable(void)
        return -ENOSYS;
 }
 
-void native_play_dead(void)
+void __noreturn native_play_dead(void)
 {
        BUG();
 }
index 802895fae3cac00f46269917f631e02bfb5d3a3e..14f8ab653449c4bc2a27284e9457a14a57812b3c 100644 (file)
@@ -36,6 +36,7 @@ NORETURN(machine_real_restart)
 NORETURN(make_task_dead)
 NORETURN(mpt_halt_firmware)
 NORETURN(mwait_play_dead)
+NORETURN(native_play_dead)
 NORETURN(nmi_panic_self_stop)
 NORETURN(panic)
 NORETURN(vpanic)