From patchwork Thu Jun 28 20:53:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 10495209 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D1C33603EE for ; Thu, 28 Jun 2018 20:53:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C46252A5A4 for ; Thu, 28 Jun 2018 20:53:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B84AA2A5ED; Thu, 28 Jun 2018 20:53:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F82C2A5A4 for ; Thu, 28 Jun 2018 20:53:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934400AbeF1UxN (ORCPT ); Thu, 28 Jun 2018 16:53:13 -0400 Received: from mout.gmx.net ([212.227.17.22]:54371 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934321AbeF1UxM (ORCPT ); Thu, 28 Jun 2018 16:53:12 -0400 Received: from ls3530.fritz.box ([92.116.187.81]) by mail.gmx.com (mrgmx101 [212.227.17.168]) with ESMTPSA (Nemesis) id 0LcnRD-1fyOH80Pod-00k6n9; Thu, 28 Jun 2018 22:53:05 +0200 Date: Thu, 28 Jun 2018 22:53:00 +0200 From: Helge Deller To: linux-parisc@vger.kernel.org, James Bottomley , John David Anglin Subject: [PATCH] parisc: Add support for restartable sequences syscall Message-ID: <20180628205300.GA22482@ls3530.fritz.box> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.1 (2017-09-22) X-Provags-ID: V03:K1:9Do1iqxtt6zr0uUlsTBKUOe2D14p16qJvNosKNI0xT3/afTqMYa G67XTbAncTLwnnuwUYYa89gnCYve3qBBszceOpXG2Tr8sLdVY/OwgWkqLAQ/w5PYT97Tq/v kXx+JWGhM+Grfqap/Zq+lz8NkWA2CQPEcOCnHeYFtsPxx0tmpdgYP+rMOm4yLt1bsqCConY Xg6LKP7y/KSN8EMm4rTFg== X-UI-Out-Filterresults: notjunk:1; V01:K0:E9Fd6PKtZLY=:djfULtjn1GXSepfxeZQieA S93GvlVaj/WEBcVGj73VMd9x/DkqPXaUua7TIq1foCxX2qfFPKVx2gTCwdiE6Ko8++CbMW/wj pKJk4ISbG8RRXndZwKuLHLZOAhdIp853BxVaEsbhPITsE7O9SB8CNaE3IoUrkW9InuNGpRw4n zmtMBlL72jdSwAPnN/SVXHva/ePp/vlOenTWZCYI1Rp68OYsl3TKLU9v/aocZU6GAXfVtVmVB HmAnURoEh01AEG++clO+g7JSf67yN0OyD+0koCVNF/T86eJ2qezM8IbS7ESvrUtI8dmVdaxI2 WtyBbDB2Py0WRoez3KKUhdPNv5MJaiZRsgMFIjStPG2bqnQqg5QNG0S+zruX3W4wfdW7PpF5J h6twIXZ9GVGCR1I/O1Y5efXEV07rbC3Mtfxfh42o0/4GG67/FTsXPAo8mo1bD16+wfffJXXUO Dw4gCIZFk6CV39te16x4dDxw/KkZ7jl6Nzh/rRZ0M5xvhWpYHyN/H3c5POSaOUYDwcno7P5Rz 5bcYteBS0gKSoyRtKlZc+dGyRLuOKG97Xa+DJpwKTkwBOQZvBGWjbnf9teWWLlOvsBPp122Ai 4i78csVrs9msYhqW+5D74yMXQWN8xRb0ETWAW1FjxZyPTnVkrgZ4fgNYD2I5pnmW9yCFti00x 5FgLggCudA5ZMBl2dbM1IX39e3FOzKCq93V1mIKQeCoZwANA8qHbvsqSYfrvRl4cevRCS851l Z9yAeSqwLHnLhZuFynBgMaG74UqOrwj3eOEi2xAC8qHBxjVL1q5ZJikSmRw= Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Implement support for restartable sequences on parisc, which requires three 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: Helge Deller --- To unsubscribe from this list: send the line "unsubscribe linux-parisc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig index 17526bebcbd2..6275e4b5c38f 100644 --- a/arch/parisc/Kconfig +++ b/arch/parisc/Kconfig @@ -4,6 +4,7 @@ config PARISC select ARCH_MIGHT_HAVE_PC_PARPORT select HAVE_IDE select HAVE_OPROFILE + select HAVE_RSEQ select HAVE_FUNCTION_TRACER select HAVE_FUNCTION_GRAPH_TRACER select HAVE_SYSCALL_TRACEPOINTS diff --git a/arch/parisc/include/uapi/asm/unistd.h b/arch/parisc/include/uapi/asm/unistd.h index dc77c5a51db7..da54c11164ed 100644 --- a/arch/parisc/include/uapi/asm/unistd.h +++ b/arch/parisc/include/uapi/asm/unistd.h @@ -365,8 +365,9 @@ #define __NR_pwritev2 (__NR_Linux + 348) #define __NR_statx (__NR_Linux + 349) #define __NR_io_pgetevents (__NR_Linux + 350) +#define __NR_rseq (__NR_Linux + 351) -#define __NR_Linux_syscalls (__NR_io_pgetevents + 1) +#define __NR_Linux_syscalls (__NR_rseq + 1) #define __IGNORE_select /* newselect */ diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S index e95207c0565e..939994ab4837 100644 --- a/arch/parisc/kernel/entry.S +++ b/arch/parisc/kernel/entry.S @@ -1806,6 +1806,19 @@ ENTRY_CFI(syscall_exit) */ loadgp +#ifdef CONFIG_DEBUG_RSEQ + /* Check whether the syscall is issued inside a restartable sequence */ + #ifdef CONFIG_64BIT + ldo FRAME_SIZE(%r30), %r30 + BL rseq_syscall, %r2 + ldo -16(%r30),%r29 /* Reference param save area */ + #else + BL rseq_syscall, %r2 + ldo FRAME_SIZE(%r30), %r30 + #endif + ldo -FRAME_SIZE(%r30), %r30 +#endif + syscall_check_resched: /* check for reschedule */ diff --git a/arch/parisc/kernel/signal.c b/arch/parisc/kernel/signal.c index 342073f44d3f..14a25de0e901 100644 --- a/arch/parisc/kernel/signal.c +++ b/arch/parisc/kernel/signal.c @@ -424,6 +424,8 @@ handle_signal(struct ksignal *ksig, struct pt_regs *regs, int in_syscall) DBG(1,"handle_signal: sig=%ld, ka=%p, info=%p, oldset=%p, regs=%p\n", ksig->sig, ksig->ka, ksig->info, oldset, regs); + + rseq_signal_deliver(ksig, regs); /* Set up the stack frame */ ret = setup_rt_frame(ksig, oldset, regs, in_syscall); @@ -611,5 +613,6 @@ void do_notify_resume(struct pt_regs *regs, long in_syscall) if (test_thread_flag(TIF_NOTIFY_RESUME)) { clear_thread_flag(TIF_NOTIFY_RESUME); tracehook_notify_resume(regs); + rseq_handle_notify_resume(NULL, regs); } } diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S index fe3f2a49d2b1..f156b4589118 100644 --- a/arch/parisc/kernel/syscall_table.S +++ b/arch/parisc/kernel/syscall_table.S @@ -446,6 +446,7 @@ ENTRY_COMP(pwritev2) ENTRY_SAME(statx) ENTRY_COMP(io_pgetevents) /* 350 */ + ENTRY_SAME(rseq) .ifne (. - 90b) - (__NR_Linux_syscalls * (91b - 90b))