* [PATCH -tip 1/5] x86/irq/32: Use named operands in inline asm
@ 2025-03-03 15:54 Uros Bizjak
2025-03-03 15:54 ` [PATCH -tip 2/5] x86/irq/32: Add missing clobber to " Uros Bizjak
` (6 more replies)
0 siblings, 7 replies; 22+ messages in thread
From: Uros Bizjak @ 2025-03-03 15:54 UTC (permalink / raw)
To: x86, linux-kernel
Cc: Uros Bizjak, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
Dave Hansen, H. Peter Anvin
Also use inout "+" constraint modifier where appropriate.
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 | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index dc1049c01f9b..c4719c40252f 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -54,12 +54,11 @@ static inline void print_stack_overflow(void) { }
static void call_on_stack(void *func, void *stack)
{
- asm volatile("xchgl %%ebx,%%esp \n"
+ asm volatile("xchgl %[sp], %%esp\n"
CALL_NOSPEC
- "movl %%ebx,%%esp \n"
- : "=b" (stack)
- : "0" (stack),
- [thunk_target] "D"(func)
+ "movl %[sp], %%esp"
+ : [sp] "+b" (stack)
+ : [thunk_target] "D" (func)
: "memory", "cc", "edx", "ecx", "eax");
}
@@ -71,7 +70,7 @@ static inline void *current_stack(void)
static inline int execute_on_irq_stack(int overflow, struct irq_desc *desc)
{
struct irq_stack *curstk, *irqstk;
- u32 *isp, *prev_esp, arg1;
+ u32 *isp, *prev_esp;
curstk = (struct irq_stack *) current_stack();
irqstk = __this_cpu_read(pcpu_hot.hardirq_stack_ptr);
@@ -94,12 +93,11 @@ static inline int execute_on_irq_stack(int overflow, struct irq_desc *desc)
if (unlikely(overflow))
call_on_stack(print_stack_overflow, isp);
- asm volatile("xchgl %%ebx,%%esp \n"
+ asm volatile("xchgl %[sp], %%esp\n"
CALL_NOSPEC
- "movl %%ebx,%%esp \n"
- : "=a" (arg1), "=b" (isp)
- : "0" (desc), "1" (isp),
- [thunk_target] "D" (desc->handle_irq)
+ "movl %[sp], %%esp"
+ : "+a" (desc), [sp] "+b" (isp)
+ : [thunk_target] "D" (desc->handle_irq)
: "memory", "cc", "ecx");
return 1;
}
--
2.42.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH -tip 2/5] x86/irq/32: Add missing clobber to inline asm
2025-03-03 15:54 [PATCH -tip 1/5] x86/irq/32: Use named operands in inline asm Uros Bizjak
@ 2025-03-03 15:54 ` Uros Bizjak
2025-03-04 10:06 ` [tip: x86/asm] " tip-bot2 for Uros Bizjak
` (2 more replies)
2025-03-03 15:54 ` [PATCH -tip 3/5] x86/irq/32: Add ASM_CALL_CONSTRAINT to inline asm using CALL_NOSPEC Uros Bizjak
` (5 subsequent siblings)
6 siblings, 3 replies; 22+ messages in thread
From: Uros Bizjak @ 2025-03-03 15:54 UTC (permalink / raw)
To: x86, linux-kernel
Cc: Uros Bizjak, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
Dave Hansen, H. Peter Anvin
i386 ABI declares %edx as a call-clobbered register.
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, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index c4719c40252f..eab458009f97 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -98,7 +98,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)
- : "memory", "cc", "ecx");
+ : "memory", "cc", "edx", "ecx");
return 1;
}
--
2.42.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH -tip 3/5] x86/irq/32: Add ASM_CALL_CONSTRAINT to inline asm using CALL_NOSPEC
2025-03-03 15:54 [PATCH -tip 1/5] x86/irq/32: Use named operands in inline asm Uros Bizjak
2025-03-03 15:54 ` [PATCH -tip 2/5] x86/irq/32: Add missing clobber to " Uros Bizjak
@ 2025-03-03 15:54 ` Uros Bizjak
2025-03-04 10:06 ` [tip: x86/asm] " tip-bot2 for Uros Bizjak
` (2 more replies)
2025-03-03 15:54 ` [PATCH -tip 4/5] x86/irq/32: Use current_stack_pointer to avoid asm() in check_stack_overflow() Uros Bizjak
` (4 subsequent siblings)
6 siblings, 3 replies; 22+ messages in thread
From: Uros Bizjak @ 2025-03-03 15:54 UTC (permalink / raw)
To: x86, linux-kernel
Cc: Uros Bizjak, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
Dave Hansen, H. Peter Anvin
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
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH -tip 4/5] x86/irq/32: Use current_stack_pointer to avoid asm() in check_stack_overflow()
2025-03-03 15:54 [PATCH -tip 1/5] x86/irq/32: Use named operands in inline asm Uros Bizjak
2025-03-03 15:54 ` [PATCH -tip 2/5] x86/irq/32: Add missing clobber to " Uros Bizjak
2025-03-03 15:54 ` [PATCH -tip 3/5] x86/irq/32: Add ASM_CALL_CONSTRAINT to inline asm using CALL_NOSPEC Uros Bizjak
@ 2025-03-03 15:54 ` Uros Bizjak
2025-03-04 10:06 ` [tip: x86/asm] " tip-bot2 for Uros Bizjak
` (3 more replies)
2025-03-03 15:54 ` [PATCH -tip 5/5] x86/irq/32: Change some static functions to bool Uros Bizjak
` (3 subsequent siblings)
6 siblings, 4 replies; 22+ messages in thread
From: Uros Bizjak @ 2025-03-03 15:54 UTC (permalink / raw)
To: x86, linux-kernel
Cc: Uros Bizjak, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
Dave Hansen, H. Peter Anvin
Make code more readable by using current_stack_pointer global variable.
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 | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index f351fa1ee6a7..2428d661faaf 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -31,10 +31,7 @@ int sysctl_panic_on_stackoverflow __read_mostly;
/* Debugging check for stack overflow: is there less than 1KB free? */
static int check_stack_overflow(void)
{
- long sp;
-
- __asm__ __volatile__("andl %%esp,%0" :
- "=r" (sp) : "0" (THREAD_SIZE - 1));
+ unsigned long sp = current_stack_pointer & (THREAD_SIZE - 1);
return sp < (sizeof(struct thread_info) + STACK_WARN);
}
--
2.42.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH -tip 5/5] x86/irq/32: Change some static functions to bool
2025-03-03 15:54 [PATCH -tip 1/5] x86/irq/32: Use named operands in inline asm Uros Bizjak
` (2 preceding siblings ...)
2025-03-03 15:54 ` [PATCH -tip 4/5] x86/irq/32: Use current_stack_pointer to avoid asm() in check_stack_overflow() Uros Bizjak
@ 2025-03-03 15:54 ` Uros Bizjak
2025-03-04 10:06 ` [tip: x86/asm] " tip-bot2 for Uros Bizjak
` (3 more replies)
2025-03-04 10:06 ` [tip: x86/asm] x86/irq/32: Use named operands in inline asm tip-bot2 for Uros Bizjak
` (2 subsequent siblings)
6 siblings, 4 replies; 22+ messages in thread
From: Uros Bizjak @ 2025-03-03 15:54 UTC (permalink / raw)
To: x86, linux-kernel
Cc: Uros Bizjak, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
Dave Hansen, H. Peter Anvin
The return values of some functions are of boolean type. Change the
type of these function to bool and adjust their return values.
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 | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index 2428d661faaf..566a93ddf418 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -29,7 +29,7 @@
int sysctl_panic_on_stackoverflow __read_mostly;
/* Debugging check for stack overflow: is there less than 1KB free? */
-static int check_stack_overflow(void)
+static bool check_stack_overflow(void)
{
unsigned long sp = current_stack_pointer & (THREAD_SIZE - 1);
@@ -45,7 +45,7 @@ static void print_stack_overflow(void)
}
#else
-static inline int check_stack_overflow(void) { return 0; }
+static inline bool check_stack_overflow(void) { return false; }
static inline void print_stack_overflow(void) { }
#endif
@@ -65,7 +65,7 @@ static inline void *current_stack(void)
return (void *)(current_stack_pointer & ~(THREAD_SIZE - 1));
}
-static inline int execute_on_irq_stack(int overflow, struct irq_desc *desc)
+static inline bool execute_on_irq_stack(bool overflow, struct irq_desc *desc)
{
struct irq_stack *curstk, *irqstk;
u32 *isp, *prev_esp;
@@ -80,7 +80,7 @@ static inline int execute_on_irq_stack(int overflow, struct irq_desc *desc)
* current stack (which is the irq stack already after all)
*/
if (unlikely(curstk == irqstk))
- return 0;
+ return false;
isp = (u32 *) ((char *)irqstk + sizeof(*irqstk));
@@ -98,7 +98,7 @@ static inline int execute_on_irq_stack(int overflow, struct irq_desc *desc)
: [thunk_target] "D" (desc->handle_irq)
COMMA(ASM_CALL_CONSTRAINT)
: "memory", "cc", "edx", "ecx");
- return 1;
+ return true;
}
/*
@@ -147,7 +147,7 @@ void do_softirq_own_stack(void)
void __handle_irq(struct irq_desc *desc, struct pt_regs *regs)
{
- int overflow = check_stack_overflow();
+ bool overflow = check_stack_overflow();
if (user_mode(regs) || !execute_on_irq_stack(overflow, desc)) {
if (unlikely(overflow))
--
2.42.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [tip: x86/asm] x86/irq/32: Change some static functions to bool
2025-03-03 15:54 ` [PATCH -tip 5/5] x86/irq/32: Change some static functions to bool Uros Bizjak
@ 2025-03-04 10:06 ` tip-bot2 for Uros Bizjak
2025-03-04 10:36 ` tip-bot2 for Uros Bizjak
` (2 subsequent siblings)
3 siblings, 0 replies; 22+ messages in thread
From: tip-bot2 for Uros Bizjak @ 2025-03-04 10:06 UTC (permalink / raw)
To: linux-tip-commits
Cc: Uros Bizjak, Ingo Molnar, Andy Lutomirski, Brian Gerst,
H. Peter Anvin, Linus Torvalds, Peter Zijlstra, x86, linux-kernel
The following commit has been merged into the x86/asm branch of tip:
Commit-ID: 45f6469225e8da92ff1e5ec1027431053ba397c0
Gitweb: https://git.kernel.org/tip/45f6469225e8da92ff1e5ec1027431053ba397c0
Author: Uros Bizjak <ubizjak@gmail.com>
AuthorDate: Mon, 03 Mar 2025 16:54:25 +01:00
Committer: Ingo Molnar <mingo@kernel.org>
CommitterDate: Tue, 04 Mar 2025 10:53:52 +01:00
x86/irq/32: Change some static functions to bool
The return values of these functions is 0/1, but they use an int
type instead of bool:
check_stack_overflow()
execute_on_irq_stack()
Change the type of these function to bool and adjust their return
values and affected helper variables.
[ mingo: Rewrote the changelog ]
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-5-ubizjak@gmail.com
---
arch/x86/kernel/irq_32.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index 2428d66..566a93d 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -29,7 +29,7 @@
int sysctl_panic_on_stackoverflow __read_mostly;
/* Debugging check for stack overflow: is there less than 1KB free? */
-static int check_stack_overflow(void)
+static bool check_stack_overflow(void)
{
unsigned long sp = current_stack_pointer & (THREAD_SIZE - 1);
@@ -45,7 +45,7 @@ static void print_stack_overflow(void)
}
#else
-static inline int check_stack_overflow(void) { return 0; }
+static inline bool check_stack_overflow(void) { return false; }
static inline void print_stack_overflow(void) { }
#endif
@@ -65,7 +65,7 @@ static inline void *current_stack(void)
return (void *)(current_stack_pointer & ~(THREAD_SIZE - 1));
}
-static inline int execute_on_irq_stack(int overflow, struct irq_desc *desc)
+static inline bool execute_on_irq_stack(bool overflow, struct irq_desc *desc)
{
struct irq_stack *curstk, *irqstk;
u32 *isp, *prev_esp;
@@ -80,7 +80,7 @@ static inline int execute_on_irq_stack(int overflow, struct irq_desc *desc)
* current stack (which is the irq stack already after all)
*/
if (unlikely(curstk == irqstk))
- return 0;
+ return false;
isp = (u32 *) ((char *)irqstk + sizeof(*irqstk));
@@ -98,7 +98,7 @@ static inline int execute_on_irq_stack(int overflow, struct irq_desc *desc)
: [thunk_target] "D" (desc->handle_irq)
COMMA(ASM_CALL_CONSTRAINT)
: "memory", "cc", "edx", "ecx");
- return 1;
+ return true;
}
/*
@@ -147,7 +147,7 @@ void do_softirq_own_stack(void)
void __handle_irq(struct irq_desc *desc, struct pt_regs *regs)
{
- int overflow = check_stack_overflow();
+ bool overflow = check_stack_overflow();
if (user_mode(regs) || !execute_on_irq_stack(overflow, desc)) {
if (unlikely(overflow))
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [tip: x86/asm] x86/irq/32: Use current_stack_pointer to avoid asm() in check_stack_overflow()
2025-03-03 15:54 ` [PATCH -tip 4/5] x86/irq/32: Use current_stack_pointer to avoid asm() in check_stack_overflow() Uros Bizjak
@ 2025-03-04 10:06 ` tip-bot2 for Uros Bizjak
2025-03-04 10:36 ` tip-bot2 for Uros Bizjak
` (2 subsequent siblings)
3 siblings, 0 replies; 22+ messages in thread
From: tip-bot2 for Uros Bizjak @ 2025-03-04 10:06 UTC (permalink / raw)
To: linux-tip-commits
Cc: Uros Bizjak, Ingo Molnar, Andy Lutomirski, Brian Gerst,
H. Peter Anvin, Linus Torvalds, Peter Zijlstra, x86, linux-kernel
The following commit has been merged into the x86/asm branch of tip:
Commit-ID: 70e8a96f5408e409dc71b08a366d6d705e9d9fb8
Gitweb: https://git.kernel.org/tip/70e8a96f5408e409dc71b08a366d6d705e9d9fb8
Author: Uros Bizjak <ubizjak@gmail.com>
AuthorDate: Mon, 03 Mar 2025 16:54:24 +01:00
Committer: Ingo Molnar <mingo@kernel.org>
CommitterDate: Tue, 04 Mar 2025 10:53:51 +01:00
x86/irq/32: Use current_stack_pointer to avoid asm() in check_stack_overflow()
Make code more readable by using the 'current_stack_pointer' global variable.
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-4-ubizjak@gmail.com
---
arch/x86/kernel/irq_32.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index f351fa1..2428d66 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -31,10 +31,7 @@ int sysctl_panic_on_stackoverflow __read_mostly;
/* Debugging check for stack overflow: is there less than 1KB free? */
static int check_stack_overflow(void)
{
- long sp;
-
- __asm__ __volatile__("andl %%esp,%0" :
- "=r" (sp) : "0" (THREAD_SIZE - 1));
+ unsigned long sp = current_stack_pointer & (THREAD_SIZE - 1);
return sp < (sizeof(struct thread_info) + STACK_WARN);
}
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [tip: x86/asm] x86/irq/32: Add ASM_CALL_CONSTRAINT to inline asm using CALL_NOSPEC
2025-03-03 15:54 ` [PATCH -tip 3/5] x86/irq/32: Add ASM_CALL_CONSTRAINT to inline asm using CALL_NOSPEC Uros Bizjak
@ 2025-03-04 10:06 ` tip-bot2 for Uros Bizjak
2025-03-04 10:36 ` tip-bot2 for Uros Bizjak
2025-03-04 19:23 ` tip-bot2 for Uros Bizjak
2 siblings, 0 replies; 22+ messages in thread
From: tip-bot2 for Uros Bizjak @ 2025-03-04 10:06 UTC (permalink / raw)
To: linux-tip-commits
Cc: Uros Bizjak, Ingo Molnar, Andy Lutomirski, Brian Gerst,
H. Peter Anvin, Linus Torvalds, Peter Zijlstra, x86, linux-kernel
The following commit has been merged into the x86/asm branch of tip:
Commit-ID: 94770fe8648b80ee7ec4484e43b2381a25b62746
Gitweb: https://git.kernel.org/tip/94770fe8648b80ee7ec4484e43b2381a25b62746
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 10:53:51 +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;
}
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [tip: x86/asm] x86/irq/32: Add missing clobber to inline asm
2025-03-03 15:54 ` [PATCH -tip 2/5] x86/irq/32: Add missing clobber to " Uros Bizjak
@ 2025-03-04 10:06 ` tip-bot2 for Uros Bizjak
2025-03-04 10:36 ` tip-bot2 for Uros Bizjak
2025-03-04 19:23 ` tip-bot2 for Uros Bizjak
2 siblings, 0 replies; 22+ messages in thread
From: tip-bot2 for Uros Bizjak @ 2025-03-04 10:06 UTC (permalink / raw)
To: linux-tip-commits
Cc: Uros Bizjak, Ingo Molnar, Andy Lutomirski, Brian Gerst,
H. Peter Anvin, Linus Torvalds, Peter Zijlstra, x86, linux-kernel
The following commit has been merged into the x86/asm branch of tip:
Commit-ID: 553d9797b9a161ae98072250bbe7ba4cec03cb87
Gitweb: https://git.kernel.org/tip/553d9797b9a161ae98072250bbe7ba4cec03cb87
Author: Uros Bizjak <ubizjak@gmail.com>
AuthorDate: Mon, 03 Mar 2025 16:54:22 +01:00
Committer: Ingo Molnar <mingo@kernel.org>
CommitterDate: Tue, 04 Mar 2025 10:53:51 +01:00
x86/irq/32: Add missing clobber to inline asm
i386 ABI declares %edx as a call-clobbered register.
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-2-ubizjak@gmail.com
---
arch/x86/kernel/irq_32.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index c4719c4..eab4580 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -98,7 +98,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)
- : "memory", "cc", "ecx");
+ : "memory", "cc", "edx", "ecx");
return 1;
}
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [tip: x86/asm] x86/irq/32: Use named operands in inline asm
2025-03-03 15:54 [PATCH -tip 1/5] x86/irq/32: Use named operands in inline asm Uros Bizjak
` (3 preceding siblings ...)
2025-03-03 15:54 ` [PATCH -tip 5/5] x86/irq/32: Change some static functions to bool Uros Bizjak
@ 2025-03-04 10:06 ` tip-bot2 for Uros Bizjak
2025-03-04 10:36 ` tip-bot2 for Uros Bizjak
2025-03-04 19:23 ` tip-bot2 for Uros Bizjak
6 siblings, 0 replies; 22+ messages in thread
From: tip-bot2 for Uros Bizjak @ 2025-03-04 10:06 UTC (permalink / raw)
To: linux-tip-commits
Cc: Uros Bizjak, Ingo Molnar, Andy Lutomirski, Brian Gerst,
H. Peter Anvin, Linus Torvalds, Peter Zijlstra, x86, linux-kernel
The following commit has been merged into the x86/asm branch of tip:
Commit-ID: 3fc50ac7607a18a60207901ad1604dae9b52701b
Gitweb: https://git.kernel.org/tip/3fc50ac7607a18a60207901ad1604dae9b52701b
Author: Uros Bizjak <ubizjak@gmail.com>
AuthorDate: Mon, 03 Mar 2025 16:54:21 +01:00
Committer: Ingo Molnar <mingo@kernel.org>
CommitterDate: Tue, 04 Mar 2025 10:53:51 +01:00
x86/irq/32: Use named operands in inline asm
Also use inout "+" constraint modifier where appropriate.
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-1-ubizjak@gmail.com
---
arch/x86/kernel/irq_32.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index dc1049c..c4719c4 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -54,12 +54,11 @@ static inline void print_stack_overflow(void) { }
static void call_on_stack(void *func, void *stack)
{
- asm volatile("xchgl %%ebx,%%esp \n"
+ asm volatile("xchgl %[sp], %%esp\n"
CALL_NOSPEC
- "movl %%ebx,%%esp \n"
- : "=b" (stack)
- : "0" (stack),
- [thunk_target] "D"(func)
+ "movl %[sp], %%esp"
+ : [sp] "+b" (stack)
+ : [thunk_target] "D" (func)
: "memory", "cc", "edx", "ecx", "eax");
}
@@ -71,7 +70,7 @@ static inline void *current_stack(void)
static inline int execute_on_irq_stack(int overflow, struct irq_desc *desc)
{
struct irq_stack *curstk, *irqstk;
- u32 *isp, *prev_esp, arg1;
+ u32 *isp, *prev_esp;
curstk = (struct irq_stack *) current_stack();
irqstk = __this_cpu_read(pcpu_hot.hardirq_stack_ptr);
@@ -94,12 +93,11 @@ static inline int execute_on_irq_stack(int overflow, struct irq_desc *desc)
if (unlikely(overflow))
call_on_stack(print_stack_overflow, isp);
- asm volatile("xchgl %%ebx,%%esp \n"
+ asm volatile("xchgl %[sp], %%esp\n"
CALL_NOSPEC
- "movl %%ebx,%%esp \n"
- : "=a" (arg1), "=b" (isp)
- : "0" (desc), "1" (isp),
- [thunk_target] "D" (desc->handle_irq)
+ "movl %[sp], %%esp"
+ : "+a" (desc), [sp] "+b" (isp)
+ : [thunk_target] "D" (desc->handle_irq)
: "memory", "cc", "ecx");
return 1;
}
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [tip: x86/asm] x86/irq/32: Change some static functions to bool
2025-03-03 15:54 ` [PATCH -tip 5/5] x86/irq/32: Change some static functions to bool Uros Bizjak
2025-03-04 10:06 ` [tip: x86/asm] " tip-bot2 for Uros Bizjak
@ 2025-03-04 10:36 ` tip-bot2 for Uros Bizjak
2025-03-04 19:23 ` tip-bot2 for Uros Bizjak
2025-03-04 19:33 ` tip-bot2 for Uros Bizjak
3 siblings, 0 replies; 22+ messages in thread
From: tip-bot2 for Uros Bizjak @ 2025-03-04 10:36 UTC (permalink / raw)
To: linux-tip-commits
Cc: Uros Bizjak, Ingo Molnar, Andy Lutomirski, Brian Gerst,
H. Peter Anvin, Linus Torvalds, Peter Zijlstra, x86, linux-kernel
The following commit has been merged into the x86/asm branch of tip:
Commit-ID: 7b52de3a2811bf16f52b895478920113e1b39878
Gitweb: https://git.kernel.org/tip/7b52de3a2811bf16f52b895478920113e1b39878
Author: Uros Bizjak <ubizjak@gmail.com>
AuthorDate: Mon, 03 Mar 2025 16:54:25 +01:00
Committer: Ingo Molnar <mingo@kernel.org>
CommitterDate: Tue, 04 Mar 2025 11:21:40 +01:00
x86/irq/32: Change some static functions to bool
The return values of these functions is 0/1, but they use an int
type instead of bool:
check_stack_overflow()
execute_on_irq_stack()
Change the type of these function to bool and adjust their return
values and affected helper variables.
[ mingo: Rewrote the changelog ]
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-5-ubizjak@gmail.com
---
arch/x86/kernel/irq_32.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index 2428d66..566a93d 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -29,7 +29,7 @@
int sysctl_panic_on_stackoverflow __read_mostly;
/* Debugging check for stack overflow: is there less than 1KB free? */
-static int check_stack_overflow(void)
+static bool check_stack_overflow(void)
{
unsigned long sp = current_stack_pointer & (THREAD_SIZE - 1);
@@ -45,7 +45,7 @@ static void print_stack_overflow(void)
}
#else
-static inline int check_stack_overflow(void) { return 0; }
+static inline bool check_stack_overflow(void) { return false; }
static inline void print_stack_overflow(void) { }
#endif
@@ -65,7 +65,7 @@ static inline void *current_stack(void)
return (void *)(current_stack_pointer & ~(THREAD_SIZE - 1));
}
-static inline int execute_on_irq_stack(int overflow, struct irq_desc *desc)
+static inline bool execute_on_irq_stack(bool overflow, struct irq_desc *desc)
{
struct irq_stack *curstk, *irqstk;
u32 *isp, *prev_esp;
@@ -80,7 +80,7 @@ static inline int execute_on_irq_stack(int overflow, struct irq_desc *desc)
* current stack (which is the irq stack already after all)
*/
if (unlikely(curstk == irqstk))
- return 0;
+ return false;
isp = (u32 *) ((char *)irqstk + sizeof(*irqstk));
@@ -98,7 +98,7 @@ static inline int execute_on_irq_stack(int overflow, struct irq_desc *desc)
: [thunk_target] "D" (desc->handle_irq)
COMMA(ASM_CALL_CONSTRAINT)
: "memory", "cc", "edx", "ecx");
- return 1;
+ return true;
}
/*
@@ -147,7 +147,7 @@ void do_softirq_own_stack(void)
void __handle_irq(struct irq_desc *desc, struct pt_regs *regs)
{
- int overflow = check_stack_overflow();
+ bool overflow = check_stack_overflow();
if (user_mode(regs) || !execute_on_irq_stack(overflow, desc)) {
if (unlikely(overflow))
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [tip: x86/asm] x86/irq/32: Use current_stack_pointer to avoid asm() in check_stack_overflow()
2025-03-03 15:54 ` [PATCH -tip 4/5] x86/irq/32: Use current_stack_pointer to avoid asm() in check_stack_overflow() Uros Bizjak
2025-03-04 10:06 ` [tip: x86/asm] " tip-bot2 for Uros Bizjak
@ 2025-03-04 10:36 ` tip-bot2 for Uros Bizjak
2025-03-04 19:23 ` tip-bot2 for Uros Bizjak
2025-03-04 19:33 ` tip-bot2 for Uros Bizjak
3 siblings, 0 replies; 22+ messages in thread
From: tip-bot2 for Uros Bizjak @ 2025-03-04 10:36 UTC (permalink / raw)
To: linux-tip-commits
Cc: Uros Bizjak, Ingo Molnar, Andy Lutomirski, Brian Gerst,
H. Peter Anvin, Linus Torvalds, Peter Zijlstra, x86, linux-kernel
The following commit has been merged into the x86/asm branch of tip:
Commit-ID: 9266be1052e0586ea932011ad671beefbaff1a64
Gitweb: https://git.kernel.org/tip/9266be1052e0586ea932011ad671beefbaff1a64
Author: Uros Bizjak <ubizjak@gmail.com>
AuthorDate: Mon, 03 Mar 2025 16:54:24 +01:00
Committer: Ingo Molnar <mingo@kernel.org>
CommitterDate: Tue, 04 Mar 2025 11:21:40 +01:00
x86/irq/32: Use current_stack_pointer to avoid asm() in check_stack_overflow()
Make code more readable by using the 'current_stack_pointer' global variable.
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-4-ubizjak@gmail.com
---
arch/x86/kernel/irq_32.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index f351fa1..2428d66 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -31,10 +31,7 @@ int sysctl_panic_on_stackoverflow __read_mostly;
/* Debugging check for stack overflow: is there less than 1KB free? */
static int check_stack_overflow(void)
{
- long sp;
-
- __asm__ __volatile__("andl %%esp,%0" :
- "=r" (sp) : "0" (THREAD_SIZE - 1));
+ unsigned long sp = current_stack_pointer & (THREAD_SIZE - 1);
return sp < (sizeof(struct thread_info) + STACK_WARN);
}
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [tip: x86/asm] x86/irq/32: Add ASM_CALL_CONSTRAINT to inline asm using CALL_NOSPEC
2025-03-03 15:54 ` [PATCH -tip 3/5] x86/irq/32: Add ASM_CALL_CONSTRAINT to inline asm using CALL_NOSPEC Uros Bizjak
2025-03-04 10:06 ` [tip: x86/asm] " tip-bot2 for Uros Bizjak
@ 2025-03-04 10:36 ` tip-bot2 for Uros Bizjak
2025-03-04 19:23 ` tip-bot2 for Uros Bizjak
2 siblings, 0 replies; 22+ messages in thread
From: tip-bot2 for Uros Bizjak @ 2025-03-04 10:36 UTC (permalink / raw)
To: linux-tip-commits
Cc: Uros Bizjak, Ingo Molnar, Andy Lutomirski, Brian Gerst,
H. Peter Anvin, Linus Torvalds, Peter Zijlstra, x86, linux-kernel
The following commit has been merged into the x86/asm branch of tip:
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;
}
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [tip: x86/asm] x86/irq/32: Add missing clobber to inline asm
2025-03-03 15:54 ` [PATCH -tip 2/5] x86/irq/32: Add missing clobber to " Uros Bizjak
2025-03-04 10:06 ` [tip: x86/asm] " tip-bot2 for Uros Bizjak
@ 2025-03-04 10:36 ` tip-bot2 for Uros Bizjak
2025-03-04 19:23 ` tip-bot2 for Uros Bizjak
2 siblings, 0 replies; 22+ messages in thread
From: tip-bot2 for Uros Bizjak @ 2025-03-04 10:36 UTC (permalink / raw)
To: linux-tip-commits
Cc: Uros Bizjak, Ingo Molnar, Andy Lutomirski, Brian Gerst,
H. Peter Anvin, Linus Torvalds, Peter Zijlstra, x86, linux-kernel
The following commit has been merged into the x86/asm branch of tip:
Commit-ID: 40d9cd9bb08cbe36900efd1600e2228698d52b4a
Gitweb: https://git.kernel.org/tip/40d9cd9bb08cbe36900efd1600e2228698d52b4a
Author: Uros Bizjak <ubizjak@gmail.com>
AuthorDate: Mon, 03 Mar 2025 16:54:22 +01:00
Committer: Ingo Molnar <mingo@kernel.org>
CommitterDate: Tue, 04 Mar 2025 11:21:40 +01:00
x86/irq/32: Add missing clobber to inline asm
i386 ABI declares %edx as a call-clobbered register.
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-2-ubizjak@gmail.com
---
arch/x86/kernel/irq_32.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index c4719c4..eab4580 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -98,7 +98,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)
- : "memory", "cc", "ecx");
+ : "memory", "cc", "edx", "ecx");
return 1;
}
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [tip: x86/asm] x86/irq/32: Use named operands in inline asm
2025-03-03 15:54 [PATCH -tip 1/5] x86/irq/32: Use named operands in inline asm Uros Bizjak
` (4 preceding siblings ...)
2025-03-04 10:06 ` [tip: x86/asm] x86/irq/32: Use named operands in inline asm tip-bot2 for Uros Bizjak
@ 2025-03-04 10:36 ` tip-bot2 for Uros Bizjak
2025-03-04 19:23 ` tip-bot2 for Uros Bizjak
6 siblings, 0 replies; 22+ messages in thread
From: tip-bot2 for Uros Bizjak @ 2025-03-04 10:36 UTC (permalink / raw)
To: linux-tip-commits
Cc: Uros Bizjak, Ingo Molnar, Andy Lutomirski, Brian Gerst,
H. Peter Anvin, Linus Torvalds, Peter Zijlstra, x86, linux-kernel
The following commit has been merged into the x86/asm branch of tip:
Commit-ID: df682f7b763e8d983ef70c4908f8980a2ffc81cd
Gitweb: https://git.kernel.org/tip/df682f7b763e8d983ef70c4908f8980a2ffc81cd
Author: Uros Bizjak <ubizjak@gmail.com>
AuthorDate: Mon, 03 Mar 2025 16:54:21 +01:00
Committer: Ingo Molnar <mingo@kernel.org>
CommitterDate: Tue, 04 Mar 2025 11:21:40 +01:00
x86/irq/32: Use named operands in inline asm
Also use inout "+" constraint modifier where appropriate.
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-1-ubizjak@gmail.com
---
arch/x86/kernel/irq_32.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index dc1049c..c4719c4 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -54,12 +54,11 @@ static inline void print_stack_overflow(void) { }
static void call_on_stack(void *func, void *stack)
{
- asm volatile("xchgl %%ebx,%%esp \n"
+ asm volatile("xchgl %[sp], %%esp\n"
CALL_NOSPEC
- "movl %%ebx,%%esp \n"
- : "=b" (stack)
- : "0" (stack),
- [thunk_target] "D"(func)
+ "movl %[sp], %%esp"
+ : [sp] "+b" (stack)
+ : [thunk_target] "D" (func)
: "memory", "cc", "edx", "ecx", "eax");
}
@@ -71,7 +70,7 @@ static inline void *current_stack(void)
static inline int execute_on_irq_stack(int overflow, struct irq_desc *desc)
{
struct irq_stack *curstk, *irqstk;
- u32 *isp, *prev_esp, arg1;
+ u32 *isp, *prev_esp;
curstk = (struct irq_stack *) current_stack();
irqstk = __this_cpu_read(pcpu_hot.hardirq_stack_ptr);
@@ -94,12 +93,11 @@ static inline int execute_on_irq_stack(int overflow, struct irq_desc *desc)
if (unlikely(overflow))
call_on_stack(print_stack_overflow, isp);
- asm volatile("xchgl %%ebx,%%esp \n"
+ asm volatile("xchgl %[sp], %%esp\n"
CALL_NOSPEC
- "movl %%ebx,%%esp \n"
- : "=a" (arg1), "=b" (isp)
- : "0" (desc), "1" (isp),
- [thunk_target] "D" (desc->handle_irq)
+ "movl %[sp], %%esp"
+ : "+a" (desc), [sp] "+b" (isp)
+ : [thunk_target] "D" (desc->handle_irq)
: "memory", "cc", "ecx");
return 1;
}
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [tip: x86/asm] x86/irq/32: Change some static functions to bool
2025-03-03 15:54 ` [PATCH -tip 5/5] x86/irq/32: Change some static functions to bool Uros Bizjak
2025-03-04 10:06 ` [tip: x86/asm] " tip-bot2 for Uros Bizjak
2025-03-04 10:36 ` tip-bot2 for Uros Bizjak
@ 2025-03-04 19:23 ` tip-bot2 for Uros Bizjak
2025-03-04 19:33 ` tip-bot2 for Uros Bizjak
3 siblings, 0 replies; 22+ messages in thread
From: tip-bot2 for Uros Bizjak @ 2025-03-04 19:23 UTC (permalink / raw)
To: linux-tip-commits
Cc: Uros Bizjak, Ingo Molnar, Andy Lutomirski, Brian Gerst,
H. Peter Anvin, Linus Torvalds, Peter Zijlstra, x86, linux-kernel
The following commit has been merged into the x86/asm branch of tip:
Commit-ID: 9c5f9473dfa0b13af72b8f856e2c87d36acaed90
Gitweb: https://git.kernel.org/tip/9c5f9473dfa0b13af72b8f856e2c87d36acaed90
Author: Uros Bizjak <ubizjak@gmail.com>
AuthorDate: Mon, 03 Mar 2025 16:54:25 +01:00
Committer: Ingo Molnar <mingo@kernel.org>
CommitterDate: Tue, 04 Mar 2025 20:12:40 +01:00
x86/irq/32: Change some static functions to bool
The return values of these functions is 0/1, but they use an int
type instead of bool:
check_stack_overflow()
execute_on_irq_stack()
Change the type of these function to bool and adjust their return
values and affected helper variables.
[ mingo: Rewrote the changelog ]
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-5-ubizjak@gmail.com
---
arch/x86/kernel/irq_32.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index 2428d66..566a93d 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -29,7 +29,7 @@
int sysctl_panic_on_stackoverflow __read_mostly;
/* Debugging check for stack overflow: is there less than 1KB free? */
-static int check_stack_overflow(void)
+static bool check_stack_overflow(void)
{
unsigned long sp = current_stack_pointer & (THREAD_SIZE - 1);
@@ -45,7 +45,7 @@ static void print_stack_overflow(void)
}
#else
-static inline int check_stack_overflow(void) { return 0; }
+static inline bool check_stack_overflow(void) { return false; }
static inline void print_stack_overflow(void) { }
#endif
@@ -65,7 +65,7 @@ static inline void *current_stack(void)
return (void *)(current_stack_pointer & ~(THREAD_SIZE - 1));
}
-static inline int execute_on_irq_stack(int overflow, struct irq_desc *desc)
+static inline bool execute_on_irq_stack(bool overflow, struct irq_desc *desc)
{
struct irq_stack *curstk, *irqstk;
u32 *isp, *prev_esp;
@@ -80,7 +80,7 @@ static inline int execute_on_irq_stack(int overflow, struct irq_desc *desc)
* current stack (which is the irq stack already after all)
*/
if (unlikely(curstk == irqstk))
- return 0;
+ return false;
isp = (u32 *) ((char *)irqstk + sizeof(*irqstk));
@@ -98,7 +98,7 @@ static inline int execute_on_irq_stack(int overflow, struct irq_desc *desc)
: [thunk_target] "D" (desc->handle_irq)
COMMA(ASM_CALL_CONSTRAINT)
: "memory", "cc", "edx", "ecx");
- return 1;
+ return true;
}
/*
@@ -147,7 +147,7 @@ void do_softirq_own_stack(void)
void __handle_irq(struct irq_desc *desc, struct pt_regs *regs)
{
- int overflow = check_stack_overflow();
+ bool overflow = check_stack_overflow();
if (user_mode(regs) || !execute_on_irq_stack(overflow, desc)) {
if (unlikely(overflow))
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [tip: x86/asm] x86/irq/32: Use current_stack_pointer to avoid asm() in check_stack_overflow()
2025-03-03 15:54 ` [PATCH -tip 4/5] x86/irq/32: Use current_stack_pointer to avoid asm() in check_stack_overflow() Uros Bizjak
2025-03-04 10:06 ` [tip: x86/asm] " tip-bot2 for Uros Bizjak
2025-03-04 10:36 ` tip-bot2 for Uros Bizjak
@ 2025-03-04 19:23 ` tip-bot2 for Uros Bizjak
2025-03-04 19:33 ` tip-bot2 for Uros Bizjak
3 siblings, 0 replies; 22+ messages in thread
From: tip-bot2 for Uros Bizjak @ 2025-03-04 19:23 UTC (permalink / raw)
To: linux-tip-commits
Cc: Uros Bizjak, Ingo Molnar, Andy Lutomirski, Brian Gerst,
H. Peter Anvin, Linus Torvalds, Peter Zijlstra, x86, linux-kernel
The following commit has been merged into the x86/asm branch of tip:
Commit-ID: 1aee47babaa440b92314199963c5ed3395dc4edb
Gitweb: https://git.kernel.org/tip/1aee47babaa440b92314199963c5ed3395dc4edb
Author: Uros Bizjak <ubizjak@gmail.com>
AuthorDate: Mon, 03 Mar 2025 16:54:24 +01:00
Committer: Ingo Molnar <mingo@kernel.org>
CommitterDate: Tue, 04 Mar 2025 20:12:40 +01:00
x86/irq/32: Use current_stack_pointer to avoid asm() in check_stack_overflow()
Make code more readable by using the 'current_stack_pointer' global variable.
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-4-ubizjak@gmail.com
---
arch/x86/kernel/irq_32.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index f351fa1..2428d66 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -31,10 +31,7 @@ int sysctl_panic_on_stackoverflow __read_mostly;
/* Debugging check for stack overflow: is there less than 1KB free? */
static int check_stack_overflow(void)
{
- long sp;
-
- __asm__ __volatile__("andl %%esp,%0" :
- "=r" (sp) : "0" (THREAD_SIZE - 1));
+ unsigned long sp = current_stack_pointer & (THREAD_SIZE - 1);
return sp < (sizeof(struct thread_info) + STACK_WARN);
}
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [tip: x86/asm] x86/irq/32: Add ASM_CALL_CONSTRAINT to inline asm using CALL_NOSPEC
2025-03-03 15:54 ` [PATCH -tip 3/5] x86/irq/32: Add ASM_CALL_CONSTRAINT to inline asm using CALL_NOSPEC Uros Bizjak
2025-03-04 10:06 ` [tip: x86/asm] " tip-bot2 for Uros Bizjak
2025-03-04 10:36 ` tip-bot2 for Uros Bizjak
@ 2025-03-04 19:23 ` tip-bot2 for Uros Bizjak
2 siblings, 0 replies; 22+ messages in thread
From: tip-bot2 for Uros Bizjak @ 2025-03-04 19:23 UTC (permalink / raw)
To: linux-tip-commits
Cc: Uros Bizjak, Ingo Molnar, Andy Lutomirski, Brian Gerst,
H. Peter Anvin, Linus Torvalds, Peter Zijlstra, x86, linux-kernel
The following commit has been merged into the x86/asm branch of tip:
Commit-ID: 784af8f453fddec902639f42e2456f7fb5199450
Gitweb: https://git.kernel.org/tip/784af8f453fddec902639f42e2456f7fb5199450
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 20:12: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;
}
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [tip: x86/asm] x86/irq/32: Add missing clobber to inline asm
2025-03-03 15:54 ` [PATCH -tip 2/5] x86/irq/32: Add missing clobber to " Uros Bizjak
2025-03-04 10:06 ` [tip: x86/asm] " tip-bot2 for Uros Bizjak
2025-03-04 10:36 ` tip-bot2 for Uros Bizjak
@ 2025-03-04 19:23 ` tip-bot2 for Uros Bizjak
2 siblings, 0 replies; 22+ messages in thread
From: tip-bot2 for Uros Bizjak @ 2025-03-04 19:23 UTC (permalink / raw)
To: linux-tip-commits
Cc: Uros Bizjak, Ingo Molnar, Andy Lutomirski, Brian Gerst,
H. Peter Anvin, Linus Torvalds, Peter Zijlstra, x86, linux-kernel
The following commit has been merged into the x86/asm branch of tip:
Commit-ID: 76f71137811a6dfa52b3e22a86a772e5753021d3
Gitweb: https://git.kernel.org/tip/76f71137811a6dfa52b3e22a86a772e5753021d3
Author: Uros Bizjak <ubizjak@gmail.com>
AuthorDate: Mon, 03 Mar 2025 16:54:22 +01:00
Committer: Ingo Molnar <mingo@kernel.org>
CommitterDate: Tue, 04 Mar 2025 20:12:40 +01:00
x86/irq/32: Add missing clobber to inline asm
i386 ABI declares %edx as a call-clobbered register.
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-2-ubizjak@gmail.com
---
arch/x86/kernel/irq_32.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index c4719c4..eab4580 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -98,7 +98,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)
- : "memory", "cc", "ecx");
+ : "memory", "cc", "edx", "ecx");
return 1;
}
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [tip: x86/asm] x86/irq/32: Use named operands in inline asm
2025-03-03 15:54 [PATCH -tip 1/5] x86/irq/32: Use named operands in inline asm Uros Bizjak
` (5 preceding siblings ...)
2025-03-04 10:36 ` tip-bot2 for Uros Bizjak
@ 2025-03-04 19:23 ` tip-bot2 for Uros Bizjak
6 siblings, 0 replies; 22+ messages in thread
From: tip-bot2 for Uros Bizjak @ 2025-03-04 19:23 UTC (permalink / raw)
To: linux-tip-commits
Cc: Uros Bizjak, Ingo Molnar, Andy Lutomirski, Brian Gerst,
H. Peter Anvin, Linus Torvalds, Peter Zijlstra, x86, linux-kernel
The following commit has been merged into the x86/asm branch of tip:
Commit-ID: 0ec914707c3ed052ed26eb88f9300109030a7fb2
Gitweb: https://git.kernel.org/tip/0ec914707c3ed052ed26eb88f9300109030a7fb2
Author: Uros Bizjak <ubizjak@gmail.com>
AuthorDate: Mon, 03 Mar 2025 16:54:21 +01:00
Committer: Ingo Molnar <mingo@kernel.org>
CommitterDate: Tue, 04 Mar 2025 20:12:40 +01:00
x86/irq/32: Use named operands in inline asm
Also use inout "+" constraint modifier where appropriate.
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-1-ubizjak@gmail.com
---
arch/x86/kernel/irq_32.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index dc1049c..c4719c4 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -54,12 +54,11 @@ static inline void print_stack_overflow(void) { }
static void call_on_stack(void *func, void *stack)
{
- asm volatile("xchgl %%ebx,%%esp \n"
+ asm volatile("xchgl %[sp], %%esp\n"
CALL_NOSPEC
- "movl %%ebx,%%esp \n"
- : "=b" (stack)
- : "0" (stack),
- [thunk_target] "D"(func)
+ "movl %[sp], %%esp"
+ : [sp] "+b" (stack)
+ : [thunk_target] "D" (func)
: "memory", "cc", "edx", "ecx", "eax");
}
@@ -71,7 +70,7 @@ static inline void *current_stack(void)
static inline int execute_on_irq_stack(int overflow, struct irq_desc *desc)
{
struct irq_stack *curstk, *irqstk;
- u32 *isp, *prev_esp, arg1;
+ u32 *isp, *prev_esp;
curstk = (struct irq_stack *) current_stack();
irqstk = __this_cpu_read(pcpu_hot.hardirq_stack_ptr);
@@ -94,12 +93,11 @@ static inline int execute_on_irq_stack(int overflow, struct irq_desc *desc)
if (unlikely(overflow))
call_on_stack(print_stack_overflow, isp);
- asm volatile("xchgl %%ebx,%%esp \n"
+ asm volatile("xchgl %[sp], %%esp\n"
CALL_NOSPEC
- "movl %%ebx,%%esp \n"
- : "=a" (arg1), "=b" (isp)
- : "0" (desc), "1" (isp),
- [thunk_target] "D" (desc->handle_irq)
+ "movl %[sp], %%esp"
+ : "+a" (desc), [sp] "+b" (isp)
+ : [thunk_target] "D" (desc->handle_irq)
: "memory", "cc", "ecx");
return 1;
}
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [tip: x86/asm] x86/irq/32: Use current_stack_pointer to avoid asm() in check_stack_overflow()
2025-03-03 15:54 ` [PATCH -tip 4/5] x86/irq/32: Use current_stack_pointer to avoid asm() in check_stack_overflow() Uros Bizjak
` (2 preceding siblings ...)
2025-03-04 19:23 ` tip-bot2 for Uros Bizjak
@ 2025-03-04 19:33 ` tip-bot2 for Uros Bizjak
3 siblings, 0 replies; 22+ messages in thread
From: tip-bot2 for Uros Bizjak @ 2025-03-04 19:33 UTC (permalink / raw)
To: linux-tip-commits
Cc: Uros Bizjak, Ingo Molnar, Andy Lutomirski, Brian Gerst,
H. Peter Anvin, Linus Torvalds, Peter Zijlstra, x86, linux-kernel
The following commit has been merged into the x86/asm branch of tip:
Commit-ID: d4432fb5b8798a7663974bed277a8a6e330a50d8
Gitweb: https://git.kernel.org/tip/d4432fb5b8798a7663974bed277a8a6e330a50d8
Author: Uros Bizjak <ubizjak@gmail.com>
AuthorDate: Mon, 03 Mar 2025 16:54:24 +01:00
Committer: Ingo Molnar <mingo@kernel.org>
CommitterDate: Tue, 04 Mar 2025 20:28:58 +01:00
x86/irq/32: Use current_stack_pointer to avoid asm() in check_stack_overflow()
Make code more readable by using the 'current_stack_pointer' global variable.
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-4-ubizjak@gmail.com
---
arch/x86/kernel/irq_32.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index eab4580..8c7babb 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -31,10 +31,7 @@ int sysctl_panic_on_stackoverflow __read_mostly;
/* Debugging check for stack overflow: is there less than 1KB free? */
static int check_stack_overflow(void)
{
- long sp;
-
- __asm__ __volatile__("andl %%esp,%0" :
- "=r" (sp) : "0" (THREAD_SIZE - 1));
+ unsigned long sp = current_stack_pointer & (THREAD_SIZE - 1);
return sp < (sizeof(struct thread_info) + STACK_WARN);
}
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [tip: x86/asm] x86/irq/32: Change some static functions to bool
2025-03-03 15:54 ` [PATCH -tip 5/5] x86/irq/32: Change some static functions to bool Uros Bizjak
` (2 preceding siblings ...)
2025-03-04 19:23 ` tip-bot2 for Uros Bizjak
@ 2025-03-04 19:33 ` tip-bot2 for Uros Bizjak
3 siblings, 0 replies; 22+ messages in thread
From: tip-bot2 for Uros Bizjak @ 2025-03-04 19:33 UTC (permalink / raw)
To: linux-tip-commits
Cc: Uros Bizjak, Ingo Molnar, Andy Lutomirski, Brian Gerst,
H. Peter Anvin, Linus Torvalds, Peter Zijlstra, x86, linux-kernel
The following commit has been merged into the x86/asm branch of tip:
Commit-ID: c8b584fe82d0f1e478a598f954943b095a4a8f5c
Gitweb: https://git.kernel.org/tip/c8b584fe82d0f1e478a598f954943b095a4a8f5c
Author: Uros Bizjak <ubizjak@gmail.com>
AuthorDate: Mon, 03 Mar 2025 16:54:25 +01:00
Committer: Ingo Molnar <mingo@kernel.org>
CommitterDate: Tue, 04 Mar 2025 20:28:58 +01:00
x86/irq/32: Change some static functions to bool
The return values of these functions is 0/1, but they use an int
type instead of bool:
check_stack_overflow()
execute_on_irq_stack()
Change the type of these function to bool and adjust their return
values and affected helper variables.
[ mingo: Rewrote the changelog ]
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-5-ubizjak@gmail.com
---
arch/x86/kernel/irq_32.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index 8c7babb..d301208 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -29,7 +29,7 @@
int sysctl_panic_on_stackoverflow __read_mostly;
/* Debugging check for stack overflow: is there less than 1KB free? */
-static int check_stack_overflow(void)
+static bool check_stack_overflow(void)
{
unsigned long sp = current_stack_pointer & (THREAD_SIZE - 1);
@@ -45,7 +45,7 @@ static void print_stack_overflow(void)
}
#else
-static inline int check_stack_overflow(void) { return 0; }
+static inline bool check_stack_overflow(void) { return false; }
static inline void print_stack_overflow(void) { }
#endif
@@ -64,7 +64,7 @@ static inline void *current_stack(void)
return (void *)(current_stack_pointer & ~(THREAD_SIZE - 1));
}
-static inline int execute_on_irq_stack(int overflow, struct irq_desc *desc)
+static inline bool execute_on_irq_stack(bool overflow, struct irq_desc *desc)
{
struct irq_stack *curstk, *irqstk;
u32 *isp, *prev_esp;
@@ -79,7 +79,7 @@ static inline int execute_on_irq_stack(int overflow, struct irq_desc *desc)
* current stack (which is the irq stack already after all)
*/
if (unlikely(curstk == irqstk))
- return 0;
+ return false;
isp = (u32 *) ((char *)irqstk + sizeof(*irqstk));
@@ -96,7 +96,7 @@ static inline int execute_on_irq_stack(int overflow, struct irq_desc *desc)
: "+a" (desc), [sp] "+b" (isp)
: [thunk_target] "D" (desc->handle_irq)
: "memory", "cc", "edx", "ecx");
- return 1;
+ return true;
}
/*
@@ -145,7 +145,7 @@ void do_softirq_own_stack(void)
void __handle_irq(struct irq_desc *desc, struct pt_regs *regs)
{
- int overflow = check_stack_overflow();
+ bool overflow = check_stack_overflow();
if (user_mode(regs) || !execute_on_irq_stack(overflow, desc)) {
if (unlikely(overflow))
^ permalink raw reply related [flat|nested] 22+ messages in thread
end of thread, other threads:[~2025-03-04 19:33 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-03 15:54 [PATCH -tip 1/5] x86/irq/32: Use named operands in inline asm Uros Bizjak
2025-03-03 15:54 ` [PATCH -tip 2/5] x86/irq/32: Add missing clobber to " Uros Bizjak
2025-03-04 10:06 ` [tip: x86/asm] " tip-bot2 for Uros Bizjak
2025-03-04 10:36 ` tip-bot2 for Uros Bizjak
2025-03-04 19:23 ` tip-bot2 for Uros Bizjak
2025-03-03 15:54 ` [PATCH -tip 3/5] x86/irq/32: Add ASM_CALL_CONSTRAINT to inline asm using CALL_NOSPEC Uros Bizjak
2025-03-04 10:06 ` [tip: x86/asm] " tip-bot2 for Uros Bizjak
2025-03-04 10:36 ` tip-bot2 for Uros Bizjak
2025-03-04 19:23 ` tip-bot2 for Uros Bizjak
2025-03-03 15:54 ` [PATCH -tip 4/5] x86/irq/32: Use current_stack_pointer to avoid asm() in check_stack_overflow() Uros Bizjak
2025-03-04 10:06 ` [tip: x86/asm] " tip-bot2 for Uros Bizjak
2025-03-04 10:36 ` tip-bot2 for Uros Bizjak
2025-03-04 19:23 ` tip-bot2 for Uros Bizjak
2025-03-04 19:33 ` tip-bot2 for Uros Bizjak
2025-03-03 15:54 ` [PATCH -tip 5/5] x86/irq/32: Change some static functions to bool Uros Bizjak
2025-03-04 10:06 ` [tip: x86/asm] " tip-bot2 for Uros Bizjak
2025-03-04 10:36 ` tip-bot2 for Uros Bizjak
2025-03-04 19:23 ` tip-bot2 for Uros Bizjak
2025-03-04 19:33 ` tip-bot2 for Uros Bizjak
2025-03-04 10:06 ` [tip: x86/asm] x86/irq/32: Use named operands in inline asm tip-bot2 for Uros Bizjak
2025-03-04 10:36 ` tip-bot2 for Uros Bizjak
2025-03-04 19:23 ` tip-bot2 for Uros Bizjak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox