Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2043370imm; Mon, 28 May 2018 00:01:07 -0700 (PDT) X-Google-Smtp-Source: AB8JxZovx/LCKgAKKEBMnTE0e/LyLkFMZQtM8V29qkySFcSA8hBtZd1R4m/QFvZOKM8ZCQ6fHydC X-Received: by 2002:a63:7c43:: with SMTP id l3-v6mr9803397pgn.0.1527490867355; Mon, 28 May 2018 00:01:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527490867; cv=none; d=google.com; s=arc-20160816; b=0f//leQd07Fm16Ro8jthaBRACPKFUBMxyNyDsgi2gq5YGDyI8Tnyl+76RUFJqxPmcX vWd5iooZrtOgdiOuviaN4QBXVz1wMCaeJBpETOedvnn+Kb+m3FdjEhfN6fh8ziYx/HxB J/Da+h4rctHyw0NZNCKCJrAk65hnMgT5qnjqL/syotw0QXXM3Nk47F9J8Ki8vUflLCLX e7L98QR2Hy5X0mbnzPGRWio7KKDDdeDfHL2g0kPqyJaT4dVo/QCI43JaV4/AHAjvDJKE EM9okZRDKkjw70rjVEJ31vfi39njbuy12B4xqR+gVXPTFi+rHTQ40k9ZAUW3zSWJ4Yea 0y4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:thread-index:thread-topic :content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:dkim-signature:dkim-filter :arc-authentication-results; bh=m4Tlrz0WyXppV7XxVT7XP6gjR9NCWbmlYqdV7FzPvYE=; b=SBBJINw9EBgcMv8JdakZ/8Z7qFuyu1EmDga4FfHb5mOT0V+Yl0zjTEA7PoRCOjL9i7 C5buxjXSFoBz7/WxBMrU9aRuWVrGdExhsttVwNGKjCX4ECeIamdZFFucjPlt3F5ETAKx KiVQnr8ZwWu7m8YRRyWUZunKyUQUCOHVG9J4HWPS328ZaAOYNhDvi28Yh2mi3Eqz+Hye 8TYsp7k4WihoAPA3vgDJQuhF7JSLORrYN0BJN8gn0b5U5367glAsb7H+alkgLq8mDBTg CgL7vmdk6OxZVdKHTuvbhUbL3beu126pRqhSLSJ0Z5/Qk0u6SR87A+grgIf/atSm+xrZ NEHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b=hQM05FBX; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h134-v6si30779116pfe.52.2018.05.28.00.00.52; Mon, 28 May 2018 00:01:07 -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; dkim=pass header.i=@efficios.com header.s=default header.b=hQM05FBX; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753641AbeE1HAZ (ORCPT + 99 others); Mon, 28 May 2018 03:00:25 -0400 Received: from mail.efficios.com ([167.114.142.138]:36206 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753621AbeE1HAV (ORCPT ); Mon, 28 May 2018 03:00:21 -0400 Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id A3A541B93D3; Mon, 28 May 2018 03:00:20 -0400 (EDT) Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id ykf7yPJWv0_V; Mon, 28 May 2018 03:00:19 -0400 (EDT) Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id B25A91B93CC; Mon, 28 May 2018 03:00:19 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com B25A91B93CC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1527490819; bh=m4Tlrz0WyXppV7XxVT7XP6gjR9NCWbmlYqdV7FzPvYE=; h=Date:From:To:Message-ID:MIME-Version; b=hQM05FBXRyH8tTKpoNXcSg4oDEI/ZRRQScpTsbbmRj3W64jvBso2r/xGAlDAHb3pm 1KWcPzXNlGulY5gqto4pLMESTGg7VsBGWyR24hkahvtTELN/6qoSyDsyLVsjR0wwz6 f62sCOgkqXFPdMTEcYeOE36V2uDzK9XJYXwJzaOrcuMmDvWIbf/qbZ9Nterk9TfxW0 GWn72q17ko66+irR5mUFM2j2PE+xpVedpkYESawp0dTmo24OvD6L52oiQ0BijcScxT hz0eatVUsdFTLovSQ4UaA42PIaCe7E70+hCVePbTC9aJHS0RzICC0TrznqxehaO2JT 6egG5gBK6HSLw== X-Virus-Scanned: amavisd-new at efficios.com Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10026) with ESMTP id EnRz48JOBRI5; Mon, 28 May 2018 03:00:19 -0400 (EDT) Received: from mail02.efficios.com (mail02.efficios.com [167.114.142.138]) by mail.efficios.com (Postfix) with ESMTP id 8EBD11B93C4; Mon, 28 May 2018 03:00:19 -0400 (EDT) Date: Mon, 28 May 2018 03:00:19 -0400 (EDT) From: Mathieu Desnoyers To: Michael Ellerman , Boqun Feng Cc: Will Deacon , Peter Zijlstra , "Paul E. McKenney" , Andy Lutomirski , Dave Watson , linux-kernel , linux-api , Paul Turner , Andrew Morton , Russell King , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Andrew Hunter , Andi Kleen , Chris Lameter , Ben Maurer , rostedt , Josh Triplett , Linus Torvalds , Catalin Marinas , Michael Kerrisk , Joel Fernandes , Benjamin Herrenschmidt , Paul Mackerras , linuxppc-dev Message-ID: <284936908.600.1527490819532.JavaMail.zimbra@efficios.com> In-Reply-To: <87o9h5sw4e.fsf@concordia.ellerman.id.au> References: <20180430224433.17407-1-mathieu.desnoyers@efficios.com> <277374719.2144.1526570889798.JavaMail.zimbra@efficios.com> <1526601043.1338308.1376191416.0444B8C5@webmail.messagingengine.com> <418003803.516.1526667437396.JavaMail.zimbra@efficios.com> <20180520140811.GB1121@tardis> <1928158599.1541.1527106479862.JavaMail.zimbra@efficios.com> <37442352.1577.1527110985175.JavaMail.zimbra@efficios.com> <87o9h5sw4e.fsf@concordia.ellerman.id.au> Subject: Re: [PATCH 07/14] powerpc: Add support for restartable sequences MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [167.114.142.138] X-Mailer: Zimbra 8.8.8_GA_2096 (ZimbraWebClient - FF52 (Linux)/8.8.8_GA_1703) Thread-Topic: powerpc: Add support for restartable sequences Thread-Index: sN5gCvwrhK5fBvL+6QpV0cuqJC72SQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- On May 24, 2018, at 3:03 AM, Michael Ellerman mpe@ellerman.id.au wrote: > Mathieu Desnoyers writes: >> ----- On May 23, 2018, at 4:14 PM, Mathieu Desnoyers >> mathieu.desnoyers@efficios.com wrote: > ... >>> >>> Hi Boqun, >>> >>> I tried your patch in a ppc64 le environment, and it does not survive boot >>> with CONFIG_DEBUG_RSEQ=y. init gets killed right away. > > > Sorry this code is super gross and hard to deal with. > >> The following fixup gets ppc64 to work: >> >> --- a/arch/powerpc/kernel/entry_64.S >> +++ b/arch/powerpc/kernel/entry_64.S >> @@ -208,6 +208,7 @@ system_call_exit: >> /* Check whether the syscall is issued inside a restartable sequence */ >> addi r3,r1,STACK_FRAME_OVERHEAD >> bl rseq_syscall >> + ld r3,RESULT(r1) >> #endif >> /* >> * Disable interrupts so current_thread_info()->flags can't change, > > I don't think that's safe. > > If you look above that, we have r3, r8 and r12 all live: > > .Lsyscall_exit: > std r3,RESULT(r1) > CURRENT_THREAD_INFO(r12, r1) > > ld r8,_MSR(r1) > #ifdef CONFIG_PPC_BOOK3S > /* No MSR:RI on BookE */ > andi. r10,r8,MSR_RI > beq- .Lunrecov_restore > #endif > > > They're all volatile across function calls: > > http://openpowerfoundation.org/wp-content/uploads/resources/leabi/content/dbdoclet.50655240_68174.html > > > The system_call_exit symbol is actually there for kprobes and cosmetic > purposes. The actual syscall return flow starts at .Lsyscall_exit. > > So I think this would work: > > diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S > index db4df061c33a..e19f377a25e0 100644 > --- a/arch/powerpc/kernel/entry_64.S > +++ b/arch/powerpc/kernel/entry_64.S > @@ -184,6 +184,14 @@ system_call: /* label this so stack traces look sane */ > > .Lsyscall_exit: > std r3,RESULT(r1) > + > +#ifdef CONFIG_DEBUG_RSEQ > + /* Check whether the syscall is issued inside a restartable sequence */ > + addi r3,r1,STACK_FRAME_OVERHEAD > + bl rseq_syscall > + ld r3,RESULT(r1) > +#endif > + > CURRENT_THREAD_INFO(r12, r1) > > ld r8,_MSR(r1) > > > I'll try and get this series into my test setup at some point, been a > bit busy lately :) Yes, this was needed. I had this in my tree already, but there is still a kernel OOPS when running the rseq selftests on ppc64 with CONFIG_DEBUG_RSEQ=y. My current dev tree is at: https://github.com/compudj/linux-percpu-dev/tree/rseq/dev-local So considering we are at rc7 now, should I plan to removing the powerpc bits for merge window submission, or is there someone planning to spend time on fixing and testing ppc integration before the merge window opens ? Thanks, Mathieu > > cheers -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com