[PATCH v19 08/14] arm64: ptrace: Extract arm64_syscall_exit_to_user_mode_work() helper
flat view
COOLING12d
REVIEWED: 31 (31M)
From: Jinjie Ruan <hidden>
Date: 2026-09-22 03:56:35
Also in:
lkml
Subsystem:
arm64 port (aarch64 architecture), the rest · Maintainers:
Catalin Marinas, Will Deacon, Linus Torvalds
1 review trailer.
Introduce a helper arm64_syscall_exit_to_user_mode_work() that encapsulates the re-reading of thread flags and the call to syscall_trace_exit(). Use it in el0_svc_common() to replace the open-coded instances, removing the duplicated flags read and making the control flow simpler. This aligns the arm64 exit path with the pattern expected by the generic entry infrastructure, which uses a similar syscall_exit_to_user_mode_work() callback. No functional changes intended; this is a preparation step for converting arm64 to the generic entry infrastructure. Cc: Mark Rutland <mark.rutland@arm.com> Cc: Will Deacon <will@kernel.org> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Ada Couprie Diaz <redacted> Cc: Linus Walleij <linusw@kernel.org> Cc: Yeoreum Yun <redacted> Cc: Can Peng <redacted> Cc: Li Qiang <redacted> Cc: Ryan Roberts <ryan.roberts@arm.com> Reviewed-by: Linus Walleij <linusw@kernel.org> Signed-off-by: Jinjie Ruan <redacted> --- arch/arm64/include/asm/syscall.h | 7 +++++++ arch/arm64/kernel/syscall.c | 9 +++------ 2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/arch/arm64/include/asm/syscall.h b/arch/arm64/include/asm/syscall.h
index 696739f5a250..3e4672ab4a4f 100644
--- a/arch/arm64/include/asm/syscall.h
+++ b/arch/arm64/include/asm/syscall.h@@ -123,4 +123,11 @@ static inline int syscall_get_arch(struct task_struct *task) int arm64_syscall_trace_enter(struct pt_regs *regs, unsigned long flags); void syscall_trace_exit(struct pt_regs *regs, unsigned long flags); +static __always_inline void arm64_syscall_exit_to_user_mode_work(struct pt_regs *regs) +{ + unsigned long flags = read_thread_flags(); + + syscall_trace_exit(regs, flags); +} + #endif /* __ASM_SYSCALL_H */
diff --git a/arch/arm64/kernel/syscall.c b/arch/arm64/kernel/syscall.c
index e778aac6fab9..0061fc63e7ba 100644
--- a/arch/arm64/kernel/syscall.c
+++ b/arch/arm64/kernel/syscall.c@@ -127,16 +127,13 @@ static void el0_svc_common(struct pt_regs *regs, int scno, int sc_nr, */ if (!has_syscall_work(flags) && !IS_ENABLED(CONFIG_DEBUG_RSEQ)) { flags = read_thread_flags(); - if (has_syscall_work(flags) || flags & _TIF_SINGLESTEP) { - flags = read_thread_flags(); - syscall_trace_exit(regs, flags); - } + if (has_syscall_work(flags) || flags & _TIF_SINGLESTEP) + arm64_syscall_exit_to_user_mode_work(regs); return; } trace_exit: - flags = read_thread_flags(); - syscall_trace_exit(regs, flags); + arm64_syscall_exit_to_user_mode_work(regs); } void do_el0_svc(struct pt_regs *regs)
--
2.34.1