[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250110102248.3295944-3-shorne@gmail.com>
Date: Fri, 10 Jan 2025 10:22:44 +0000
From: Stafford Horne <shorne@...il.com>
To: LKML <linux-kernel@...r.kernel.org>
Cc: Linux OpenRISC <linux-openrisc@...r.kernel.org>,
Stafford Horne <shorne@...il.com>,
Michael Jeanson <mjeanson@...icios.com>,
Jonas Bonn <jonas@...thpole.se>,
Stefan Kristiansson <stefan.kristiansson@...nalahti.fi>,
Masahiro Yamada <masahiroy@...nel.org>,
Rong Xu <xur@...gle.com>
Subject: [PATCH 2/3] openrisc: Add support for restartable sequences
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@...icios.com>
Signed-off-by: Stafford Horne <shorne@...il.com>
---
arch/openrisc/Kconfig | 1 +
arch/openrisc/kernel/entry.S | 4 ++++
arch/openrisc/kernel/signal.c | 2 ++
3 files changed, 7 insertions(+)
diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
index f2be2a88c286..87996dde394c 100644
--- a/arch/openrisc/Kconfig
+++ b/arch/openrisc/Kconfig
@@ -27,6 +27,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
diff --git a/arch/openrisc/kernel/entry.S b/arch/openrisc/kernel/entry.S
index ce6f2b08a35e..c7e90b09645e 100644
--- a/arch/openrisc/kernel/entry.S
+++ b/arch/openrisc/kernel/entry.S
@@ -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
diff --git a/arch/openrisc/kernel/signal.c b/arch/openrisc/kernel/signal.c
index c7ab42e2cb7a..f70a13ee0593 100644
--- a/arch/openrisc/kernel/signal.c
+++ b/arch/openrisc/kernel/signal.c
@@ -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));
--
2.47.0
Powered by blists - more mailing lists