Received: by 2002:a05:7412:518d:b0:e2:908c:2ebd with SMTP id fn13csp440440rdb; Thu, 5 Oct 2023 10:09:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEU0QvdWo+pQkz6FirImQWt6UTNpC/SEv5+O5fYQykdFApI0z2JY3E1iEbSVHiPoGZjKgZ0 X-Received: by 2002:a19:ad04:0:b0:503:eac:747 with SMTP id t4-20020a19ad04000000b005030eac0747mr4834856lfc.47.1696525786950; Thu, 05 Oct 2023 10:09:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696525786; cv=none; d=google.com; s=arc-20160816; b=Xr2sOUbX9CPh3sadcCEfd6xzX2UPArArUERvc4Vjm0Ib+qtMCVrJPKoMf9ppTDjie4 bDa+wCUDL3QgZxFsv0RfnWRv4L8+uKK7a1rsGoq16uPtvbO4g6pcR1KXldxvo4MJcuGU Hl7lg5Eg78aG88+JP8GwgDbyKi0HRKdsPPFTgTr0ZG43PHrvNA/gPnnmRlL+Qel3UbnH HgXFhbwtApADbym0ZORkLQE1PAfhHyzeySlq5IkaVjgWmV27Qbpq1La8tWlQbYNIeSuM y5crsBsiwHo8SKyB9mf9+awmAXAo4585BEBECiQ3spoYAinvHpbmww+Jwp8foo8sOhQV H9YQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:reply-to :message-id:subject:cc:to:from:date:dkim-signature; bh=O2LkVsOUNcfNOZ7zcLJGYaf9zNORedlKx3IRt4lR1XE=; fh=ZAeClpQKVdF/lID2+PIUck9mjN5RgXLMZvjvPrAPbQc=; b=qssBh7t47BU/mLu2ISW8i7DeBpm00S2N6O8qWrPDo7fhGGQZSXAKyw0u5KfuOnRhW5 0Pghy9LDL3+FHF1IMwoJDfIRtkxqrTy3WPl6uQxpBmLYHGjz6EymwFfq6z1BX81Sjo5C sGt6yrFk8IWudmNrPDfwaoMpFpEKkAzfoT611avRWeQccZFfc5aarbQmIgGqjTYzcXFO UVkp8BzW/BeaYDL/2T0TVQldPZQt/DDeh7a+/gc8KFyDjVTbTZdWxS5n33MY6Qwq+7XF 5uYM3vQqiKxSu03vttwDQDaSvY3gzI5Dc+nqNjURVur/Jj4E6xLosjeiPEJCPJik/Q2k FixA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jLxs7RQU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id g17-20020ac25391000000b00501cf505290si1722427lfh.164.2023.10.05.10.09.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 10:09:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jLxs7RQU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 99A768027A9E; Thu, 5 Oct 2023 10:09:42 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229614AbjJERIu (ORCPT + 99 others); Thu, 5 Oct 2023 13:08:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230200AbjJERHw (ORCPT ); Thu, 5 Oct 2023 13:07:52 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CB7B1FC2; Thu, 5 Oct 2023 09:53:13 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E04C4C433C7; Thu, 5 Oct 2023 16:53:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696524792; bh=QqFYej4zszOQ9dZXHQnUKqXBkmPZfqU3JS9WYFmKdmQ=; h=Date:From:To:Cc:Subject:Reply-To:From; b=jLxs7RQUwT/7fGOj6cQriRmgkLmIlXWgZAFYKosF74F9NyB3UNvErb1T/7nI/6Si9 rOa2rY9VSOZHefnUmUNYKPJIdU4kUjwP0ovsyGfGN8ujImCgY4H4nfkAV9si2htizu Z2et/xgbnU3WOpSEPrnLeRW8WlHQ2iv998MuPOq9E03EBangBojAbKvsd96brKRVh9 dMTTYS1YvFm7K721l139E0t65bYIaud8Cy5VC2gnAlCSFoJlzK8jZztudgCZM5hiF5 P5BopJk+Zu62aXB7B2waSVrYNZwTl6mml8nl6FpmncMjY4JsSjAmruuQDOiY8OTHEJ qMJKOrKBZyGqw== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 8157ACE0869; Thu, 5 Oct 2023 09:53:12 -0700 (PDT) Date: Thu, 5 Oct 2023 09:53:12 -0700 From: "Paul E. McKenney" To: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-doc@vger.kernel.org Cc: Alan Stern , Andrea Parri , Will Deacon , Peter Zijlstra , Boqun Feng , Nicholas Piggin , David Howells , Jade Alglave , Luc Maranget , Akira Yokosawa , Daniel Lustig , Joel Fernandes , Jonathan Corbet Subject: [PATCH memory-model] docs: memory-barriers: Add note on compiler transformation and address deps Message-ID: Reply-To: paulmck@kernel.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 05 Oct 2023 10:09:42 -0700 (PDT) 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 in the beginning of both the historical address-dependency sections and point to rcu-dereference.rst for more information. Signed-off-by: Joel Fernandes (Google) Signed-off-by: Paul E. McKenney diff --git a/Documentation/memory-barriers.txt b/Documentation/memory-barriers.txt index 06e14efd8662..d414e145f912 100644 --- a/Documentation/memory-barriers.txt +++ b/Documentation/memory-barriers.txt @@ -396,6 +396,10 @@ Memory barriers come in four basic varieties: (2) Address-dependency barriers (historical). + [!] This section is marked as HISTORICAL: For more up-to-date + information, including how compiler transformations related to pointer + comparisons can sometimes cause problems, see + Documentation/RCU/rcu_dereference.rst. An address-dependency barrier is a weaker form of read barrier. In the case where two loads are performed such that the second depends on the @@ -556,6 +560,9 @@ There are certain things that the Linux kernel memory barriers do not guarantee: ADDRESS-DEPENDENCY BARRIERS (HISTORICAL) ---------------------------------------- +[!] This section is marked as HISTORICAL: For more up-to-date information, +including how compiler transformations related to pointer comparisons can +sometimes cause problems, see Documentation/RCU/rcu_dereference.rst. As of v4.15 of the Linux kernel, an smp_mb() was added to READ_ONCE() for DEC Alpha, which means that about the only people who need to pay attention