@@ -42,19 +42,7 @@ ret_fast_syscall:
/* do_rseq_syscall needs interrupts enabled. */
mov r0, sp @ 'regs'
bl syscall_exit_to_user_mode
- ldr r1, [tsk, #TI_FLAGS] @ re-check for syscall tracing
- movs r1, r1, lsl #16
- beq 2f
-
- tst r1, #_TIF_SYSCALL_WORK
- beq 1f
-
- b 2f
-
-1: mov r0, sp @ 'regs'
- bl do_work_pending
-
-2: asm_irqentry_exit_to_user_mode
+ asm_irqentry_exit_to_user_mode
#ifdef CONFIG_GCC_PLUGIN_STACKLEAK
bl stackleak_erase_on_task_stack
@@ -1,10 +1,16 @@
// SPDX-License-Identifier: GPL-2.0
#include <asm/entry.h>
+#include <asm/ptrace.h>
#include <asm/signal.h>
#include <linux/context_tracking.h>
#include <linux/irqflags.h>
#include <linux/rseq.h>
+static inline bool has_syscall_work(unsigned long flags)
+{
+ return unlikely(flags & _TIF_SYSCALL_WORK);
+}
+
long syscall_enter_from_user_mode(struct pt_regs *regs, long syscall)
{
trace_hardirqs_on();
@@ -18,8 +24,12 @@ long syscall_enter_from_user_mode(struct pt_regs *regs, long syscall)
void syscall_exit_to_user_mode(struct pt_regs *regs)
{
+ unsigned long flags = read_thread_flags();
+
rseq_syscall(regs);
local_irq_disable();
+ if (has_syscall_work(flags))
+ do_work_pending(regs, flags);
}
noinstr void irqentry_enter_from_user_mode(struct pt_regs *regs)
At the end of a syscall software interrupt and every time we exit an interrupt handler we check if there is work to do, i.e. if the current thread (userspace or kernel daemon) has set the _TIF_SYSCALL_WORK flag. Move this processing over to the C entry code. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- arch/arm/kernel/entry-common.S | 14 +------------- arch/arm/kernel/entry.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 13 deletions(-)