Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp1122258rdb; Fri, 20 Oct 2023 09:01:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFKNzpR5VzxAdWHyYGZwQQfgku/Apw1MgHbz6PG/5ECMjtaqVQKYLRPF3wZYWY2AnAtg6XH X-Received: by 2002:a17:90a:356:b0:27d:e29:8352 with SMTP id 22-20020a17090a035600b0027d0e298352mr2174090pjf.45.1697817690939; Fri, 20 Oct 2023 09:01:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697817690; cv=none; d=google.com; s=arc-20160816; b=u5zuc0mGJDqjXKAEspkHSVnBd9jbd6STqwayLtSC5jnxBnkkY3pgYMs3ryJZxfP5IW Nd0s30w3NJOjme8KF86zSmT/MA9hAB60WmxLMT8sN/u49UK/uNNdMEv/UT5hpsY1O42T 2cc5V5J0/9zzSElGjMV63DSR8lAEhHdu69IOtMH9gpk6ZUGO0rfZ6xfVixxPCRyiVtjQ NoczQL39hCO3rb1Qpxd8Y3W24GhNVYnc8BbqUs646VyUr6Fwhl6nUy9HcPlpaLPsS/4V wnJKkr8fLdoWqHhDYsIEJwaAgYULtqqF/DijwuIT+LJqeorejOkyiM+F855eKeLuvjX5 gOUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=9ur3r9Mhffjy5RlOmCibszqum29YBPD4iYoZROFrCao=; fh=4MGzg+zqn91Yoq0ltiu8kqYb9gvJ0mTw01amY12kYzE=; b=EZmFoqzelx/TcJ5RpZP0wXEb/xS/+R1/j7W24Cvd0npvbi5tDNih/l65psa4Pxc/Sj 9rQbbBWT4tk6HcZZrngJpkoYTkoVUP3S0i7IKK0qA2Tk8QnyiYcBc38mDj1WD8O1v332 U2W0m+K5Tu722GHSOuQKwDfTjxuWucGvk3jlo0ljqUpNoIj+wSqhVJUFGw5JZNdgHlHv oYnSPia+34x2h+VMU2UaRsdH522d97kQn8h966HPSZTpF5sH8kfcxBKcN0wuCJ24Qnql 1uuWwHHMX+hImEWYlLmZFz9ioQCGu1DA7ELc1hOX52zxZP08ZSv/AZvFwJ9mzi0MRFIo gpSw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id f5-20020a17090a664500b0026b7d81b779si4443591pjm.152.2023.10.20.09.01.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 09:01:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 585738208F26; Fri, 20 Oct 2023 09:01:28 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377867AbjJTQBC (ORCPT + 99 others); Fri, 20 Oct 2023 12:01:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377861AbjJTQA6 (ORCPT ); Fri, 20 Oct 2023 12:00:58 -0400 Received: from frasgout12.his.huawei.com (frasgout12.his.huawei.com [14.137.139.154]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53E13D73; Fri, 20 Oct 2023 09:00:55 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.18.147.227]) by frasgout12.his.huawei.com (SkyGuard) with ESMTP id 4SBpnG4JFyz9v7cQ; Fri, 20 Oct 2023 23:45:06 +0800 (CST) Received: from [10.81.210.100] (unknown [10.81.210.100]) by APP1 (Coremail) with SMTP id LxC2BwBXsJEUpDJl+6eWAg--.65134S2; Fri, 20 Oct 2023 17:00:30 +0100 (CET) Message-ID: <0bf4cda3-cc43-0e77-e47b-43e1402ed276@huaweicloud.com> Date: Fri, 20 Oct 2023 18:00:19 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH memory-model] docs: memory-barriers: Add note on compiler transformation and address deps To: paulmck@kernel.org Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-doc@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 , Joel Fernandes , Jonathan Corbet References: <4110a58a-8db5-57c4-2f5a-e09ee054baaa@huaweicloud.com> <1c731fdc-9383-21f2-b2d0-2c879b382687@huaweicloud.com> <2694e6e1-3282-4a69-b955-06afd7d7f87f@paulmck-laptop> From: Jonas Oberhauser In-Reply-To: <2694e6e1-3282-4a69-b955-06afd7d7f87f@paulmck-laptop> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CM-TRANSID: LxC2BwBXsJEUpDJl+6eWAg--.65134S2 X-Coremail-Antispam: 1UD129KBjvJXoWxJF13WrWkGrWUtFykXw1DKFg_yoWrJw1Dpr W7uF12kF4DAw13Cw1ktw10yFyIvrWrAF45Gr93Kr1DZa98urySkF47tw45uF98Crs5Zr1j qrZIq397Z34qvaDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUv2b4IE77IF4wAFF20E14v26ryj6rWUM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4 vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Jr0_JF4l84ACjcxK6xIIjxv20xvEc7Cj xVAFwI0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW8JVWxJwA2z4x0Y4vEx4A2jsIEc7CjxV AFwI0_Gr0_Gr1UM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40E x7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x 0Yz7v_Jr0_Gr1lF7xvr2IY64vIr41lFIxGxcIEc7CjxVA2Y2ka0xkIwI1lc7I2V7IY0VAS 07AlzVAYIcxG8wCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c 02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_GFv_ WrylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7 CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6rW3Jr0E3s1lIxAIcVC2z280aVAF wI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa 7IU13rcDUUUUU== X-CM-SenderInfo: 5mrqt2oorev25kdx2v3u6k3tpzhluzxrxghudrp/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.1 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,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 fry.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 (fry.vger.email [0.0.0.0]); Fri, 20 Oct 2023 09:01:28 -0700 (PDT) Am 10/20/2023 um 3:57 PM schrieb Paul E. McKenney: > On Fri, Oct 20, 2023 at 11:29:24AM +0200, Jonas Oberhauser wrote: >> Am 10/19/2023 um 6:39 PM schrieb Paul E. McKenney: >>> On Wed, Oct 18, 2023 at 12:11:58PM +0200, Jonas Oberhauser wrote: >>>> Hi Paul, >>>> [...] >>> The compiler is forbidden from inventing pointer comparisons. >> TIL :) Btw, do you remember a discussion where this is clarified? A quick >> search didn't turn up anything. > This was a verbal discussion with Richard Smith at the 2020 C++ Standards > Committee meeting in Prague. I honestly do not know what standardese > supports this. Then this e-mail thread shall be my evidence for future discussion. > >>>> Best wishes, >>>> >>>> jonas >>>> >>>> Am 10/6/2023 um 6:39 PM schrieb Jonas Oberhauser: >>>>> Hi Paul, >>>>> >>>>> The "more up-to-date information" makes it sound like (some of) the >>>>> information in this section is out-of-date/no longer valid. >>> The old smp_read_barrier_depends() that these section cover really >>> does no longer exist. >> >> (and the parts that are still there are all still relevant, while the parts >> that only the authors know was intended to be there and is out-of-date is >> already gone). > The question is instead what parts that are still relevant are missing > from rcu_dereference.rst. > >> So I would add a disclaimer specifying that (since 4.15) *all* marked >> accesses imply read dependency barriers which resolve most of the issues >> mentioned in the remainder of the article. >> However, some issues remain because the dependencies that are preserved by >> such barriers are just *semantic* dependencies, and readers should check >> rcu_dereference.rst for examples of what that implies. > Or maybe it is now time to remove those sections from memory-barriers.txt, > leaving only the first section's pointer to rcu_dereference.rst. That would also make sense to me. > It still feels a bit early to me, and I am still trying to figure out > why you care so much about these sections. ;-) I honestly don't care about the sections themselves, but I do care about 1) address dependency ordering and 2) not confusing people more than necessary. IMHO the sections right now are more confusing than necessary. As I said before, I think they should clarify what exactly is historical in a short sentence. E.g. (2) Address-dependency barriers (historical). [!] This section is marked as HISTORICAL: it covers the obsolete barrier smp_read_barrier_depends(), the semantics of which is now implicit in all marked accesses. For more up-to-date information, including how compiler transformations related to pointer comparisons can sometimes cause problems, see Documentation/RCU/rcu_dereference.rst. I think this tiny rewrite makes it much more clear. Specifically it tells *why* the text is historical (and why we maybe don't need to read it anymore). Btw, when I raised my concerns about what should be there I didn't mean to imply those points are missing, just trying to sketch what the paragraph should look like in my opinion. The paragraphs you are adding already had several of those points. >>> The longer-term direction, perhaps a few years from now, is for the >>> first section to simply reference rcu_dereference.rst and for the second >>> section to be removed completely. >> Sounds good to me, but that doesn't mean we need to compromise the >> readability in the interim :) > Some compromise is needed for people that read the document some time > back and are looking for something specific. Yes. But the compromise should be "there's a blob of text other people don't need to read", not "there's a blob of text that will leave other people confused". Best wishes, jonas