Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp475595rdb; Fri, 6 Oct 2023 08:50:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF0+liWmJGfXP/CPGbGSoZOss7a5i2aID4mpHdH7fik5AwjAvoouBdDPGSTe/+nKPLjpM+M X-Received: by 2002:a17:90a:b017:b0:26b:4ce1:9705 with SMTP id x23-20020a17090ab01700b0026b4ce19705mr8527537pjq.38.1696607405224; Fri, 06 Oct 2023 08:50:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696607405; cv=none; d=google.com; s=arc-20160816; b=f28Rar0lD3GfGWorR0wU5woiXPO33Y6gmFusuNsz6e6d9HuGHjNh8uupjVe6f2NMi7 v2ub3i/FVlpBp1zwcDqlcEQzQVLMUfloflk+90D+ZkuMvXct9DGtP7SHBJgg03NUlqli 2nSPk4juh6Vyr+GQjiexLr3bdIb9v2beaiVSUegiAN8/RwiaCtNj+23SJvuQr5DJVvBc YTS5U/+yEpmIjc7dxaMc3f3nuUO0X3lSRDARYXYif6UVJEEulREHD0rn7m2PCD+zgusJ iK3nzZ2r193uIbAzRphAX43mA0+jWB0jxipUmCpAsmzKXdPgWbSYjKh9fecR0W7aRm9h IYBQ== 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=lD4Mj9VCMz5o/wOhXD1aDzGQmwbxUm1wNkxNCEpHmBY=; fh=SO5ETca9T3pc8acK1IwYZxaG/j5MpFwAY40pvDCDbKk=; b=Q3nlV1Y0YHF0issOuD4r2x9933352CXYLCo7w9R6TU2uPiNcRbC49vQXgI6o7PQos6 dylAnNY9qz2iv9MDafAovmmCB48MSrli2biJHhqgGoFKSDq4U6H3F6gmFPDhp9CO1tKg O4YUnnipNuWrRU+J1aIX8JD/5lCJszNI7uL9zyshA1vWYa4aYEUpRgDPM4ebJFzWb/uL ZarX+Cv41aP5sWDDMtDFpQxChOIBJEiTzjjOMpCJtkuINYdV9CNEM9Kvm1cOfX5hSD+c OFPwIvtgV2Rt+8xiS47VrXgKl5hjcCISqQvi/E0xaVEiP/FAocsGhZO38QvNAtvDYjBN g6wA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tuO3Y2W5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id mt12-20020a17090b230c00b002790b712b6asi1473114pjb.39.2023.10.06.08.50.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 08:50:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tuO3Y2W5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (Postfix) with ESMTP id DD7EF801B3D2; Fri, 6 Oct 2023 08:50:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232674AbjJFPtr (ORCPT + 99 others); Fri, 6 Oct 2023 11:49:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232502AbjJFPtp (ORCPT ); Fri, 6 Oct 2023 11:49:45 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18B019E; Fri, 6 Oct 2023 08:49:42 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8C46C433C7; Fri, 6 Oct 2023 15:49:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696607381; bh=ZSSuoEGwh0wklx+z8o5WHFA0QtphImYanv8ABNIK/8A=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=tuO3Y2W5PsjSMEZRDLGecoGa7oOleaX/e1R1yanf5hxicHanZORSw7BmSLHYdGHLt xI+Mvs8Xf1luIHBceSvSF9DAjvLaZjuNX9hqcHDmp+RAqqMCJ4WMDRrH9Cv3HTnQ+G DVJO36mEU5J5YuDAz+sgeJ5YL8NU6nwfS9rYB9PtCSTbjjv2bBiT5f78j4XJ98/fqE SvNSE7DQzAweFZXNZwdXAekkk8tfUnm/awUeDDKgo1/eW8zydSVtKWaY0GpubCZNQK Kn6GwvDq4/+qGbgP1l2wBOsEHbBt5DgdFtM0p49NH/9h5cfsYop8Ine6XxXm5oAlj/ P8JQaAhMLLKtA== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 4E4A9CE0976; Fri, 6 Oct 2023 08:49:41 -0700 (PDT) Date: Fri, 6 Oct 2023 08:49:41 -0700 From: "Paul E. McKenney" To: Andrea Parri Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-doc@vger.kernel.org, Alan Stern , Will Deacon , Peter Zijlstra , Boqun Feng , Nicholas Piggin , David Howells , Jade Alglave , Luc Maranget , Akira Yokosawa , Daniel Lustig , Joel Fernandes , Jonathan Corbet Subject: Re: [PATCH memory-model] docs: memory-barriers: Add note on compiler transformation and address deps Message-ID: Reply-To: paulmck@kernel.org References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.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 (pete.vger.email [0.0.0.0]); Fri, 06 Oct 2023 08:50:03 -0700 (PDT) X-Spam-Level: ** On Fri, Oct 06, 2023 at 04:24:38PM +0200, Andrea Parri wrote: > On Thu, Oct 05, 2023 at 09:53:12AM -0700, Paul E. McKenney 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 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 > > Reviewed-by: Andrea Parri Thank you, and I will apply on my next rebase. Thanx, Paul > Thanks, > Andrea > > > > 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