Received: by 10.192.165.156 with SMTP id m28csp2337500imm; Thu, 12 Apr 2018 12:33:33 -0700 (PDT) X-Google-Smtp-Source: AIpwx49YrN3FiKTsxQxZaskcyEOnP9q4egJ2xNayq4vTMGCv1V42t1s3K8oJxBeuRLD+8EqkPPJw X-Received: by 2002:a17:902:e81:: with SMTP id 1-v6mr2414813plx.158.1523561613479; Thu, 12 Apr 2018 12:33:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523561613; cv=none; d=google.com; s=arc-20160816; b=wrfBGraLla3oIrRfb2zi/oWVY6zuKkNSgOz8i52/adVrb7OgDBVdn5opi/MIGe7V0K UzefyRivVVPywffkfxMzGv4oLfU0rP3pisT5X2Iohmqy8W5x+aWzGorlVx2mcqEodOdf jxJooAG+Dj5w2GAVSly0vwwRvQAsVXd0qgJrnYgyFb9qtW/G7s2Lx1WFWaDqgMKCbfuX 4gCT6iBHCV8rlmxWW9HWB8MSclOmp6DrTBm9vOkU/zG4nr5vQlCwReKOCbKQPiiKvOzY 1FbCkOsW6M6ND7anDSUOM48z8GI1RVg/syxbkIG8SLkb0bq7xIu4ZmG/v0PsN2Up36Cg IIUw== 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=14aPk3e1aVkhIiyXoEXweiD0o/vw9eLdyPRLTFoAqE0=; b=DiJrkcThPyrs+NC+H2Yg5MW2FthfQbhCisCGvPtmHirY71duz4derhrbScZKBWcElB y8CeD3s30OxTzwAb9+0sB3iENWhgDM2g9mWhz/MxsOACt3Bul/5ai/rP28DC0SE0xlHU eKl68D0+Z62IKSjTs63s80iit9wctgfi8/GtHwBfdr2n7z8fVdH1jq9ZwZF+LcI3rfTS bMnQPkkA3ZBvvH6TeJqm3pvRzNLpBE5lC8ceILTNUbYNro7BU65MX42saHitYnal5IZd t3oMqUJWyBY0K5v/sGNEOQi/LrTfbTiHf3boWrLybAvPMSgb7KWpa2/iWBEe8yxRAS6J HljQ== 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 o128si2079476pfg.5.2018.04.12.12.33.18; Thu, 12 Apr 2018 12:33:33 -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 S1754059AbeDLTbs (ORCPT + 99 others); Thu, 12 Apr 2018 15:31:48 -0400 Received: from mail.efficios.com ([167.114.142.138]:45580 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753184AbeDLT2X (ORCPT ); Thu, 12 Apr 2018 15:28:23 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id D6FFC1B06EA; Thu, 12 Apr 2018 15:28:22 -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 bVzCaZFBT4QJ; Thu, 12 Apr 2018 15:28:22 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 21CEE1B06C5; Thu, 12 Apr 2018 15:28:22 -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 5UhgrzkULrZf; Thu, 12 Apr 2018 15:28:22 -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 A51A31B06AE; Thu, 12 Apr 2018 15:28:21 -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.18 07/23] powerpc: Add support for restartable sequences Date: Thu, 12 Apr 2018 15:27:44 -0400 Message-Id: <20180412192800.15708-8-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180412192800.15708-1-mathieu.desnoyers@efficios.com> References: <20180412192800.15708-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. 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