Received: by 10.213.65.68 with SMTP id h4csp321808imn; Wed, 28 Mar 2018 04:23:12 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+QWwCSQ9BBrh2IFDvgKYewSvggMtBDMu6uETd5Ak3lAYsVFzqt9v4GBlrjcwBBnQfiGR7H X-Received: by 2002:a17:902:8492:: with SMTP id c18-v6mr3387493plo.40.1522236192658; Wed, 28 Mar 2018 04:23:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522236192; cv=none; d=google.com; s=arc-20160816; b=s85guvTB4cL5VrYqUODXBuGfzZA2tnJ40l17Ja/pVG4tFUsqCgRdJ19AmGHF/0pOFn Eh3JzfmMSFYiISMn7NvWlroAvjYy/OTugyT/KR9wOXYsx9qbcWYRkeGNnYBj5tX7kAkN Sqd+ADh7shTYBfumnzA4gij0IEINhCHpmmx00Ddvt4E96Vpcnoqr9kT56rtgYLUHOC90 mGMPQVZTp4aflzd4e4Vl5pa1OBvr7R7OGcrvJ8tWZM8dGDUowzB7aEKCm8C4LLaK0N3u 0YuenDBPQbR6hb+jX1MKzwbyqmH853zDZB7CQSkwJ1ihMrQs8NB0f19hGLwHikVEd3z/ c+6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=1ljZ8AKKJUZt4j9TdjL8TE+GHyhIP2fYGBe9/0AFxi0=; b=XuRjCc8/TmtytYXU9OirfCs5aAM1XpU4SH8Jj+Xi8aZgJvXHxGo1Q3ehIkyLui+4u/ WOzzAyG/+vexsdt6sdMsDuNRraJM5FD+Spppya4uDRuBTY1puToNU4qM2RvQx1dgrIZo XBSZhb0Io+SZ3UwjyYGblgUAOcRvrUVYvQKm63oWvxp/md+uqi+/wrV9Dfwm5H+6MVBb /WZ1LZJl/Mq+qEIc4ANJQb9oUueaWTA+QhRXa1IVpa+BfJVvI5p2e9EL/FIfQxxJatij MLZ2TV1c0J4NEpR2ZYHG4gFeyWd+p3ADJDhbk4bet4uHoAvO4+NfSJioAHDEYhKdW+6R v0Lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=MHNIl8W7; 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 d2-v6si3256997pln.115.2018.03.28.04.22.57; Wed, 28 Mar 2018 04:23:12 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=MHNIl8W7; 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 S1752847AbeC1LUW (ORCPT + 99 others); Wed, 28 Mar 2018 07:20:22 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:33394 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750799AbeC1LUV (ORCPT ); Wed, 28 Mar 2018 07:20:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=1ljZ8AKKJUZt4j9TdjL8TE+GHyhIP2fYGBe9/0AFxi0=; b=MHNIl8W7UUprQFhLniVfVTrNd P58+xC8l0CnQqz+jk+AITGZP0m/MOFt/F9dpnnEHHKpRQq33gMHg4rEh6f1EbLUUFlKoVkJbeTHRG LLbhAxfxfVuoC9EmFCICKDQA/gpGOJXNQVGcY8Dqg0L5sIhGBHnmslqDOunNm0TiSHLM0bZ9psPUW a7ZpcUccH5YPdonR2NBHybWoyWGdVnSnQM/93Qaj4biFWK7voF34OMGryid3iG87gkFnMRWuvBxbP cT+NHiv8TPmTDWCs7DpL74JZeO7NyGsmxa8LAeArYGfz5wakY+TQPPxeEnByxhMNsOvFPU0Ll0tvP jiqTKyRdQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1f197S-0000eW-EO; Wed, 28 Mar 2018 11:19:54 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id E5AC1202A4A09; Wed, 28 Mar 2018 13:19:52 +0200 (CEST) Date: Wed, 28 Mar 2018 13:19:52 +0200 From: Peter Zijlstra To: Mathieu Desnoyers Cc: "Paul E . McKenney" , Boqun Feng , Andy Lutomirski , Dave Watson , 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 , Alexander Viro Subject: Re: [RFC PATCH for 4.17 02/21] rseq: Introduce restartable sequences system call (v12) Message-ID: <20180328111952.GS4043@hirez.programming.kicks-ass.net> References: <20180327160542.28457-1-mathieu.desnoyers@efficios.com> <20180327160542.28457-3-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180327160542.28457-3-mathieu.desnoyers@efficios.com> User-Agent: Mutt/1.9.3 (2018-01-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 27, 2018 at 12:05:23PM -0400, Mathieu Desnoyers wrote: > +#ifdef CONFIG_RSEQ > + struct rseq __user *rseq; > + u32 rseq_len; > + u32 rseq_sig; > + /* > + * RmW on rseq_event_mask must be performed atomically > + * with respect to preemption. > + */ > + unsigned long rseq_event_mask; > +#endif > +static inline void rseq_signal_deliver(struct pt_regs *regs) > +{ > + set_bit(RSEQ_EVENT_SIGNAL_BIT, ¤t->rseq_event_mask); > + rseq_handle_notify_resume(regs); > +} > + > +static inline void rseq_preempt(struct task_struct *t) > +{ > + set_bit(RSEQ_EVENT_PREEMPT_BIT, &t->rseq_event_mask); > + rseq_set_notify_resume(t); > +} > + > +static inline void rseq_migrate(struct task_struct *t) > +{ > + set_bit(RSEQ_EVENT_MIGRATE_BIT, &t->rseq_event_mask); > + rseq_set_notify_resume(t); > +} Given that comment above, do you really need the full atomic set bit? Isn't __set_bit() sufficient?