Skip to content

Commit

Permalink
openrisc: Add support for restartable sequences
Browse files Browse the repository at this point in the history
Implement support for restartable sequences on OpenRISC by doing:
 - Select HAVE_RSEQ in Kconfig
 - Call rseq_syscall() on return to userspace when CONFIG_DEBUG_RSEQ
   is enabled.
 - Call rseq_signal_deliver() to fixup the pre-signal stack frame when a
   signal is delivered on top of a restartable sequence critical section

Cc: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Stafford Horne <shorne@gmail.com>
  • Loading branch information
Stafford Horne committed Jan 14, 2025
1 parent 7ce8716 commit ca46ebf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions arch/openrisc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ config OPENRISC
select HAVE_UID16
select HAVE_PAGE_SIZE_8KB
select HAVE_REGS_AND_STACK_ACCESS_API
select HAVE_RSEQ
select GENERIC_ATOMIC64
select GENERIC_CLOCKEVENTS_BROADCAST
select GENERIC_SMP_IDLE_THREAD
Expand Down
4 changes: 4 additions & 0 deletions arch/openrisc/kernel/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,10 @@ _syscall_check_trace_leave:
* interrupts that set NEED_RESCHED or SIGNALPENDING... really true? */

_syscall_check_work:
#ifdef CONFIG_DEBUG_RSEQ
l.jal rseq_syscall
l.ori r3,r1,0
#endif
/* Here we need to disable interrupts */
DISABLE_INTERRUPTS(r27,r29)
TRACE_IRQS_OFF
Expand Down
2 changes: 2 additions & 0 deletions arch/openrisc/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ handle_signal(struct ksignal *ksig, struct pt_regs *regs)
{
int ret;

rseq_signal_deliver(ksig, regs);

ret = setup_rt_frame(ksig, sigmask_to_save(), regs);

signal_setup_done(ret, ksig, test_thread_flag(TIF_SINGLESTEP));
Expand Down

0 comments on commit ca46ebf

Please sign in to comment.