Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4888746ybi; Tue, 28 May 2019 04:17:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqxsRpk5T6rFcSnK5bPa+O3JIrytwbDfvvg+fUBkgii8RkZI0bJpsG4qEPuJelRcapRPgMph X-Received: by 2002:a63:43c2:: with SMTP id q185mr22407953pga.280.1559042259564; Tue, 28 May 2019 04:17:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559042259; cv=none; d=google.com; s=arc-20160816; b=iRHPrkhHW2vAsA9ehXVc0d41cJOaZmHRH2IK78Ir6MKrfYk+53diOZFtNP8Ad8z3vD WVdgML6fOguM1idugON6zhVFvivcj8En1TNvUN+TQQaGgDPeHqrCh64ooX6n2LMc8AC5 l3mPRldJfppRnnniEgnCCLKl4oDAvg3co2DitEVtC82jEAQCVcQDAgaCaABaosekt62Y LhsPzerf8eFGAeChH6LUiOg7ZGW6VgTSJUsJ5ISyWwMWzICj6fD3VO3y9r7VdnMxYrPO M2W8GDT9qUKgdcyMe/iaPrL/hfN4Vt1rftEfE2eCVjSZkUB/1dHLg0itUiZDrRHoYLv8 M2Ag== 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=m2nsIiu2xmXeWsYUgRHVpMlsXmoMPRxeUORAALMIKSI=; b=F6zO3KkHjywTM8GQr21sbCU8yU1/ltabZbAbXw9/RPiNVw/KOOHt1avw0A6zzcjOaI rDsFTeU+KpInjAYaDwHpLVS3A+XytYPGAgtAhBckcMiktGZ5/neIqDKxCevn8njyr7i3 HwYz833etoOKHYtsjdKpPuE3U6WEgwxa7hYIH+qGS6HB+iwmoGlDAGwkExzU1u6m6p2M Qvk6eXIXuqF5UWoCFbnY+IzuzZgOKhrhaTeDT7Et1dRqHvliGDUUPL1sc0SgG1VIfhFO RKDo+EDxAFkxfJf0HMLN0ak5CMeGg6tu/TxJQal5lGft1bFHLoXR6sWbVPQOjqYhqO0y cGUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=F8AFn2T8; 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 k19si18445320pgg.374.2019.05.28.04.17.21; Tue, 28 May 2019 04:17:39 -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=F8AFn2T8; 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 S1726609AbfE1LQI (ORCPT + 99 others); Tue, 28 May 2019 07:16:08 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:36275 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726345AbfE1LQI (ORCPT ); Tue, 28 May 2019 07:16:08 -0400 Received: by mail-wr1-f68.google.com with SMTP id s17so19774553wru.3 for ; Tue, 28 May 2019 04:16:07 -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=m2nsIiu2xmXeWsYUgRHVpMlsXmoMPRxeUORAALMIKSI=; b=F8AFn2T8q0YuEbe8O1YmusdB4KKX4+W7+bSwB31soLQqW7nM+xmlU7TAZMFkFdHJLB Jy1WVb8qw8KkVqWiofCzb5Ey2TiQlhTVZFu8lRZeL0GtHBtn4yicUcWTdye2K+uayqkC jqFubNh1Hl8MPRKXzBgIS8CoL7co65suY5UoU= 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=m2nsIiu2xmXeWsYUgRHVpMlsXmoMPRxeUORAALMIKSI=; b=NknNhEzlTG5TzQ6aMtQ8BlX0gE4hUZzqkk9vdZQZjuLrYkNlj+kQuvuPyGylFgOGXL q+mGQupt5ACHyHsf0uW6ga/ij7z86u4u+4fBNZd6kdUJGGNgAyiwNkq4NSpJfuEAmEpK qq/2A8h9k5YOnr8ksb6/Z3QWBdvonNKLT8OAweVMfWBQ9ujQI6oz5eZABhZD2CN0WmfR NA9qNDjWGsWbR2/IimhV0c3WHGRKdCIvlyT2d1UhF99TPjQNeAkbBeOLtUUMe7jcy8oe P6sK/kENkd0RoeOeumxh5jziNAiitfLcCsZFEEtdAz41jJTHz4iGGPPc/Tkp+nwmJME2 8x0w== X-Gm-Message-State: APjAAAXKSA4sJ0GcZ2A2mgIpHQjPYFMhUsAJ1OYuN3Z8fvjf7DtlZRwn zInXQph7NFsSsDOGsPg0vaNCxQ== X-Received: by 2002:adf:9bd2:: with SMTP id e18mr27122695wrc.210.1559042166403; Tue, 28 May 2019 04:16:06 -0700 (PDT) Received: from andrea (86.100.broadband17.iol.cz. [109.80.100.86]) by smtp.gmail.com with ESMTPSA id h17sm16048029wrq.79.2019.05.28.04.16.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 04:16:05 -0700 (PDT) Date: Tue, 28 May 2019 13:15:58 +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: <20190528111558.GA9106@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> <20190524224340.GA3792@andrea> <20190528104719.GN2623@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190528104719.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 On Tue, May 28, 2019 at 12:47:19PM +0200, Peter Zijlstra wrote: > On Sat, May 25, 2019 at 12:43:40AM +0200, Andrea Parri wrote: > > > --- > > > 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'. > > I'm thinking you mean that the type system isn't helping us with > READ/WRITE_ONCE() like it does with atomic_t ? Yep. > And while I agree that > there is room for improvement there, that doesn't mean we should start > using atomic*_t all over the place for that. Agreed. But this still doesn't explain that "and are doing it wrong", AFAICT; maybe just remove that part? Andrea > > Part of the problem with READ/WRITE_ONCE() is that it serves a dual > purpose; we've tried to untangle that at some point, but Linus wasn't > having it.