Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp134313imm; Thu, 14 Jun 2018 16:55:46 -0700 (PDT) X-Google-Smtp-Source: ADUXVKInh5xXXLSAtioOFGnFeWMEUqHkwOgsay7csq3n2enJ+BeerXLhnlH+h83qTik9WepNrjdJ X-Received: by 2002:a17:902:2d24:: with SMTP id o33-v6mr5323060plb.14.1529020546821; Thu, 14 Jun 2018 16:55:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529020546; cv=none; d=google.com; s=arc-20160816; b=mpu6Q6dsG2Z1g0aZWnws8iQzKkZLQUmoJb+KdR5yQexKfP72Lr85DVLr9NotI3mA1V JbPB1RXrcD42nILtZUEMAVn1dNQNl877YFQesKBnN8X3WRhtPfjYvw/D293QualsI3Nx 6dAnfIvst8416mCjUxYOG11UPR7jVhWpIqENBgLGM+0ZoEVSXXr3sLr364zn6gw8twXM yldhIFdfOjBucrpn8pa7ZkNhILTpEDEF8KxcQRSheZLQLdGrtEV7SFqmdV0Md1vdW7bP kzI/BGl/KnRfe25Glewm82TPyMl6hDJrVHqQ/e1+hHmS1xqqq5am/q/XDJ0Wx9UMBePX dJqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=u2mCATCCq98DmTKD3Vez9miG2HVbVgSVsOOmYT9IFSM=; b=zwah8BrbtraRdIj1QbXNhL0WUQQfBJ1pGzhesJ9npdB9NaCDIqwSsuQYRWt3nQecMy mT+6ujtiTI3lxXQtTm6O7n9Z/U2zJAD9dFDwve1DYN1tt5KeO4fXD9WyDSGyGxXcSzuq dttH9qgOaItk+ZSkUdrDzVlq9DEB8gT6FxR9nZqTf57Ef4nXDjqDgNByeXOVucujmBQo HS26+zr/6CJ8ekeRrZCs4pAKcRSxg4L1I/5M5rFohsN17FCJlcJja0zKpiMZoEKL+W8I 8E+6pUXMrSBp06h/WGXZOjNIoMoyMDLVWsSeyWoqwmoO8sMLcA/+MITEeDU3kGSd3Yh7 Lriw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d7-v6si6534111pfl.122.2018.06.14.16.55.32; Thu, 14 Jun 2018 16:55:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965211AbeFNXxy (ORCPT + 99 others); Thu, 14 Jun 2018 19:53:54 -0400 Received: from 9pmail.ess.barracuda.com ([64.235.154.211]:53754 "EHLO 9pmail.ess.barracuda.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965144AbeFNXxu (ORCPT ); Thu, 14 Jun 2018 19:53:50 -0400 Received: from mipsdag01.mipstec.com (mail1.mips.com [12.201.5.31]) by mx1403.ess.rzc.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA256 bits=128 verify=NO); Thu, 14 Jun 2018 23:53:28 +0000 Received: from mipsdag02.mipstec.com (10.20.40.47) by mipsdag01.mipstec.com (10.20.40.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1415.2; Thu, 14 Jun 2018 16:53:08 -0700 Received: from pburton-laptop.mipstec.com (10.20.2.29) by mipsdag02.mipstec.com (10.20.40.47) with Microsoft SMTP Server id 15.1.1415.2 via Frontend Transport; Thu, 14 Jun 2018 16:53:07 -0700 From: Paul Burton To: CC: Peter Zijlstra , James Hogan , , Mathieu Desnoyers , Boqun Feng , "Paul E . McKenney" , Ralf Baechle , Paul Burton Subject: [PATCH 1/4] MIPS: Add support for restartable sequences Date: Thu, 14 Jun 2018 16:52:07 -0700 Message-ID: <20180614235211.31357-2-paul.burton@mips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180614235211.31357-1-paul.burton@mips.com> References: <20180614235211.31357-1-paul.burton@mips.com> MIME-Version: 1.0 Content-Type: text/plain X-BESS-ID: 1529020407-321459-9504-17803-1 X-BESS-VER: 2018.7-r1806112253 X-BESS-Apparent-Source-IP: 12.201.5.31 X-BESS-Envelope-From: Paul.Burton@mips.com X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.194071 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS59374 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, BSF_BESS_OUTBOUND X-BESS-Orig-Rcpt: linux-mips@linux-mips.org,peterz@infradead.org,jhogan@kernel.org,linux-kernel@vger.kernel.org,mathieu.desnoyers@efficios.com,boqun.feng@gmail.com,paulmck@linux.vnet.ibm.com,ralf@linux-mips.org X-BESS-BRTS-Status: 1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Cc: James Hogan Cc: Ralf Baechle Cc: Mathieu Desnoyers Cc: Peter Zijlstra Cc: Paul E. McKenney Cc: Boqun Feng Cc: linux-mips@linux-mips.org Cc: linux-kernel@vger.kernel.org --- arch/mips/Kconfig | 1 + arch/mips/kernel/signal.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index fe98e459a416..afe2b0c867ac 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -66,6 +66,7 @@ config MIPS select HAVE_OPROFILE select HAVE_PERF_EVENTS select HAVE_REGS_AND_STACK_ACCESS_API + select HAVE_RSEQ select HAVE_SYSCALL_TRACEPOINTS select HAVE_VIRT_CPU_ACCOUNTING_GEN if 64BIT || !SMP select IRQ_FORCED_THREADING diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c index 9e224469c788..00f2535d2226 100644 --- a/arch/mips/kernel/signal.c +++ b/arch/mips/kernel/signal.c @@ -801,6 +801,8 @@ static void handle_signal(struct ksignal *ksig, struct pt_regs *regs) regs->regs[0] = 0; /* Don't deal with this again. */ } + rseq_signal_deliver(regs); + if (sig_uses_siginfo(&ksig->ka, abi)) ret = abi->setup_rt_frame(vdso + abi->vdso->off_rt_sigreturn, ksig, regs, oldset); @@ -868,6 +870,7 @@ asmlinkage void do_notify_resume(struct pt_regs *regs, void *unused, if (thread_info_flags & _TIF_NOTIFY_RESUME) { clear_thread_flag(TIF_NOTIFY_RESUME); tracehook_notify_resume(regs); + rseq_handle_notify_resume(regs); } user_enter(); -- 2.17.1