Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1025902ybi; Fri, 24 May 2019 15:46:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqxIpQuLnlgZFMb4w1B5CPu2+Z3V8b/E++VtIuOSDNb10iYOg0TS0ab9ZNzRLIrFt/hex5l4 X-Received: by 2002:a17:90a:37ef:: with SMTP id v102mr12857941pjb.12.1558738003434; Fri, 24 May 2019 15:46:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558738003; cv=none; d=google.com; s=arc-20160816; b=BobPr6T9wGIgCpiWEf9l3x0S1T2jekMFL71SB72xhKrRl2/YLocSpZGu5FKCfJhzJS dx43zuCdvXl85otKNtHBHL3kpaznLpyUfGUo5NLPqZlxoAH7EiOAe1hEN9CqUyFHl0c5 UJUvmGfFMVC2qQdvNksP+H0Q04Ap0vQCPelgiIMWcWocEfF3Sc3Lx7+LmE5bmWXanYVj RULCi6k4xZPxggdWy1lljgUec+JrcqOkN1PRJ92okUKzVDqmAhAFToHHLAXfDaXYwnyr 4YdI5fWkoaaUwNhh4dT8+pXYPybPqsl2O05GtbGLc65/WYIABq+jajJFIkEQpn5uURtS +GZA== 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=oa7UbfYVeCwLKLU+I06sWF4eFZmxQELh4i0FDmnh2dw=; b=HWc5GrdvpH5uxWixM56T8KnSIgLB7dAKbIkGbYOAyNpGJXOst80zv6HgTPHAWGkSSG AFjP5wCBaigIldN52UJB1i3HRFTxWBF90IVMbwUYXXw0QH2JyxKhmgcIE9Ie96BMB02O cbKMh5eywjbWGKU2zEMNc57P7LBuamuuEqAGO5TVJOfH7MjTqMjzr3/YXbzF7bP4vxNT vgYzlIWtGd1xgPvFWX08yg1/a1Bx8LCJL2o5Sk47tpkZS5B1Pd37s3lNjkkR30UgY1aj sK0r6toz4+7nDvRyk9id+IuOtJqkp7UR3w0b1IXyBTwaaFuhTVokR35jbQEUX7nXzOct cwEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=WPpYpf7o; 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 n24si4269279pgk.200.2019.05.24.15.46.28; Fri, 24 May 2019 15:46:43 -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=pass header.i=@amarulasolutions.com header.s=google header.b=WPpYpf7o; 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 S2404389AbfEXWnx (ORCPT + 99 others); Fri, 24 May 2019 18:43:53 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:34576 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404303AbfEXWnw (ORCPT ); Fri, 24 May 2019 18:43:52 -0400 Received: by mail-wm1-f67.google.com with SMTP id e19so2867778wme.1 for ; Fri, 24 May 2019 15:43:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=oa7UbfYVeCwLKLU+I06sWF4eFZmxQELh4i0FDmnh2dw=; b=WPpYpf7o4RZ8f8KmX4IvSqkSjZTbwvrocJPBZL/ZT8ZlnguynubKFMS+wyADlMqKyp P2aNVOv1KlOxfWYz88Zu13fr4QESLRJj1ysjXD8IJ81/j1nwMEv46B812QsZyboGLrIB mtLipigrnwRgi4/v3SasJ/Hb0nTEgdf8pCNWk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=oa7UbfYVeCwLKLU+I06sWF4eFZmxQELh4i0FDmnh2dw=; b=ACLuqf9X9VKOaaQt1fyUzdU+D9htpklxT1MU4tRBxxoHb0UinWaGow4Fsd6bJa3rlO 1hFhH1adKTblDiw7HP9mp07El6I1PidHG5Pcivr2WxZjAhOKcbhj70ABXeNE0LtHLIaH jGGFWLkvY9hyyL+9qFubrZZdI0+OBI7PNs+oFoXfUvvvy5KndRJtpNDh27BAzkDIL+Fw 34itFG4UHbvYWnEuzFduWac99JMQn9MkteGCQNpUKj/zUOajF56dfb+k0IfPFyZo7745 62ugLzJ6+8Hmf/3axDvzoRGREhH5+zDafATEIWqxPAuE673SvO1r/NlN9la885pNA3XO /kzg== X-Gm-Message-State: APjAAAV0AlACpvcMJYdWAx/EFtzCQBKp3V7Hxokqpa153yduNQVdPXQi 3Tu3Bx9LrTDxqa9IQrHNBOBUPg== X-Received: by 2002:a1c:9e8e:: with SMTP id h136mr17073896wme.29.1558737830520; Fri, 24 May 2019 15:43:50 -0700 (PDT) Received: from andrea ([89.22.71.151]) by smtp.gmail.com with ESMTPSA id x9sm2574760wmf.27.2019.05.24.15.43.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 May 2019 15:43:49 -0700 (PDT) Date: Sat, 25 May 2019 00:43:40 +0200 From: Andrea Parri To: Peter Zijlstra Cc: Will Deacon , Mark Rutland , 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: <20190524224340.GA3792@andrea> 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> <20190524115231.GN2623@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190524115231.GN2623@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > --- > 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 counterargument (not so theoretic, just look around in the kernel!) is: we all 'forget' to use READ_ONCE() and WRITE_ONCE(), it should be difficult or more difficult to forget to use atomic_read() and atomic_set()... IAC, I wouldn't call any of them 'wrong'. Andrea > > -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