Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp419080rdb; Fri, 6 Oct 2023 07:24:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF/COF/11hadljzAPI75YxTdIZFuRt012oZNVjpz4xNJ1LsoE5lEOnZdr0OR44FuPftYjK0 X-Received: by 2002:a05:6a00:188a:b0:68a:6018:a66f with SMTP id x10-20020a056a00188a00b0068a6018a66fmr8926827pfh.2.1696602299573; Fri, 06 Oct 2023 07:24:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696602299; cv=none; d=google.com; s=arc-20160816; b=r3u8PgqxuSJO2PduQezT/3lljzJR7L2h0ik3HdA07I4CjjIHhg8TmkcOWdGiT0+WPZ A1IqL90fBSdq9QCFIbU/NIM/wzum+QXUhwA+uqpL1VNKStyGYo2JVzi3swThcNEoEXni wNgS9Ri1u6mejoR/VU7gH9TXs4w1vYgc4w7NnVPT9XeM8Y1iFBn5GNMWTlp8fBTom8UK aNJnV+coGDmuhrL5rBcfWJ6KPJBe+WOohsIUfNeg5hk8I2E+Rj9Gm/p+WQaFBCZOScIn fgMgPyVpJQYAkgmPbYOsLS8rFBfEg4wgrpwwX5ilNHZoO233Ggzu3d0nGg/t1CXOtpPF hngQ== 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:message-id:subject:cc:to:from:date:dkim-signature; bh=b8I/pmp7HdKLDHhCdi41zE+MtAKI0m0CcPz66uBEWEc=; fh=3K0CaOlirdjr8BQ6caaeqjyOXtXARe52Zl/Hb5PWkCc=; b=iY8Ll+aMufck+cZZ1Hi2Aay5N5czSWcHKl/Y1E4vdlFNqhiYQBpJoo1+YMOGeSpq/m ceB/D6qGHr/I0/R3cjqE8KTf836wDQ3wg7LaPF82gVXNlabL82g5gaRYzfgL/sxZ6c2I Z7Vq05oJnZKsKTZqNT5GYmMbK/gfwV1idZnsPM1QlLWf89f6nJ2H9fgI7B09hw2+BQAx fTxaocNtmZgv5HjZN1hZ8ZU9dBHGd1GMQ2m74IaHZnqPZj/8S4cL9Qb4f+uJHojJieBu V8aC0SsP/oNq6ELJbNqOWXxuTgSVCM8dYvwfaFF7W02hggyvnOyh27spTtX7lr35bsD1 cuSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ZzbGrKpp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id s4-20020a056a00194400b0068e2566615esi1624020pfk.379.2023.10.06.07.24.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 07:24:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ZzbGrKpp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 671448050FB7; Fri, 6 Oct 2023 07:24:54 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232482AbjJFOYq (ORCPT + 99 others); Fri, 6 Oct 2023 10:24:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231129AbjJFOYq (ORCPT ); Fri, 6 Oct 2023 10:24:46 -0400 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F107EA6; Fri, 6 Oct 2023 07:24:44 -0700 (PDT) Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-533edb5ac54so4071647a12.0; Fri, 06 Oct 2023 07:24:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696602283; x=1697207083; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=b8I/pmp7HdKLDHhCdi41zE+MtAKI0m0CcPz66uBEWEc=; b=ZzbGrKpphOqZjqODmc3CS06vkcTmMlu9ShEuI80HJ1taZVYLZBXUB1Mj0ElxafoiHA 6vvpbXQE/hw26qswIgcWRkeYEgHZaMZllKITvs7518p2SVQU5xwKkdCSuLrTH84Z52C/ 22rX5zpA5ypJyFg7RAYgmklIOWvwuKNZXU1yiO07WZtJFWlQTyT48Kiox/YPO4h6N96o FBlS+xatQqOrqA8hH/Gg48m2sj1eDV2rfHBGN5faCMF3gTWc9ah1pcShMqp5kN8FqR2t f55Jq3BXgwGpM1Cqyb231HKXsD2C5rYKCNKHKSUiHHCj7kBLFs6UYiGKSx0+g6CmuWde rO7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696602283; x=1697207083; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=b8I/pmp7HdKLDHhCdi41zE+MtAKI0m0CcPz66uBEWEc=; b=EAa81lDAKGdkBfKEO7VUeDnXabWaNDETrlViYR+QggyXSrlmMbuhNkMkM6/g8qVRUL Je2U+br3Q68eHrn6DH7JPyIDVuzkaH56Z1kq/aEwXfA0Y3Bsa1mpjGaKURCw6h97efH0 idjBMXfmHofJvo+O9j7EhEeYFUW+wH15IU4uZWUZu5Zp0MZleb6CUUrbgH1fVaE661Nx vnPJlOOXVzCMwxU7hn3koYOTnwmUYGlpNyNIXSZYMaY5VCLDOeVGir8ftdSxsNrwtjh2 L9GyFoHzsj/OPvMiP4lFjQBZUa9MvierIZ8C/XkOvZYzb4I7UNa/MZtSUeInf95d6dEw 8kyA== X-Gm-Message-State: AOJu0YwJDr28yVMka18lLWwq4ySQmPi0CqXmUbLvsAFyh9G6CCUKnz8W 5Q5aIvkl+FPuf5fi8eVasVM= X-Received: by 2002:aa7:d501:0:b0:52f:2bd3:6f4d with SMTP id y1-20020aa7d501000000b0052f2bd36f4dmr7896584edq.0.1696602283036; Fri, 06 Oct 2023 07:24:43 -0700 (PDT) Received: from andrea ([151.76.7.139]) by smtp.gmail.com with ESMTPSA id ca15-20020aa7cd6f000000b005331f6d4a30sm2637771edb.56.2023.10.06.07.24.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 07:24:42 -0700 (PDT) Date: Fri, 6 Oct 2023 16:24:38 +0200 From: Andrea Parri To: "Paul E. McKenney" 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: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=3.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,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 morse.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 (morse.vger.email [0.0.0.0]); Fri, 06 Oct 2023 07:24:54 -0700 (PDT) X-Spam-Level: ** 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 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