Skip to content

Commit 9ea141a

Browse files
committed
MIPS: Add support for restartable sequences
Implement support for restartable sequences on MIPS, which requires 3 simple things: - Call rseq_handle_notify_resume() on return to userspace if TIF_NOTIFY_RESUME is set. - Call rseq_signal_deliver() to fixup the pre-signal stack frame when a signal is delivered whilst executing a restartable sequence critical section. - Select CONFIG_HAVE_RSEQ. Signed-off-by: Paul Burton <paul.burton@mips.com> Reviewed-by: James Hogan <jhogan@kernel.org> Patchwork: https://patchwork.linux-mips.org/patch/19523/ Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Boqun Feng <boqun.feng@gmail.com> Cc: linux-mips@linux-mips.org Cc: linux-kernel@vger.kernel.org
1 parent 18f3e95 commit 9ea141a

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

‎arch/mips/Kconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ config MIPS
6565
select HAVE_OPROFILE
6666
select HAVE_PERF_EVENTS
6767
select HAVE_REGS_AND_STACK_ACCESS_API
68+
select HAVE_RSEQ
6869
select HAVE_STACKPROTECTOR
6970
select HAVE_SYSCALL_TRACEPOINTS
7071
select HAVE_VIRT_CPU_ACCOUNTING_GEN if 64BIT || !SMP

‎arch/mips/kernel/signal.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,8 @@ static void handle_signal(struct ksignal *ksig, struct pt_regs *regs)
801801
regs->regs[0] = 0; /* Don't deal with this again. */
802802
}
803803

804+
rseq_signal_deliver(regs);
805+
804806
if (sig_uses_siginfo(&ksig->ka, abi))
805807
ret = abi->setup_rt_frame(vdso + abi->vdso->off_rt_sigreturn,
806808
ksig, regs, oldset);
@@ -868,6 +870,7 @@ asmlinkage void do_notify_resume(struct pt_regs *regs, void *unused,
868870
if (thread_info_flags & _TIF_NOTIFY_RESUME) {
869871
clear_thread_flag(TIF_NOTIFY_RESUME);
870872
tracehook_notify_resume(regs);
873+
rseq_handle_notify_resume(regs);
871874
}
872875

873876
user_enter();

0 commit comments

Comments
 (0)