Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp2712459rwo; Thu, 3 Aug 2023 13:48:22 -0700 (PDT) X-Google-Smtp-Source: APBJJlGJ5Mw03H3pcmp0OOzBMfdYWMx2ifqVOfLTw4QxDA4ki6e3ZWW6J+Lq58sMT9MgB5tjJ6IR X-Received: by 2002:a17:902:9301:b0:1bb:9f04:d899 with SMTP id bc1-20020a170902930100b001bb9f04d899mr16329953plb.8.1691095702161; Thu, 03 Aug 2023 13:48:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691095702; cv=none; d=google.com; s=arc-20160816; b=S8AZdcxFoeoNN5owPsC7f/623F8AK9Mm1ro4r4MVQEW8tPVrivwizN1ICHqJ2GP6nQ f/ExH7EUBgFymeBVEiVzifrVrdX3Jc3i2pFZQmvti7DADyWIlM8Q7xkHGxTlHYEk/NeL Ebz3fVtItKnSTpaZnoCmuwJ5iDKcFQdGQ7WDv7wiTo3TSOCdD4lNmrx4syfntn7qnLI3 Buo6zNfQvPnC+0N3Ehl0/ZhWjz/HwZO/7TgCUw47CJfKYcla1rvz+TNmWPDa9b55g+I2 Pb1djq9l5FtNPhgVHCxAPxlFlzRUu7v5wsODHBulVWu+mcmgZc+OWxxx6mKf6SzOv+XI VSew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=bPPgztQiulIATyIl71rZJ4osKFr3MXkdugVufXgW7yQ=; fh=+nR5kP3DG3f8fjwmOaGpouHW0ek4b90vCWCNa5id4cM=; b=Mk3LyB6Bew2byL2atblnVuK0VR7iXUs5GBZtEBI5xOq93TMByZsLEEO6DnDN0BOSJ4 qd2Jikj9lKwNrW6op9WFjnizOHfC/JQgryCrFll+eKY7n4Iuqu7u849fsU47FSRP/gkL bLoKZ4M4NHX6uyCBdrTkKRD3f1FFZbYxJlzTD7aeMh6wQHxArWSGUFwCD/uwh/40JtCt Q3bYC0+AmOZq74wzW+uCz/fcyZMoGxb7s85EJQw9YBWTy01JzqlUXa5n+bquov3dtCt3 WgWHtaQGDesWfF4FZjsLZKlZ1J5FLEE+YdSDJn6/xiNwW3/hL3SQBnc1wwA9WXxTbFLY jBzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=H2C7gNwN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c1-20020a170903234100b001b8ae34f1b7si541694plh.631.2023.08.03.13.48.09; Thu, 03 Aug 2023 13:48:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=H2C7gNwN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231807AbjHCSwp (ORCPT + 99 others); Thu, 3 Aug 2023 14:52:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230423AbjHCSwo (ORCPT ); Thu, 3 Aug 2023 14:52:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D3FE4219; Thu, 3 Aug 2023 11:52:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4FAD261E67; Thu, 3 Aug 2023 18:52:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD36FC433C7; Thu, 3 Aug 2023 18:52:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691088726; bh=C4EW4wbKCHTYy6MNIaLyL7a1gGIegviHQ8l+Ecex1SQ=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=H2C7gNwNpz8RClNWocDqQRDE8DGjNnPE6tJd4q10HUbE0iwB4z0IsH1/GPe0yB1c5 1+bZR2EYET3zvXmCCKtfFMBjVc/6DbZOpMXFvvcWJyltoA3mKnMfXXU1zEuVig+8j3 HeXmq2nGSe+vwQdzm5XVpgaTj1i/vNBWJHlrfJDnyUHK6OOcZY/JaYgc9ZzOILxvOf O2XUOZKoarBoCwdyn0bL6Ygc9DBlY68A5Lzq/NC/QSP7CbsEC+5wexdePO4DXvJRdV ydHeSFYXrUgXl85O4TZx/t5VSqUsMKp1H1qlMeCXwp0HO3vC6XefVHpCkoV4I4NKQc S9mlIyA83T0Tg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 3DE1ACE0AE0; Thu, 3 Aug 2023 11:52:06 -0700 (PDT) Date: Thu, 3 Aug 2023 11:52:06 -0700 From: "Paul E. McKenney" To: "Joel Fernandes (Google)" Cc: linux-kernel@vger.kernel.org, rcu@vger.kernel.org, Alan Stern , Andrea Parri , Will Deacon , Peter Zijlstra , Boqun Feng , Nicholas Piggin , David Howells , Jade Alglave , Luc Maranget , Akira Yokosawa , Daniel Lustig , Jonathan Corbet Subject: Re: [PATCH 2/2] docs: memory-barriers: Add note on plain-accesses to address-dependency barriers Message-ID: <626d1b48-de6a-4a0b-95d3-3ac438878757@paulmck-laptop> Reply-To: paulmck@kernel.org References: <20230803032408.2514989-1-joel@joelfernandes.org> <20230803032408.2514989-2-joel@joelfernandes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230803032408.2514989-2-joel@joelfernandes.org> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 03, 2023 at 03:24:07AM +0000, Joel Fernandes (Google) wrote: > The compiler has the ability to cause misordering by destroying > address-dependency barriers if comparison operations are used. Add a > note about this to memory-barriers.txt and point to rcu-dereference.rst > for more information. > > Signed-off-by: Joel Fernandes (Google) > --- > Documentation/memory-barriers.txt | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/Documentation/memory-barriers.txt b/Documentation/memory-barriers.txt > index 06e14efd8662..acc8ec5ce563 100644 > --- a/Documentation/memory-barriers.txt > +++ b/Documentation/memory-barriers.txt > @@ -435,6 +435,11 @@ Memory barriers come in four basic varieties: > variables such as READ_ONCE() and rcu_dereference() provide implicit > address-dependency barriers. > > + [!] Note that address dependency barriers can be destroyed by comparison > + of a pointer obtained by a marked accessor such as READ_ONCE() or > + rcu_dereference() with some value. For an example of this, see > + rcu_dereference.rst (part where the comparison of pointers is discussed). Hmmm... Given that this is in a section marked "historical" (for the old smp_read_barrier_depends() API), why not instead add a pointer to Documentation/RCU/rcu_dereference.rst to the beginning of the section, noted as the updated material? Thanx, Paul > + > (3) Read (or load) memory barriers. > > A read barrier is an address-dependency barrier plus a guarantee that all > -- > 2.41.0.585.gd2178a4bd4-goog >