[PATCH -tip 3/5] x86/irq/32: Add ASM_CALL_CONSTRAINT to inline asm using CALL_NOSPEC

Uros Bizjak
2025-03-03T15:55:00Z

This constraint should be used for any inline asm which has a CALL
instruction, otherwise the compiler may schedule the asm before the
frame pointer gets set up by the containing function, causing objtool
to print a "call without frame pointer save/setup" warning.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
---
arch/x86/kernel/irq_32.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index eab458009f97..f351fa1ee6a7 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -59,6 +59,7 @@ static void call_on_stack(void *func, void *stack)
"movl %[sp], %%esp"
: [sp] "+b" (stack)
: [thunk_target] "D" (func)
+ COMMA(ASM_CALL_CONSTRAINT)
: "memory", "cc", "edx", "ecx", "eax");
}

@@ -98,6 +99,7 @@ static inline int execute_on_irq_stack(int overflow, struct irq_desc *desc)
"movl %[sp], %%esp"
: "+a" (desc), [sp] "+b" (isp)
: [thunk_target] "D" (desc->handle_irq)
+ COMMA(ASM_CALL_CONSTRAINT)
: "memory", "cc", "edx", "ecx");
return 1;
}
--
2.42.0