Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp349085ybi; Fri, 24 May 2019 04:56:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqw+qV9vMJWxsN8T2LyhPaIPTpRdLbFNIX7rhHBbLxbLVkGtgBqgT+FMZxkKbpR2JzDRWfof X-Received: by 2002:aa7:8d81:: with SMTP id i1mr85163102pfr.244.1558699004725; Fri, 24 May 2019 04:56:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558699004; cv=none; d=google.com; s=arc-20160816; b=Vufgw941KBkwZTswTp9S2MlU7e775xkhZWx5IShH8a6iGacGLY5x9NdKhMO1XoVssB yITp/I3KBWCBfC+mRq30tkKQt2B5JOS9/QE69ym2QwWgPc0gFiwF+D/UUl9XWRi1BZAA g3F4eS6ibRi+e6+gT2PPc+h+owSFIMf/v/sZaO9893M/QanO7p+w5suGxvQGGRBKPHOi k70LrshP3+53IDaPoDxxncIZSaF5x7KzM7RbauGzXxJ3Ac5y4yXHC8iCW8d8X7jcm4EI 8V6GKkjdUXCFi6w5/mLhhsPvWbRYFRwp/JaYdg699CaSzhKqqgaqFOj5a69SyUxdmpUx SBCw== 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=vVkD+yS+6mY3ND8nY872UeMHSULOVyjDtscm+0lgvtc=; b=DAAc2C/c0elqbE5PYdLj1BeCxhN8vHzoMy4ZTBxBk4hAgm7v3vggDmErmqcWOOuJzL JVq1RzhoahKlh7AN/fKFOg74kDjr22LAgzKpeum46d8enAHK7M+Q1nlu3UTlK9kNKw4Z 9vc0OKvtspCD5np1u2E8HKfXltVtghIsuepxR86PsQgHPfC7C8TIdH8Gu+4R7CkkndX9 SWTEPjcp9/DZ7YWrz1J600kUVPlM/bgjlb/pr+hHMv9+zxC9ugiiWu5DKYo/2cgfmOVT H+79w5iHSNWXMvbROtn8s2h4ak2ZH1OfoW1mtCVZrnWF3IxMDG1zqLfPYoxupb16QKTJ PNFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=Dy0aSOZb; 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 c15si3795307pgl.160.2019.05.24.04.56.29; Fri, 24 May 2019 04:56:44 -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=Dy0aSOZb; 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 S2391394AbfEXLyF (ORCPT + 99 others); Fri, 24 May 2019 07:54:05 -0400 Received: from merlin.infradead.org ([205.233.59.134]:49178 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391378AbfEXLyF (ORCPT ); Fri, 24 May 2019 07:54:05 -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=vVkD+yS+6mY3ND8nY872UeMHSULOVyjDtscm+0lgvtc=; b=Dy0aSOZbCrVtrIo8dC0PzlUHX uFjvE/MFtcTUu5HIH7+jBtdgszhIPRaXs1lCTo3Bk8K784xoTIXK0SpZuzRHKaTidrLbfA9kASK2h YOYRaERfDnMZVsM1gw582GINE4uLOMLbwVub24179V+GnxUelKob/P3Pq4B2pr6szy7k0O56XVa5r 2QecVZ8IzRq4rzgnJd/ywlC51c3JBP53P3kp/2EgJVQmOjCqOjA/p8FL1Mr4g4nLPNMnYz/J6Cm2p gJ323St9pi8uoLuX6aipNMh8SKXqD4ptdPWllpqyo2L18brt0NaDiH/HU2IakAidNo36uECiVaKEC xPtBx64og==; 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 1hU8kU-0008N3-D0; Fri, 24 May 2019 11:52:34 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id AC0A620670583; Fri, 24 May 2019 13:52:31 +0200 (CEST) Date: Fri, 24 May 2019 13:52:31 +0200 From: Peter Zijlstra To: Will Deacon Cc: Mark Rutland , Andrea Parri , linux-kernel@vger.kernel.org, aou@eecs.berkeley.edu, arnd@arndb.de, bp@alien8.de, catalin.marinas@arm.com, davem@davemloft.net, fenghua.yu@intel.com, heiko.carstens@de.ibm.com, herbert@gondor.apana.org.au, ink@jurassic.park.msu.ru, jhogan@kernel.org, linux@armlinux.org.uk, mattst88@gmail.com, mingo@kernel.org, mpe@ellerman.id.au, palmer@sifive.com, paul.burton@mips.com, paulus@samba.org, ralf@linux-mips.org, rth@twiddle.net, stable@vger.kernel.org, tglx@linutronix.de, tony.luck@intel.com, vgupta@synopsys.com, gregkh@linuxfoundation.org, jhansen@vmware.com, vdasa@vmware.com, aditr@vmware.com, Steven Rostedt Subject: Re: [PATCH 00/18] locking/atomic: atomic64 type cleanup Message-ID: <20190524115231.GN2623@hirez.programming.kicks-ass.net> References: <20190522132250.26499-1-mark.rutland@arm.com> <20190523083013.GA4616@andrea> <20190523101926.GA3370@lakrids.cambridge.arm.com> <20190524103731.GN2606@hirez.programming.kicks-ass.net> <20190524111807.GS2650@hirez.programming.kicks-ass.net> <20190524114220.GA4260@fuggles.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190524114220.GA4260@fuggles.cambridge.arm.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, May 24, 2019 at 12:42:20PM +0100, Will Deacon wrote: > > diff --git a/Documentation/atomic_t.txt b/Documentation/atomic_t.txt > > index dca3fb0554db..125c95ddbbc0 100644 > > --- a/Documentation/atomic_t.txt > > +++ b/Documentation/atomic_t.txt > > @@ -83,6 +83,9 @@ The non-RMW ops are (typically) regular LOADs and STOREs and are canonically > > implemented using READ_ONCE(), WRITE_ONCE(), smp_load_acquire() and > > smp_store_release() respectively. > > > > Not sure you need a new paragraph here. > > > +Therefore, if you find yourself only using the Non-RMW operations of atomic_t, > > +you do not in fact need atomic_t at all and are doing it wrong. > > + > > That makes sense to me, although I now find that the sentence below is a bit > confusing because it sounds like it's a caveat relating to only using > Non-RMW ops. > > > The one detail to this is that atomic_set{}() should be observable to the RMW > > ops. That is: > > How about changing this to be: > > "A subtle detail of atomic_set{}() is that it should be observable..." Done, find below. --- Subject: Documentation/atomic_t.txt: Clarify pure non-rmw usage Clarify that pure non-RMW usage of atomic_t is pointless, there is nothing 'magical' about atomic_set() / atomic_read(). This is something that seems to confuse people, because I happen upon it semi-regularly. Acked-by: Will Deacon Reviewed-by: Greg Kroah-Hartman Signed-off-by: Peter Zijlstra (Intel) --- Documentation/atomic_t.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Documentation/atomic_t.txt b/Documentation/atomic_t.txt index dca3fb0554db..89eae7f6b360 100644 --- a/Documentation/atomic_t.txt +++ b/Documentation/atomic_t.txt @@ -81,9 +81,11 @@ SEMANTICS The non-RMW ops are (typically) regular LOADs and STOREs and are canonically implemented using READ_ONCE(), WRITE_ONCE(), smp_load_acquire() and -smp_store_release() respectively. +smp_store_release() respectively. Therefore, if you find yourself only using +the Non-RMW operations of atomic_t, you do not in fact need atomic_t at all +and are doing it wrong. -The one detail to this is that atomic_set{}() should be observable to the RMW +A subtle detail of atomic_set{}() is that it should be observable to the RMW ops. That is: C atomic-set