Received: by 10.213.65.68 with SMTP id h4csp564841imn; Wed, 28 Mar 2018 08:39:53 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+BYIU1h8gDTVU2+eItNwzRPwEKf6MkHf59W2kjh8iOGqEoLLosd1lcZ9Ps1JXnRCTIpl+R X-Received: by 10.98.194.133 with SMTP id w5mr3422368pfk.6.1522251593716; Wed, 28 Mar 2018 08:39:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522251593; cv=none; d=google.com; s=arc-20160816; b=zeMuuTKEEQQ1/MchOVshiVrRIA52IoNmTbOEWWe2JNqtQya3ozeA9KZQIO3wnvsxXX W5dN+llJXA36j18ul5Lg94rf/DV0iNM5/jyjeLIIrT5/+FrjsW3sEq0U7lwDH9uJP4PI uPZoFAfr1qsnxpUS38rxJcnt4/hcxCPiAMvtLK0rkyla6QGimiVFpbst4w2r/jZWyYb6 J9MIaqlJQb7xNtOXHr3Oz9nTOGCu245txOW+QB3r8n+830hV9fF7sLal0p8ddcQQIIC2 4m0wdmGDzY4LVtB939SHmXOoyVp0sKQ+9EVYeprk/22BHjxoHKrf7vi5sPUUW4wjsEo6 PDqg== 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:arc-authentication-results; bh=QZVqqZY7aK6wuEnSzFhUvxmR+2ZnK570crzomY8XUrM=; b=Z1scXUr+/4CFBYoDUL95OHG957fBq+BXe8F/3CyftymD/xTjCGsLgSvPFQ48cAndR/ 0iUZPEWZB8a2f3I7D7IQ69lUvCK8VTv7nnxkTOmFLkP3ZqO4r+bUTxGYBOIidvgcV//p TJ8kFBTgsYNyLd8jRNY67QhaGKrNIZhGDb5sbn0I1KNJhxnT/CXouh9tHM/FFpaAGHc6 6/qD6cLUV7DCkGt4T3kvi9yZiEfQKxNVU53I1LRivh7bwEI1MFp8az5GtOilvjSB5bL7 1qgHfbHFqHcELje4QmwlTavyn7Y3Ea5Vtlt0icUhJNE/zzOC0l0p1vYGazop11IDoiPO 7rNA== 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 k14si2593868pgt.32.2018.03.28.08.39.38; Wed, 28 Mar 2018 08:39: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 S1753958AbeC1PhK (ORCPT + 99 others); Wed, 28 Mar 2018 11:37:10 -0400 Received: from mail.efficios.com ([167.114.142.138]:56236 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753408AbeC1PhI (ORCPT ); Wed, 28 Mar 2018 11:37:08 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id DEA8F1A6806; Wed, 28 Mar 2018 11:37:07 -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 bSTjqQEvFJdS; Wed, 28 Mar 2018 11:37:07 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 1A4ED1A67FD; Wed, 28 Mar 2018 11:37:07 -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 rhuR8Qmqwgmh; Wed, 28 Mar 2018 11:37:07 -0400 (EDT) Received: from mail02.efficios.com (mail02.efficios.com [167.114.142.138]) by mail.efficios.com (Postfix) with ESMTP id 019B11A67F7; Wed, 28 Mar 2018 11:37:07 -0400 (EDT) Date: Wed, 28 Mar 2018 11:37:06 -0400 (EDT) From: Mathieu Desnoyers To: Peter Zijlstra Cc: "Paul E. McKenney" , Boqun Feng , 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 , Will Deacon , Michael Kerrisk , Alexander Viro Message-ID: <533214853.56.1522251426819.JavaMail.zimbra@efficios.com> In-Reply-To: <20180328152814.GI4082@hirez.programming.kicks-ass.net> References: <20180327160542.28457-1-mathieu.desnoyers@efficios.com> <20180327160542.28457-3-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> Subject: Re: [RFC PATCH for 4.17 02/21] rseq: Introduce restartable sequences system call (v12) 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.7_GA_1964 (ZimbraWebClient - FF52 (Linux)/8.8.7_GA_1964) Thread-Topic: rseq: Introduce restartable sequences system call (v12) Thread-Index: AVjWRlNGt9WFz2erjnsjwdrgt4y+qA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- On Mar 28, 2018, at 11:28 AM, Peter Zijlstra peterz@infradead.org wrote: > On Wed, Mar 28, 2018 at 11:14:05AM -0400, Mathieu Desnoyers wrote: > >> > If at all possible I would make it SIGSEGV when issueing SYSCALL()s from >> > within an RSEQ. >> >> What's the goal there ? rseq critical sections can technically do system calls >> if they wish. Why prevent this ? > > This all started as a way to do 'small' _fast_ per-cpu ops, System calls > do NOT fit in that pattern. If you're willing to do a system calls the > cost of atomics is not a problem. I'm not arguing that a typical rseq would do a system call. I'm merely pointing out that if we start putting arbitrary limitations like "SIGSEGV when a fork or system call is encountered on top of rseq", this will cause pain in user-space. > >> How would you handle signal handlers that issue system calls while nested >> on top of a rseq critical section in the userspace thread ? SIGSEGV on >> SYSCALLs will break this case. > > Have the rseq thing aborted prior to delivering the signal ? Not if the RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL flag is set either in the TLS or in the rseq_cs structure. How about we simply add a rseq_migrate() within rseq_fork() (when forking to a new process), which will allow me to move the rseq_migrate from __set_task_cpu() to set_task_cpu() as you request. Is that solution acceptable for you ? Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com