Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp183622rwb; Fri, 4 Aug 2023 10:59:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGY0Dw+weNEgZBAYvagRDci3JUZAhZ/DvN7pWFn6yO5g8T4U+eZGzTsYS7zrZZ+iUAu8P4m X-Received: by 2002:a17:907:2718:b0:99b:56f1:3002 with SMTP id w24-20020a170907271800b0099b56f13002mr2151803ejk.61.1691171985626; Fri, 04 Aug 2023 10:59:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691171985; cv=none; d=google.com; s=arc-20160816; b=I7wo46NyXmOJ5RHjIq+3qiPyLBs38T8alsNvj2U79PEkUdP64OVTlExP5F3CQsDs3A 4hvE1sCNogYWuTKgRTi9A1h72bQeoGU7vX9f0tFHd9WtHXqRcmqskLGRezIEcgsvjBKG yDR0RlstcgR1Au6gbUbpJ8KZFgSCLqaSI+yeCAx9vt1MXfztUmBWNVuYshyviD6Bk7Lp ZPYSzmWs35J3d7IeL1FrWYFOU0zQOeiJGjjLhUOPAwQ6OxU07mcitA2o5gpRmhdaDwL6 dXWz/fGJ2FYozfwgfidu1t39WeMhBxhJWcmNBEnb20yCDI3WRNo9AXuZj78ZiNrZRxaO 8R5w== 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=o6toHKDumvtTuc73t/3Rfmw0t3MZ9ibhPO01TjP9N1k=; fh=Rujx3P9ajNDswbv0RS45FPGVW3SWXiWh+QezVVQxiwA=; b=pcEccv+kZn4jzNdEKQYgitkMpYsXiCcUq7+FQA3F4J8xwd22Sb4A8Xn+wbB1rqxutU E7jtAw0/iYRIcmMn17mhlPVuTqcp8wm/neVDuR2ulifWe/ws3H+hSNQnEiZXN350jUep PWcJLRs16S1ojp2URTVOcckmRZtcWISTSbMMM20rxPjifttYsDME8Qk7+Ejnv8xSlMMA fiSe16PemW/MwH5oCuSnWT10bk3aJo2asX7XNkIY1RJvLZ9DyOkIRohpxt0JXUZ1UgMt a4UjXvrlkPkk8OlxfdyvRFyccf7H40QNKRWYRgNhw8GdWsxFqeO0G/CYggJ4BS8ETbzU 6b0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Dfobvzeo; 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 q25-20020a170906389900b0098aa2c4209esi1885504ejd.424.2023.08.04.10.59.21; Fri, 04 Aug 2023 10:59:45 -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=Dfobvzeo; 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 S229923AbjHDRDR (ORCPT + 99 others); Fri, 4 Aug 2023 13:03:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231651AbjHDRDQ (ORCPT ); Fri, 4 Aug 2023 13:03:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D60214ED8; Fri, 4 Aug 2023 10:02:50 -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 4700E620B6; Fri, 4 Aug 2023 17:02:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0B1BC433C7; Fri, 4 Aug 2023 17:02:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691168555; bh=qs+QIUdxIFzWyrOJasFngXnPWrwLq+ttceEWpfXB7gA=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=Dfobvzeom7UUgAciwwnr1JIJaz0EGNd19anbt3F12V6m7EFWQ7f4DOqLjd1JwyN5F w+laxEkHXag5X+37j3sXmiX0DNLnK9cgXLmd4AZBtKDac936ewuqiwfchAvB0PcFFt 2cnOGPBJyYwq6nCW5MGDPu847k4b9AnYSK7NbTIob6sI/0o2gMkNF29qhDE2qUiKkm azct+rjEaAumtoBKHA6dxrSc+PIgAR1HU8I74gQv8ExNBRGe68W96m2XOC8eqfRZeH A+UyRU/6FlphkH0gBLQ3fUvz7rrohF3uwSG3rJayHTg6ek6YOSJSMBZ2MdJt8VuxBA xnJhm6TaPqh5g== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 2D49ACE0591; Fri, 4 Aug 2023 10:02:35 -0700 (PDT) Date: Fri, 4 Aug 2023 10:02:35 -0700 From: "Paul E. McKenney" To: Joel Fernandes Cc: Alan Huang , linux-kernel@vger.kernel.org, rcu@vger.kernel.org, Will Deacon , Frederic Weisbecker , Neeraj Upadhyay , Josh Triplett , Boqun Feng , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Zqiang , Jonathan Corbet Subject: Re: [PATCH 1/2] docs: rcu: Add cautionary note on plain-accesses to requirements Message-ID: <81d02e70-a05d-4230-9b86-0026d4874ea7@paulmck-laptop> 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.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS 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 Fri, Aug 04, 2023 at 12:17:58PM -0400, Joel Fernandes wrote: > [...] > > > >> However, the kernel consider the volatile access to be atomic, right? > > > > > > > > The compiler must therefore act as if a volatile access to an aligned > > > > machine-word size location is atomic. To see this, consider accesses > > > > to memory that is shared by a device driver and that device's firmware, > > > > both of which are written in either C or C++. > > > > > > Btw it appears TSAN complaints bitterly on even volatile 4 byte data races. > > > Hence we have to explicitly use atomic API for data race accesses in Chrome. > > > > That might have been a conscious and deliberate choice on the part of > > the TSAN guys. Volatile does not imply any ordering in the standard > > (other than the compiler avoiding emitting volatile operations out of > > order), but some compilers did emit memory-barrier instructions for > > volatile accesses. Which resulted in a lot of problems when such code > > found compilers that did not cause the CPU to order volatile operations. > > > > So a lot of people decided to thrown the volatile baby out with the > > unordered bathwather. ;-) > > Thanks for the input, I think TSAN was indeed worried about > memory-ordering even if relaxed ordering was intended. I think there > is a way to tell TSAN to shut-up in such situations but in my last > Chrome sprint, I just used the atomic API with relaxed ordering and > called it a day. :-) Fair enough! Note that the Linux kernel's version of TSAN, which is KCSAN, does interpret volatile accesses more or less as if they were relaxed atomics. So TSAN could change, but I don't have a dog in that fight. ;-) Thanx, Paul