Received: by 10.213.65.68 with SMTP id h4csp862155imn; Wed, 28 Mar 2018 14:26:54 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+skzsUQRuifi+D/Df1b7+35EtC4n7epR4gHzhUTUxTFzZPD9jjRJjGAzZbHKK02uQtjxHK X-Received: by 10.98.150.75 with SMTP id c72mr4228930pfe.62.1522272413967; Wed, 28 Mar 2018 14:26:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522272413; cv=none; d=google.com; s=arc-20160816; b=b+gl7vw7cDfjAq/37W7XqW3ajSuV5XayAsGRJttRGEgLNG3nNzclXHIQA8ycbciYAH xH0hhEOWNPImV++4j0+oTiinqGUDCYz9EWMpuBB1Q17f3PUue1AWNP3OPbC5q+PVDWJV 3sX1ntuj9ejlyH44D8GbUn4G8Bqu4bZiuLPIv2Hc78nhQSQl+py2qtvIRk6jUMdOFhWN vecA8r/tU/HwSS7Y+Ccc1o/ywg+0wC5yVDvM9vDfr3m1ACbe1tHfV9Wy99TDF6ODOt+C vwvDfgIobjHO+5PsC6WLHE71imneLaknuE8zZeXF0pMyeqQJxLGSQnFPaGnlLhW9wTtJ +vyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=SjUSbgz82BRZjVX2b4Z1NtIuPpok5lY/EnFklyfbg7A=; b=wuCzu4ldj6Qr7FeVIfemsiMy5T4rzBbwTfSAYyRHY/dJPzoPwcOuw3rkzEPT8+pJa4 wQ3Vzbnl6jYALHdOC9EJKgDmulYwkfPoJVjJIdzU0am3hJmppzW7USje0agiwLfbzLTU xyCs8VkLc4iukkpa89bMZ4QWMbYkiLSy0cD1r+w3xEvhhFM2NOc3N9uJCpq8wU5VgQIT yV7ovWhBBdIz8eeL7Zh8xj1kyhfz66S2XA3kg8kHZ21krDSqS82+NVyT2EjyvJP0cXD4 Tjsww7BfGm+TXEBdjk3wAduMyq1kT3aiIgq/Gxc1hGbAlEDL7b0b02EoAdsJmTo8chZY vyng== 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 e125si3026517pgc.506.2018.03.28.14.26.39; Wed, 28 Mar 2018 14:26:53 -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 S1753320AbeC1VZp (ORCPT + 99 others); Wed, 28 Mar 2018 17:25:45 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:51978 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752832AbeC1VZn (ORCPT ); Wed, 28 Mar 2018 17:25:43 -0400 Received: from p4fea5f09.dip0.t-ipconnect.de ([79.234.95.9] helo=nanos.glx-home) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1f1IZP-0003ub-4k; Wed, 28 Mar 2018 23:25:23 +0200 Date: Wed, 28 Mar 2018 23:25:22 +0200 (CEST) From: Thomas Gleixner To: Mathieu Desnoyers cc: Peter Zijlstra , "Paul E. McKenney" , Boqun Feng , Andy Lutomirski , Dave Watson , linux-kernel , linux-api , Paul Turner , Andrew Morton , Russell King , Ingo Molnar , "H. Peter Anvin" , Andrew Hunter , Andi Kleen , Chris Lameter , Ben Maurer , rostedt , Josh Triplett , Linus Torvalds , Catalin Marinas , Will Deacon , Michael Kerrisk , Alexander Viro Subject: Re: [RFC PATCH for 4.17 02/21] rseq: Introduce restartable sequences system call (v12) In-Reply-To: <181076499.279.1522268382303.JavaMail.zimbra@efficios.com> Message-ID: References: <20180327160542.28457-1-mathieu.desnoyers@efficios.com> <20180328125004.GV4043@hirez.programming.kicks-ass.net> <1523662633.2105.1522248474778.JavaMail.zimbra@efficios.com> <20180328145946.GH4082@hirez.programming.kicks-ass.net> <265889560.1.1522250045589.JavaMail.zimbra@efficios.com> <20180328152814.GI4082@hirez.programming.kicks-ass.net> <533214853.56.1522251426819.JavaMail.zimbra@efficios.com> <20180328174935.GK4082@hirez.programming.kicks-ass.net> <181076499.279.1522268382303.JavaMail.zimbra@efficios.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 28 Mar 2018, Mathieu Desnoyers wrote: > ----- On Mar 28, 2018, at 1:49 PM, Peter Zijlstra peterz@infradead.org wrote: > > I don't think disallowing system calls is arbitrary. And I think that is > > something we really want to enforce, because it's batshit insane to > > allow. > > > > And if we allow now, people _will_ use it and we can't ever take it > > away again. > > Here are some examples of how I would like to use system calls within > rseq critical sections, for testing purposes: > > - Issue poll(NULL, 0, ms_timeout) from a rseq critical section, to introduce > a delay in the critical section and test the effect, It's simple enough to use a delay loop for that. It's testing after all. > - Issue sched_yield() from a rseq critical section, to introduce preemption at > that point, Make it loop on a varible and use secondary threads to force preemption. > - Issue kill() on self, thus testing interruption by signals over rseq c.s., Second thread can do that > - Invoke sched_setaffinity to tweak the cpu affinity mask to force thread > migration within a rseq c.s. Second thread can do that > I currently have only implemented the poll(), sched_yield() and kill() > test-cases outside of the rseq critical sections, instead relying on > assembly loops to introduce delays in rseq c.s.. However, if we disallow > system calls in rseq critical sections, I'll never be able to use those > systems calls to extend the test matrix. All of these tests can be implemented without system calls and there is no justification to allow system calls just because it makes writing test cases simpler. Nice try. > I see other use-cases where having a system call in a rseq critical section > could make sense: if vDSO data shared between kernel and user-space rely > on rseq for synchronization, but a fallback sometimes needs to issue a system > call for part of the operation. What in the VDSO relies on rseqs? Nothing AFAICT. If the VDSO ever goes to use that then it's going to be a kernel/vdso specific variant and we'll figure out how that needs to be handled if at all. But we are not misdesigning now to accomodate artificial scenarios dreamed up for argumentation sake, > Therefore I'd really want to keep allowing system calls within rseq critical > sections, even though we don't expect this to be the typical use-case. Syscalls inside rseq sections make no sense whatsoever, unless you can rollback the message you just sent through the intertubes when the rseq loop failed the taste test. If that works we might reconsider. Thanks, tglx