Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3944125ybi; Mon, 3 Jun 2019 03:05:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqyBQ0ig6Hidfc3g6hT7KLgGmrzr3gAMqX8KT9sZXjmaxWaxShVWfl4JwolawalNkeJ8SN9K X-Received: by 2002:a63:4e07:: with SMTP id c7mr16656711pgb.350.1559556321471; Mon, 03 Jun 2019 03:05:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559556321; cv=none; d=google.com; s=arc-20160816; b=G2BgB9iaYK1KL/Sj3YuCHYLVv7L6uCmcoPZ5+wxHY2Vv4h+bLULFLccVFyiVRDD4fZ 4WFp/sV+5Z3/HhFemjzi3OgVM2Ck6Kv2BqJAuHLuqJgz2r91y8Io9f1AZmqxV3lO9Qxw vcwkjrwakJo2wXTuFjXM8fMhE77SRz842cJDY9vxpQl6UpEvuxEPyU2D9ANYczmbUs5q 2yV+vw+gTr3APmvXetbgm51PfKrw/NoJ8gxPC3qlkQGODujyipwLjTRZ07BGRFkZwT+j KlZuBD8ep/KtXr0dwYs19oDDxD+YGIQ/CW2SP1URMq6YTGlogx1Z4v3oL7XuSRuWIn/T S0PQ== 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; bh=YGw/VDsnOloIaXgrEbA/FOCyBbJYxl2QNc1vAYVXNY0=; b=yfjHObOOAQ1tdjLQ2ls0hKpZ8TfeKPp3jGcaeQOlsoqIOZHBK1Y33PbC4JGzywgsfz 4GcNciskpTrRmSjEMDwiU0exN93QV6N53e0DiMg85c5h5qCrIHjI0PUzLTmuO+y3ogti NK8aX1E/lQf64snyD6tbtrvetcbY+ib9wtJFmAZnlTLeMwOwDuzB1pueovUK9FQk0Js5 IRTtqzytiNnhpq9jDZnpfaBUo9hQqVsOUlA88nTjX1nPfW2PJnpMbjG1tR8xCq5WaFSW H2jKQoHf8klIEBI5O1HCt6a1DHdrhTIcpLiyvaf8VoK9o5a4ePtGNosU14+NvVsZhvoh DH+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b="Kh81Fh/G"; 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 d10si19007517pla.406.2019.06.03.03.05.02; Mon, 03 Jun 2019 03:05:21 -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=merlin.20170209 header.b="Kh81Fh/G"; 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 S1727597AbfFCIDh (ORCPT + 99 others); Mon, 3 Jun 2019 04:03:37 -0400 Received: from merlin.infradead.org ([205.233.59.134]:50138 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725856AbfFCIDg (ORCPT ); Mon, 3 Jun 2019 04:03:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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=YGw/VDsnOloIaXgrEbA/FOCyBbJYxl2QNc1vAYVXNY0=; b=Kh81Fh/GkYy+PcGkyTuRLYqJr 5d3meB8Iu/apofeU9LBaVTbdU34exlCBZ6/cvkSTsWYbCITa+85dcFdl1TuwCCRcbBbbBHcmz79tU YNA75f//Beu0qWv4xrOjE3yCBU/h7Wpdldb8AXCdnFyE/xt6GG7X5SHHOhvkwxY2EDPpuVJ40I8NT ZcmLp7vu3BxxYFbsJSX2sSX4rHSTxLEQ0MZogDpDfR8tMLBVyzA2HGhhcxPa3RuWryoN7hsbltCid ApVADLC1Be6a9Xztz6ysLp/Pg3F0N3np5vQaItnOalc4ycKqr7JKLLA3Zs069bXnA/w4o4wPQqclC BYeGsVrnQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hXhuM-0001Ln-LU; Mon, 03 Jun 2019 08:01:31 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 0FE772029F880; Mon, 3 Jun 2019 10:01:28 +0200 (CEST) Date: Mon, 3 Jun 2019 10:01:28 +0200 From: Peter Zijlstra To: "Joel Fernandes (Google)" Cc: linux-kernel@vger.kernel.org, Alexey Kuznetsov , Bjorn Helgaas , Borislav Petkov , "David S. Miller" , edumazet@google.com, Greg Kroah-Hartman , Hideaki YOSHIFUJI , "H. Peter Anvin" , Ingo Molnar , Josh Triplett , keescook@chromium.org, kernel-hardening@lists.openwall.com, Lai Jiangshan , Len Brown , linux-acpi@vger.kernel.org, linux-pci@vger.kernel.org, linux-pm@vger.kernel.org, Mathieu Desnoyers , neilb@suse.com, netdev@vger.kernel.org, oleg@redhat.com, "Paul E. McKenney" , Pavel Machek , "Rafael J. Wysocki" , rcu@vger.kernel.org, Steven Rostedt , Tejun Heo , Thomas Gleixner , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" Subject: Re: [RFC 1/6] rcu: Add support for consolidated-RCU reader checking Message-ID: <20190603080128.GA3436@hirez.programming.kicks-ass.net> References: <20190601222738.6856-1-joel@joelfernandes.org> <20190601222738.6856-2-joel@joelfernandes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190601222738.6856-2-joel@joelfernandes.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jun 01, 2019 at 06:27:33PM -0400, Joel Fernandes (Google) wrote: > +#define list_for_each_entry_rcu(pos, head, member, cond...) \ > + if (COUNT_VARGS(cond) != 0) { \ > + __list_check_rcu_cond(0, ## cond); \ > + } else { \ > + __list_check_rcu(); \ > + } \ > + for (pos = list_entry_rcu((head)->next, typeof(*pos), member); \ > + &pos->member != (head); \ > pos = list_entry_rcu(pos->member.next, typeof(*pos), member)) > > /** > @@ -621,7 +648,12 @@ static inline void hlist_add_behind_rcu(struct hlist_node *n, > * the _rcu list-mutation primitives such as hlist_add_head_rcu() > * as long as the traversal is guarded by rcu_read_lock(). > */ > +#define hlist_for_each_entry_rcu(pos, head, member, cond...) \ > + if (COUNT_VARGS(cond) != 0) { \ > + __list_check_rcu_cond(0, ## cond); \ > + } else { \ > + __list_check_rcu(); \ > + } \ > for (pos = hlist_entry_safe (rcu_dereference_raw(hlist_first_rcu(head)),\ > typeof(*(pos)), member); \ > pos; \ This breaks code like: if (...) list_for_each_entry_rcu(...); as they are no longer a single statement. You'll have to frob it into the initializer part of the for statement.