Received: by 10.213.65.68 with SMTP id h4csp812164imn; Tue, 27 Mar 2018 09:12:21 -0700 (PDT) X-Google-Smtp-Source: AG47ELtmARW0piV5Q27FoaTrcWOlk4W1Ff+S5nHXKbkOW+9cYPU88fzHZfiWAQawX4Y3JOZweLV6 X-Received: by 10.99.176.12 with SMTP id h12mr16621788pgf.448.1522167141540; Tue, 27 Mar 2018 09:12:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522167141; cv=none; d=google.com; s=arc-20160816; b=FojAHnHNPrwBXbztSs8k0k1jsyYjoXQv3P/iImQSz/KiRDP/06JFFKZ2OVQ/r8yZCN wy4pyWKJH3FxdWRhgxdaMUUgXqfvoLk7DulqKegtbhtwXNIe66pz0YYeoZxzPtEPOmhK //a+gkK6/vCkWaOg3n+y7VV/UIH8R+IjvPT0yIiXLPya5RZjuChZ4Lngo+qjBIT0b3ry qMwXDrf4IbOj6H2xV5icLz8xiOeUvVwPFICvKbOJcrneO/9h6i1sBK1nw1vi1pyNmzBE G1Li28hhQvq0e2aDI0fsoJSitRxavGo7EjNbkEnlM5G4/aVRA5W1gLS+9BxOgQzixnsy 0wGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=eV19QoycxRvn/a1BwzE6QSQEN+3v7ZT2V+1NOci4xNk=; b=DoH8syR0o3eut4C/vVhxUqJ0UbFyK8Rj/N8r1+USH95n6l4Y+c/G+ICfZZSSFNkayI FlhSja5DBeaxopjY6DvTGPjEjcX0Y9gGXzfprbTsfOwcmFYBV+X31RY0dQIjqNgXBa9Q 3FZkxY5yoB7tGY1JBs2IvuHGRTTU20eEYQ/+dRRtkZmROJBhuG9pljYZx3Dy+Ox8RE6n kmADU8WvTBXUarJiwCgpr/Mz+bVP7WEyR+25saPxPQd+2SxWscX/Sxy6O3noEn68X3pN R8owa+E62ylS4M5lkXC9uXdX9Mfc1huzjG+Jm7rFzq4zbRbY8tQ/dFxz7gkb7JpBt7H+ 4haQ== 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 bc11-v6si1471185plb.43.2018.03.27.09.12.07; Tue, 27 Mar 2018 09:12:21 -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 S1753000AbeC0QKS (ORCPT + 99 others); Tue, 27 Mar 2018 12:10:18 -0400 Received: from mail.efficios.com ([167.114.142.138]:51522 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752043AbeC0QGU (ORCPT ); Tue, 27 Mar 2018 12:06:20 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id CF9701A50D6; Tue, 27 Mar 2018 12:06:19 -0400 (EDT) Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail02.efficios.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id vGa4C9IxWJoS; Tue, 27 Mar 2018 12:06:19 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id D53E51A5091; Tue, 27 Mar 2018 12:06:18 -0400 (EDT) X-Virus-Scanned: amavisd-new at efficios.com Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail02.efficios.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id HQInDvhxKzf0; Tue, 27 Mar 2018 12:06:18 -0400 (EDT) Received: from thinkos.internal.efficios.com (192-222-157-41.qc.cable.ebox.net [192.222.157.41]) by mail.efficios.com (Postfix) with ESMTPSA id 6AA911A5074; Tue, 27 Mar 2018 12:06:18 -0400 (EDT) From: Mathieu Desnoyers To: Peter Zijlstra , "Paul E . McKenney" , Boqun Feng , Andy Lutomirski , Dave Watson Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Paul Turner , Andrew Morton , Russell King , Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , Andrew Hunter , Andi Kleen , Chris Lameter , Ben Maurer , Steven Rostedt , Josh Triplett , Linus Torvalds , Catalin Marinas , Will Deacon , Michael Kerrisk , Mathieu Desnoyers , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , linuxppc-dev@lists.ozlabs.org Subject: [RFC PATCH for 4.17 07/21] powerpc: Add support for restartable sequences Date: Tue, 27 Mar 2018 12:05:28 -0400 Message-Id: <20180327160542.28457-8-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180327160542.28457-1-mathieu.desnoyers@efficios.com> References: <20180327160542.28457-1-mathieu.desnoyers@efficios.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Boqun Feng Call the rseq_handle_notify_resume() function on return to userspace if TIF_NOTIFY_RESUME thread flag is set. Increment the event counter and perform fixup on the pre-signal when a signal is delivered on top of a restartable sequence critical section. Signed-off-by: Boqun Feng Signed-off-by: Mathieu Desnoyers CC: Benjamin Herrenschmidt CC: Paul Mackerras CC: Michael Ellerman CC: Peter Zijlstra CC: "Paul E. McKenney" CC: linuxppc-dev@lists.ozlabs.org --- arch/powerpc/Kconfig | 1 + arch/powerpc/kernel/signal.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 73ce5dd07642..90700b6918ef 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -223,6 +223,7 @@ config PPC select HAVE_SYSCALL_TRACEPOINTS select HAVE_VIRT_CPU_ACCOUNTING select HAVE_IRQ_TIME_ACCOUNTING + select HAVE_RSEQ select IRQ_DOMAIN select IRQ_FORCED_THREADING select MODULES_USE_ELF_RELA diff --git a/arch/powerpc/kernel/signal.c b/arch/powerpc/kernel/signal.c index 61db86ecd318..d3bb3aaaf5ac 100644 --- a/arch/powerpc/kernel/signal.c +++ b/arch/powerpc/kernel/signal.c @@ -133,6 +133,8 @@ static void do_signal(struct task_struct *tsk) /* Re-enable the breakpoints for the signal stack */ thread_change_pc(tsk, tsk->thread.regs); + rseq_signal_deliver(tsk->thread.regs); + if (is32) { if (ksig.ka.sa.sa_flags & SA_SIGINFO) ret = handle_rt_signal32(&ksig, oldset, tsk); @@ -164,6 +166,7 @@ void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags) 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.11.0