[PATCH RFC 14/28] ARM: entry: Drop trace argument from usr_entry macro

From: Linus Walleij
Date: Thu Oct 10 2024 - 07:36:14 EST


The trace argument select whether to look into tracing of
the hardirqs for the exceptions from userspace, but also
selects whether to call further down to establish context
for RCU.

Split off a second macro that is called on everything
except the FIQ since this is the only outlier.

Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
---
arch/arm/kernel/entry-armv.S | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index d6e8b36c70f5..be2df297ec0a 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -356,7 +356,7 @@ ENDPROC(__fiq_abt)
#error "sizeof(struct pt_regs) must be a multiple of 8"
#endif

- .macro usr_entry, trace=1, uaccess=1
+ .macro usr_entry, uaccess=1
UNWIND(.fnstart )
UNWIND(.cantunwind ) @ don't unwind the user space
sub sp, sp, #PT_REGS_SIZE
@@ -400,13 +400,14 @@ ENDPROC(__fiq_abt)
@ Clear FP to mark the first stack frame
@
zero_fp
+ .endm

- .if \trace
+ /* Called after usr_entry for everything except FIQ */
+ .macro usr_entry_enter
#ifdef CONFIG_TRACE_IRQFLAGS
bl trace_hardirqs_off
#endif
asm_irqentry_enter_from_user_mode save = 0
- .endif
.endm

.macro kuser_cmpxchg_check
@@ -428,6 +429,7 @@ ENDPROC(__fiq_abt)
.align 5
__dabt_usr:
usr_entry uaccess=0
+ usr_entry_enter
kuser_cmpxchg_check
mov r2, sp
dabt_helper
@@ -438,6 +440,7 @@ ENDPROC(__dabt_usr)
.align 5
__irq_usr:
usr_entry
+ usr_entry_enter
kuser_cmpxchg_check
irq_handler from_user=1
get_thread_info tsk
@@ -451,6 +454,7 @@ ENDPROC(__irq_usr)
.align 5
__und_usr:
usr_entry uaccess=0
+ usr_entry_enter

@ IRQs must be enabled before attempting to read the instruction from
@ user space since that could cause a page/translation fault if the
@@ -475,6 +479,7 @@ ENDPROC(__und_usr)
.align 5
__pabt_usr:
usr_entry
+ usr_entry_enter
mov r2, sp @ regs
pabt_helper
UNWIND(.fnend )
@@ -494,7 +499,7 @@ ENDPROC(ret_from_exception)

.align 5
__fiq_usr:
- usr_entry trace=0
+ usr_entry
kuser_cmpxchg_check
mov r0, sp @ struct pt_regs *regs
bl handle_fiq_as_nmi

--
2.46.2