[tip: x86/asm] x86/irq/32: Add ASM_CALL_CONSTRAINT to inline asm using CALL_NOSPEC

tip-bot2 for Uros Bizjak
2025-03-04T10:36:24Z

Commit-ID: 4d93ca6d7e92584c559d8687ac9eef15251bb97b
Gitweb: https://git.kernel.org/tip/4d93ca6d7e92584c559d8687ac9eef15251bb97b
Author: Uros Bizjak <ubizjak@gmail.com>
AuthorDate: Mon, 03 Mar 2025 16:54:23 +01:00
Committer: Ingo Molnar <mingo@kernel.org>
CommitterDate: Tue, 04 Mar 2025 11:21:40 +01:00

x86/irq/32: Add ASM_CALL_CONSTRAINT to inline asm using CALL_NOSPEC

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>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20250303155446.112769-3-ubizjak@gmail.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 eab4580..f351fa1 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;
}