Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp5557844rwi; Tue, 18 Oct 2022 00:20:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6tCcy1WfXaP4FmvxCTXeRoBh0o7Ue5p1y58NAa+kIbXbo+g+QkFcDgNyvJe2OVaU2Q6lAz X-Received: by 2002:a17:902:70c4:b0:178:54cf:d397 with SMTP id l4-20020a17090270c400b0017854cfd397mr1646830plt.24.1666077645575; Tue, 18 Oct 2022 00:20:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666077645; cv=none; d=google.com; s=arc-20160816; b=jILNHZxSCw2fqDEz9/H5IzXzaX2UiGaOfH/XIGlbtB61FWWqzIjEGl6L2a5+jKv1Hy 433RYO2+ZLEKF6kARdlPwYLDl06LORTqU3DsKPtPQELIMInvI2ooG/0Wm9zI98h7+gO/ mye2Co8aorVhm71gylcPBr+1CUymNbiEgn67jblg7OuOKn7m4fwVT3edOP+nr6ajU9oI IjxYHgl4dZMu32Zwy/Kcg/M6GuUWEPf6puQkWfxWqpcTilT5e3ou7pVfX7ObhOoBFCkJ zBy5LKwxX/hkHkF0o3Lir6Ozp45Eq6r5/1loecA0oqz3vnd8k+76u7apFkt8aJE6f96K c8IA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:date:references:in-reply-to :message-id:mime-version:user-agent:feedback-id:dkim-signature :dkim-signature; bh=u2SaGnC5ywr5cuY3ReRbz6hIRErCTTDk96Lbny/ETMo=; b=fyDLXvrFWr86GAjERzvM1t0vAQjfkx8sxYygbXOIJ5YxW6qwIlwBcLwdpc8ud4VMUG JqTUC9Md5OtrkvP/amkyp70xBVW91RSudZsvkWml38u1ok9TJD4lxnkaLuhdqkpdTqMO Wl+0b3JrGrtBHBh3h9eAYzFC78iZbHeNLelSI9yVW43MJc6APrG7llJEz8zhildv7hgt 0u6wpetl/x4u0GlAIrGsbdAjToKtzYTrozOOX5p1aVPpFJJVGZYzQ8xfHgFSSQPErl0Q vzPdUx0GuHnh1Z6tQ+JEECbkEeHU1OJNiG1Clcbs3QjQRk0eBAlWaZ4tulKWXStcjz2Z Xhlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm2 header.b=L7mmMQG0; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=GHRmO7y+; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h68-20020a636c47000000b0043961d06e6bsi13538503pgc.787.2022.10.18.00.20.32; Tue, 18 Oct 2022 00:20: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=@arndb.de header.s=fm2 header.b=L7mmMQG0; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=GHRmO7y+; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229866AbiJRGok (ORCPT + 99 others); Tue, 18 Oct 2022 02:44:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229833AbiJRGoh (ORCPT ); Tue, 18 Oct 2022 02:44:37 -0400 Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BDEE31DF3; Mon, 17 Oct 2022 23:44:35 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 1FC0D320097B; Tue, 18 Oct 2022 02:44:32 -0400 (EDT) Received: from imap51 ([10.202.2.101]) by compute3.internal (MEProxy); Tue, 18 Oct 2022 02:44:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm2; t=1666075471; x=1666161871; bh=u2SaGnC5yw r5cuY3ReRbz6hIRErCTTDk96Lbny/ETMo=; b=L7mmMQG0UCaYJ6FD6sQLwpU9ib sZmfLxRZrQnOPJOAt6/ucNIKLQzR81Cns1CrcIToHfGWfJz6PTKbNrgNSxUnE6Iz UGyPV568LBmYSogcIST5B/4p8U3kfynaMCOfXcefZzO/fyQh17t62QE/vfgCSApc VLkkjsayii21BORI4EAPXy7CFMd/qnOxWT3kq5JWtQdHuPIG+6gXOMq7FD5DOQAy 7LuQY66QJXNnewnLbNaw0D4mNU4OspUma0/d2tcxtYsdCsnfQzzWWCOMYW3kwic/ 6luSxyGU8LqwjcIPb3XZvXtua/yWV0D5aUlrGA8o0PZDZ+Rp8Pr87kCNjyiA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1666075471; x=1666161871; bh=u2SaGnC5ywr5cuY3ReRbz6hIRErC TTDk96Lbny/ETMo=; b=GHRmO7y+iNJQgMAUGEoQeABp071zUnmBadFqtMKBrnjy 1/+E0m7eksuWGdrqHIRqgHhIsCV0XOxury7/Tk298pkCHnsdnCRcjH2JbOU0MT46 oSbVk/t4NuRbhKtrT37XE8KytbX5YmcmAogKnINV8FghnqB0vQB8zvTxZd28c/P/ VPsqu3G4GyTZpbSJOetGMEB5qnM/urt/fylXZ0k5yLgJOtkQkg6GLtvq9su/ptWX gHGYXj785HTF2ep4sU3zXduYG1gHzSVOQqNIhbODGqOIfGrv6WlVf7m9KXdFxM9G FziPbzVBDLAWC9MeMuM56Sx35BsJ9aCzqT3Ju+hLJw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeeltddguddufecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvvefutgesthdtredtreertdenucfhrhhomhepfdet rhhnugcuuegvrhhgmhgrnhhnfdcuoegrrhhnugesrghrnhgusgdruggvqeenucggtffrrg htthgvrhhnpeffheeugeetiefhgeethfejgfdtuefggeejleehjeeutefhfeeggefhkedt keetffenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe grrhhnugesrghrnhgusgdruggv X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 40EDCB60089; Tue, 18 Oct 2022 02:44:31 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.7.0-alpha0-1047-g9e4af4ada4-fm-20221005.001-g9e4af4ad Mime-Version: 1.0 Message-Id: <12f51033-1461-43f9-8d8d-cd726fbb4758@app.fastmail.com> In-Reply-To: <59d99be6-f79e-45bd-203c-17972255cc39@gmail.com> References: <20221010101331.29942-1-parav@nvidia.com> <59d99be6-f79e-45bd-203c-17972255cc39@gmail.com> Date: Tue, 18 Oct 2022 08:44:09 +0200 From: "Arnd Bergmann" To: "Akira Yokosawa" , "Parav Pandit" Cc: bagasdotme@gmail.com, "Alan Stern" , parri.andrea@gmail.com, "Will Deacon" , "Peter Zijlstra" , boqun.feng@gmail.com, "Nicholas Piggin" , dhowells@redhat.com, j.alglave@ucl.ac.uk, luc.maranget@inria.fr, "Paul E. McKenney" , dlustig@nvidia.com, "Joel Fernandes" , "Jonathan Corbet" , linux-kernel@vger.kernel.org, Linux-Arch , linux-doc@vger.kernel.org Subject: Re: [PATCH v4] locking/memory-barriers.txt: Improve documentation for writel() example Content-Type: text/plain X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,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 Tue, Oct 18, 2022, at 3:37 AM, Akira Yokosawa wrote: > On 2022/10/18 5:55, Arnd Bergmann wrote: >> On Mon, Oct 10, 2022, at 12:13 PM, Parav Pandit wrote: > > "a barrier" can mean "any barrier", which can include a full barrier > in theory. > > So I'd rather make the substituted text read something like: > > Note that, when using writel(), a prior wmb() or weaker is not > needed to guarantee that the cache coherent memory writes have > completed before writing to the MMIO region. > > In my opinion, "or weaker" is redundant for careful readers who are > well aware of context of this example, but won't do no harm. I think that would be more confusing than either of the other variants. Anything weaker than a full "wmb()" probably makes the driver calling the writel() non-portable, so that is both vague and incorrect. The current version works because it specifically mentions the correct barrier to use, while Parav's version works because it doesn't make any attempt to name the specific barrier and just states that adding one is a bad idea regardless. Arnd