Re: [BUG objtool,x86] Missing __noreturn annotation in acpi_processor_ffh_play_dead()
From: Josh Poimboeuf
Date: Fri Feb 28 2025 - 20:41:30 EST
On Fri, Feb 28, 2025 at 04:33:23PM -0800, Paul E. McKenney wrote:
> Aha! The tools/objtool/noreturns.h is either new to me or was forgotten
> by me. ;-)
>
> This does indeed handle the objtool warnings for CONFIG_SMP=y builds,
> so thank you!
>
> But for CONFIG_SMP=n builds, I get the following:
>
> arch/x86/kernel/acpi/cstate.c: In function ‘acpi_processor_ffh_play_dead’:
> arch/x86/kernel/acpi/cstate.c:216:1: error: ‘noreturn’ function does return [-Werror
>
> And in this build configuration, it does look like mwait_play_dead is an
> empty static inline function. I could imagine making that __noreturn be
> a CPP macro, but I could also imagine making mwait_play_dead() refrain
> from returning.
"play_dead" is an SMP thing and should never be called on non-SMP. And
it's a very good idea for noreturn behavior to be consistent across
configs anyway.
So yeah, I think it's as simple:
diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h
index 80f8bfd83fc7..32990e7396e0 100644
--- a/arch/x86/include/asm/smp.h
+++ b/arch/x86/include/asm/smp.h
@@ -166,7 +166,7 @@ static inline struct cpumask *cpu_llc_shared_mask(int cpu)
return (struct cpumask *)cpumask_of(0);
}
-static inline void mwait_play_dead(unsigned int eax_hint) { }
+static inline void __noreturn mwait_play_dead(unsigned int eax_hint) { BUG(); }
#endif /* CONFIG_SMP */
#ifdef CONFIG_DEBUG_NMI_SELFTEST