Skip to content

Commit d0c965e

Browse files
committed
x86/smp: Fix mwait_play_dead() and acpi_processor_ffh_play_dead() noreturn behavior [partial]
JIRA: https://issues.redhat.com/browse/RHEL-85522 Conflicts: RHEL doesn't have noreturns.h, so update global_no_returns[] in tools/objtool/check.c commit 4e32645 Author: Josh Poimboeuf <jpoimboe@kernel.org> Date: Sun Mar 2 16:48:51 2025 -0800 x86/smp: Fix mwait_play_dead() and acpi_processor_ffh_play_dead() noreturn behavior Fix some related issues (done in a single patch to avoid introducing intermediate bisect warnings): 1) The SMP version of mwait_play_dead() doesn't return, but its !SMP counterpart does. Make its calling behavior consistent by resolving the !SMP version to a BUG(). It should never be called anyway, this just enforces that at runtime and enables its callers to be marked as __noreturn. 2) While the SMP definition of mwait_play_dead() is annotated as __noreturn, the declaration isn't. Nor is it listed in tools/objtool/noreturns.h. Fix that. 3) Similar to #1, the SMP version of acpi_processor_ffh_play_dead() doesn't return but its !SMP counterpart does. Make the !SMP version a BUG(). It should never be called. 4) acpi_processor_ffh_play_dead() doesn't return, but is lacking any __noreturn annotations. Fix that. This fixes the following objtool warnings: vmlinux.o: warning: objtool: acpi_processor_ffh_play_dead+0x67: mwait_play_dead() is missing a __noreturn annotation vmlinux.o: warning: objtool: acpi_idle_play_dead+0x3c: acpi_processor_ffh_play_dead() is missing a __noreturn annotation Fixes: a7dd183 ("x86/smp: Allow calling mwait_play_dead with an arbitrary hint") Fixes: 541ddf3 ("ACPI/processor_idle: Add FFH state handling") Reported-by: Paul E. McKenney <paulmck@kernel.org> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Tested-by: Paul E. McKenney <paulmck@kernel.org> Link: https://lore.kernel.org/r/e885c6fa9e96a61471b33e48c2162d28b15b14c5.1740962711.git.jpoimboe@kernel.org Signed-off-by: David Arcari <darcari@redhat.com>
1 parent c7b889c commit d0c965e

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

arch/x86/include/asm/smp.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ void wbinvd_on_cpu(int cpu);
119119
int wbinvd_on_all_cpus(void);
120120

121121
void smp_kick_mwait_play_dead(void);
122-
void mwait_play_dead(unsigned int eax_hint);
122+
void __noreturn mwait_play_dead(unsigned int eax_hint);
123123

124124
void native_smp_send_reschedule(int cpu);
125125
void native_send_call_func_ipi(const struct cpumask *mask);
@@ -171,7 +171,7 @@ static inline struct cpumask *cpu_llc_shared_mask(int cpu)
171171
return (struct cpumask *)cpumask_of(0);
172172
}
173173

174-
static inline void mwait_play_dead(unsigned int eax_hint) { }
174+
static inline void __noreturn mwait_play_dead(unsigned int eax_hint) { BUG(); }
175175
#endif /* CONFIG_SMP */
176176

177177
#ifdef CONFIG_DEBUG_NMI_SELFTEST

arch/x86/kernel/acpi/cstate.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ int acpi_processor_ffh_cstate_probe(unsigned int cpu,
205205
}
206206
EXPORT_SYMBOL_GPL(acpi_processor_ffh_cstate_probe);
207207

208-
void acpi_processor_ffh_play_dead(struct acpi_processor_cx *cx)
208+
void __noreturn acpi_processor_ffh_play_dead(struct acpi_processor_cx *cx)
209209
{
210210
unsigned int cpu = smp_processor_id();
211211
struct cstate_entry *percpu_entry;

include/acpi/processor.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ int acpi_processor_ffh_cstate_probe(unsigned int cpu,
280280
struct acpi_processor_cx *cx,
281281
struct acpi_power_register *reg);
282282
void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx *cstate);
283-
void acpi_processor_ffh_play_dead(struct acpi_processor_cx *cx);
283+
void __noreturn acpi_processor_ffh_play_dead(struct acpi_processor_cx *cx);
284284
#else
285285
static inline void acpi_processor_power_init_bm_check(struct
286286
acpi_processor_flags
@@ -301,9 +301,9 @@ static inline void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx
301301
{
302302
return;
303303
}
304-
static inline void acpi_processor_ffh_play_dead(struct acpi_processor_cx *cx)
304+
static inline void __noreturn acpi_processor_ffh_play_dead(struct acpi_processor_cx *cx)
305305
{
306-
return;
306+
BUG();
307307
}
308308
#endif
309309

tools/objtool/check.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ static bool __dead_end_function(struct objtool_file *file, struct symbol *func,
205205
"machine_real_restart",
206206
"make_task_dead",
207207
"mpt_halt_firmware",
208+
"mwait_play_dead",
208209
"nmi_panic_self_stop",
209210
"panic",
210211
"panic_smp_self_stop",

0 commit comments

Comments
 (0)