Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp41751ybh; Fri, 17 Jul 2020 17:59:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqb6xy7juRgxsq4YGumlK+aXZ01Kzxndud//koODnYRw2SWCsYwOwhoDGGIB7YHY5Yv4ls X-Received: by 2002:a17:906:2c02:: with SMTP id e2mr10657011ejh.64.1595033967985; Fri, 17 Jul 2020 17:59:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595033967; cv=none; d=google.com; s=arc-20160816; b=InK/sh5VfEn44gu32yN7U07FzM+RjTtqpQl8uI58FUeT8J+QzrDOjIeG+edQ3mQzmf ySD8WzdsI1L87AOb/a6/QeRrBNGUyLw4yhzRvWZoxl1HcajewgZdoMEPVZhEOpT2nS4h R+p9NUX3gwb1YMlx7HoiTJNbHtyoOBgER+VK5wYQToysVaT1LetqQXXUXcOzPoNMwN/L c8kHfnYmE3z9v59I21q7pCo3FFPBMIeUy2ZYZpOqjDsgksooVh/JxXZRvsDw08YXqRAR kAhkDvTGc7LTgLCwBkGO7E+4X7r/7GJhVhU99R7841oOcx05Mh0Zl/FOnxeloHHxZya+ jG2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=YO+0hUtvtxO4uN4wv9WS29cqDtwQb29Vg+1eLPvH/Jc=; b=JCpWH6H3c3xJmDx4m44yqsW3etL8ubLDeUPAf8ptbGhALpQQLd/2qOZ3y30GhhSpfk XzVTsUHP5bIpI0X0dzsIwcEVKDITt1ffVfdR+/41qKJAdW5BJloR9k4yx5TFSktdfoMp C6Lb98s2EOySigNW8VT+oHimG4s2JxoW/zEvCGCZalb3dGw5NSizqHpQ9QBVegpHUFIY ME06um5vxd6UDUgl6J2V58Nfq07YQqAOqxjrM+KOK5m0O38uxQI31SBwJCgrnwiDI/z1 ZCwdMH07HpsPqY0/I4PNJaviLDthtkIYFO2V3uTPEYN4ReRBjYfqw45H5nbN0SvQM3Sp NQNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=thlrGQyy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i26si6312798edv.525.2020.07.17.17.59.05; Fri, 17 Jul 2020 17:59:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=thlrGQyy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727815AbgGRA7B (ORCPT + 99 others); Fri, 17 Jul 2020 20:59:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:42858 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726742AbgGRA67 (ORCPT ); Fri, 17 Jul 2020 20:58:59 -0400 Received: from sol.localdomain (c-107-3-166-239.hsd1.ca.comcast.net [107.3.166.239]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B814A2065E; Sat, 18 Jul 2020 00:58:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595033939; bh=vG8PG1WGBlJ0AL5gm2JsIz6j0+sz4k0vgDpRJOM4PMQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=thlrGQyy/UZAZa70V3vjI5b/9CwLgKXaXVTnc9hc8tyntpaGvy7M9F3kizE34zxT8 UnoVA/HY5M5gQUq/nTl2Q/60WtpRPGHSjW1XM4QBu/VOSsfmOPu+qqfzPdTjVZkqHN gOXHcBzM1LF2zmDa9gKvbb5uByy3pFHg1H3Ce10c= Date: Fri, 17 Jul 2020 17:58:57 -0700 From: Eric Biggers To: "Darrick J. Wong" Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, "Paul E . McKenney" , linux-fsdevel@vger.kernel.org, Akira Yokosawa , Alan Stern , Andrea Parri , Boqun Feng , Daniel Lustig , Dave Chinner , David Howells , Jade Alglave , Luc Maranget , Nicholas Piggin , Peter Zijlstra , Will Deacon Subject: Re: [PATCH] tools/memory-model: document the "one-time init" pattern Message-ID: <20200718005857.GB2183@sol.localdomain> References: <20200717044427.68747-1-ebiggers@kernel.org> <20200717205340.GR7625@magnolia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200717205340.GR7625@magnolia> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 17, 2020 at 01:53:40PM -0700, Darrick J. Wong wrote: > > +There are also cases in which the smp_load_acquire() can be replaced by > > +the more lightweight READ_ONCE(). (smp_store_release() is still > > +required.) Specifically, if all initialized memory is transitively > > +reachable from the pointer itself, then there is no control dependency > > I don't quite understand what "transitively reachable from the pointer > itself" means? Does that describe the situation where all the objects > reachable through the object that the global struct foo pointer points > at are /only/ reachable via that global pointer? > The intent is that "transitively reachable" means that all initialized memory can be reached by dereferencing the pointer in some way, e.g. p->a->b[5]->c. It could also be the case that allocating the object initializes some global or static data, which isn't reachable in that way. Access to that data would then be a control dependency, which a data dependency barrier wouldn't work for. It's possible I misunderstood something. (Note the next paragraph does say that using READ_ONCE() is discouraged, exactly for this reason -- it can be hard to tell whether it's correct.) Suggestions of what to write here are appreciated. - Eric