Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp1705331ybh; Sun, 4 Aug 2019 07:52:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqzVQmEAIKtl+LGgy+Hjijq1tQaG62JYPnB9USAdNXt5Rc3t1gKT7pDdFsMr5rL7mHWSBDak X-Received: by 2002:a65:4189:: with SMTP id a9mr37988820pgq.399.1564930338980; Sun, 04 Aug 2019 07:52:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564930338; cv=none; d=google.com; s=arc-20160816; b=YGpD3Ft+7HBnzmQPZolWhBlpyQiz04Gh5IDuKAxFpbjs2v8M3yQzs0AwweKErThPl0 DFir/6B0bHbJh/YUo7JxY8Rror2liIn1RcNiP+K5QRq+xAvee6CeeTc6HTtW1lNmaXNu mRNw7O/lOvMNn0hcSL6/X8+STnpxRIxfMgpBC3HZAxfSypjdZPThznHgVZ2N4w2ehHNw /k0QAIQGNWEHbinNaO2T+X3Id8aiBLb6OPPv+HjHBNaYcKEBZslSJQqObIT6/J+U+GLe QA8Lipf5dRPJASKuFida04VR1m0KMuCzcFibYg8fjTLGcD30lCFXYX743Y0KzFyI3UY7 10pQ== 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=P/zOwjyMDiKc1v+p6ZRShkdB95dG/e//ZfkvMl5MS6k=; b=aRc8a+0mCAMp/0USyIycAlX+yIG+JTGCEWII6M84Y8KSsHfT7igSdMBOsAIz0LSoIm irdyujqA9b3muoVc8vKgR/G1R06bmKrm5W6OhXtwJiXuA40ofncqhJnKlxEpaCQfBXTj 1JSpMP6LNUTRXo8lB2jazmMUVbRfvr+9s5f197Io9Sh45o7U8HX8nwWqzqA4Zd4GhD0N Xz5NxDl3hyzBkJzJBd8I3JLdlsWRAv+LFzr/27FS+6l3Xze/9U2HhqIHbY7r/1zm6HFU zBQXlf4/eocL5aujk4Eeww21jRKTVdFBFOgd1fWbW1d1Q/s7kBS4qmfYZfoQlQ+av3bn B41Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=fQ5dFKej; 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 n9si38494441plk.166.2019.08.04.07.52.03; Sun, 04 Aug 2019 07:52:18 -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=fQ5dFKej; 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 S1726377AbfHDOvG (ORCPT + 99 others); Sun, 4 Aug 2019 10:51:06 -0400 Received: from merlin.infradead.org ([205.233.59.134]:43228 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726181AbfHDOvG (ORCPT ); Sun, 4 Aug 2019 10:51:06 -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=P/zOwjyMDiKc1v+p6ZRShkdB95dG/e//ZfkvMl5MS6k=; b=fQ5dFKej4xq/uXyqVPRhDbpqO JKakj5ZDbulmYdas8afErzvQ14ng2iQhML5AylUqQ5YGMjBL0Lyaf1T4WDcAxVZ3S++TSCSxlZjdI +z4MIsjfZ8S32xhXyoB2AkCMc10JlIdNZhtFO71r7M7ERibwg6DZzsKj57cY0g+/HVzXBfdnOIJau o/LcoktysARDOgRfkCEFTNyy3oDb9+JIuvDa7FT7eAYjCaBCaC6idhPklWk4mV1zwqt3qCDEMOc6w F5sS94w6gmuimthekjWC8hYOWFjD5bJ3V+MVzsTWN4w5QghIf3eqjES0HZb4EbK5Gl1Erp8cJ4Tko ODLQ009Hg==; 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.92 #3 (Red Hat Linux)) id 1huHqW-0007QM-RM; Sun, 04 Aug 2019 14:50:53 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 962A620274D79; Sun, 4 Aug 2019 16:50:51 +0200 (CEST) Date: Sun, 4 Aug 2019 16:50:51 +0200 From: Peter Zijlstra To: "Paul E. McKenney" Cc: rcu@vger.kernel.org, linux-kernel@vger.kernel.org, mingo@kernel.org, jiangshanlai@gmail.com, dipankar@in.ibm.com, akpm@linux-foundation.org, mathieu.desnoyers@efficios.com, josh@joshtriplett.org, tglx@linutronix.de, rostedt@goodmis.org, dhowells@redhat.com, edumazet@google.com, fweisbec@gmail.com, oleg@redhat.com, joel@joelfernandes.org Subject: Re: [PATCH RFC tip/core/rcu 01/14] rcu/nocb: Atomic ->len field in rcu_segcblist structure Message-ID: <20190804145051.GG2349@hirez.programming.kicks-ass.net> References: <20190802151435.GA1081@linux.ibm.com> <20190802151501.13069-1-paulmck@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190802151501.13069-1-paulmck@linux.ibm.com> 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 Fri, Aug 02, 2019 at 08:14:48AM -0700, Paul E. McKenney wrote: > +/* > + * Exchange the numeric length of the specified rcu_segcblist structure > + * with the specified value. This can cause the ->len field to disagree > + * with the actual number of callbacks on the structure. This exchange is > + * fully ordered with respect to the callers accesses both before and after. > + */ > +long rcu_segcblist_xchg_len(struct rcu_segcblist *rsclp, long v) > +{ > +#ifdef CONFIG_RCU_NOCB_CPU > + return atomic_long_xchg(&rsclp->len, v); > +#else > + long ret = rsclp->len; > + > + smp_mb(); /* Up to the caller! */ > + WRITE_ONCE(rsclp->len, v); > + smp_mb(); /* Up to the caller! */ > + return ret; > +#endif > +} That one's weird; for matching semantics the load needs to be between the memory barriers.