From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBB5AC43381 for ; Sun, 17 Mar 2019 03:07:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 97863218D0 for ; Sun, 17 Mar 2019 03:07:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726684AbfCQDHR (ORCPT ); Sat, 16 Mar 2019 23:07:17 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:55492 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726602AbfCQDHR (ORCPT ); Sat, 16 Mar 2019 23:07:17 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92 #3 (Red Hat Linux)) id 1h5M8F-00039r-GJ; Sun, 17 Mar 2019 03:06:48 +0000 Date: Sun, 17 Mar 2019 03:06:39 +0000 From: Al Viro To: James Bottomley Cc: paulmck@linux.ibm.com, Eric Biggers , "Tobin C. Harding" , linux-fsdevel@vger.kernel.org Subject: Re: dcache locking question Message-ID: <20190317030634.GG2217@ZenIV.linux.org.uk> References: <20190314225632.GB15813@eros.localdomain> <20190314231939.GA17269@eros.localdomain> <20190315015021.GU2217@ZenIV.linux.org.uk> <20190315173819.GB77949@gmail.com> <20190315185455.GA2217@ZenIV.linux.org.uk> <20190316223128.GV4102@linux.ibm.com> <20190317001840.GF2217@ZenIV.linux.org.uk> <20190317005005.GY4102@linux.ibm.com> <1552789220.6551.13.camel@HansenPartnership.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1552789220.6551.13.camel@HansenPartnership.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Sat, Mar 16, 2019 at 07:20:20PM -0700, James Bottomley wrote: > On Sat, 2019-03-16 at 17:50 -0700, Paul E. McKenney wrote: > [...] > > I -have- seen stores of constant values be torn, but not stores of > > runtime-variable values and not loads. Still, such tearing is > > permitted, and including the READ_ONCE() is making it easier for > > things like thread sanitizers. In addition, the READ_ONCE() makes it > > clear that the value being loaded is unstable, which can be > > useful documentation. > > Um, just so I'm clear, because this assumption permeates all our code: > load or store tearing can never occur if we're doing load or store of a > 32 bit value which is naturally aligned. Where naturally aligned is > within the gift of the CPU to determine but which the compiler or > kernel will always ensure for us unless we pack the structure or > deliberately misalign the allocation. Wait a sec; are there any 64bit architectures where the same is not guaranteed for dereferencing properly aligned void **? If that's the case, I can think of quite a few places that are rather dubious, and I don't see how READ_ONCE() could help in those - e.g. if an architecture only has 32bit loads, rcu list traversals are not going to be doable without one hell of an extra headache.