Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp5646802rwi; Tue, 18 Oct 2022 02:01:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6nRRzMpiErKrazZmPRgpLj29ljTMyDDP7RrdsvlDe2uZPwvwGY7UxIL5v7WykJiTIOVeFy X-Received: by 2002:a17:906:9bf1:b0:78d:f2d7:efbe with SMTP id de49-20020a1709069bf100b0078df2d7efbemr1563936ejc.273.1666083684939; Tue, 18 Oct 2022 02:01:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666083684; cv=none; d=google.com; s=arc-20160816; b=Zfh0BAkDU84tq+RpjO1V5cpv4kxd2m4O92Kb+fkVihVHTAYiAvnNCPCxbDA6iHwx5G 3Ho/PXEjxEf5caYZNCmvBbSF2OXvTcCDNb0luaNa5uEjlRbNxqptQIeILGUlJW8zRvqj 9vSnckGfo/SrNp6xEObrCQEZgCQeTTvSeEi3gfAVrrqnYDPo7/gVLRWxfZlCtX0EKUDG vRBsJm3LjVlf9Vfp1NFZQdHKK2WfjJ3aXjP0wm4nVqRaxtcpTBZsm5YeP4oZcbVOfgDF s5d6JT267qNbCbxVNPRqIkF/q912qeJYEeKkOUxwRAtPlQ409uMvBwjuJOX1Jsi2oAmm kGHg== 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=7Md4CAXWfAGPDZDdUlTOak4LwDabEftkVgALiP8DKrE=; b=Q4LHi92CTAZRkKYUxBUlHE82zJ4Fw98Eb1LX1SHLoA5GvzOglBc/CjRo3xiXqvGtT3 Ch7eEY1ByxABz7dcKl8FLT0Dwv5kREnlXeDYOsR8wZC6Ddx54XfanXpB3IQZsUFiygzY 4Ng6pyExyj7PXSraXVKb8oBmigxMwqJF7xoE62diJAxWKoaXue8Q02HUzKjZoA1F39Sr necLsNjoMzeqdN7+W0GUpgeQIEI5mrYLNQ6kXGR0VLzzmgToinY1H9OIiJYImVTAabs7 p1vyGtBNuGfyvCioNzywyl65wsI49mF3t5cHX8oVCt1C4xduJaGI+loOt7CDreIrmsVT zz9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm2 header.b=U74au7xD; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=Mbt5W75f; 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 sc36-20020a1709078a2400b0078e15c30a6csi10993954ejc.559.2022.10.18.02.00.58; Tue, 18 Oct 2022 02:01:24 -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=U74au7xD; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=Mbt5W75f; 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 S230104AbiJRHuM (ORCPT + 99 others); Tue, 18 Oct 2022 03:50:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229824AbiJRHuC (ORCPT ); Tue, 18 Oct 2022 03:50:02 -0400 Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AF06647EC; Tue, 18 Oct 2022 00:49:58 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 3057D320098D; Tue, 18 Oct 2022 03:49:56 -0400 (EDT) Received: from imap51 ([10.202.2.101]) by compute3.internal (MEProxy); Tue, 18 Oct 2022 03:49:57 -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=1666079395; x=1666165795; bh=7Md4CAXWfA GPDZDdUlTOak4LwDabEftkVgALiP8DKrE=; b=U74au7xDHzjDjkdszgXEg1cw/P rvdynF2GR+Je+9j0iT5jHUlBauKTF+zBFHsHwAaQgTgPXTO6g1lGP75xiKd5Y3iS I8vA98XaJzA+BjhSszgEPPRXVRP6dpl6+aznmFcXRp12ROq2Wzz6PJ363ob8ETWT x+fvGhtUYlJo1K0ltyzIzqYX7gn2PP8clotriYOEyLsfH+rhCYIMgQk9MzPoV8RT 1ZxFXg5HSGfG7WCnS5L3VcnF8vLMgFpi7gA576sNZbCe+G8b3tveTLBp5X4zhwP4 e2zBuodHzGq8se34I70JZP3WZSyFvTcG1ud5yLC6avr9yL+OuxA5a5BbQQbQ== 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=1666079395; x=1666165795; bh=7Md4CAXWfAGPDZDdUlTOak4LwDab EftkVgALiP8DKrE=; b=Mbt5W75fgcE+L6232FNCIHzRDQHGFQqduTwF7BwEkAQW lJKIh0TlhFltcHN+t1N+ROURDqbxaxkW3kH/hU+nkGHvjJpejrtjuva+g34Ult7w sxwdXopO3VA9t+sOX64M+8ttitZQ2qNjUuSaWU4zdZzb/xtFgo8uRRivDVdgil9y ckIiCqMLcG/9FvWoh81ma9wBg1Q0/WHgZxCEtNFbvCb6bcL100ijB53ff1+UzuSs C6oYQcnub7d55Xa2JOMRFphdfvI2PM0xxWnLY7xI0CQSH299JWvA+zTb7Gif4gsv FpWhKNIwqCSH0fa49b/5vjS9Zx1mF6exdcQz3OB61Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeeltddguddviecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvvefutgesthdtredtreertdenucfhrhhomhepfdet rhhnugcuuegvrhhgmhgrnhhnfdcuoegrrhhnugesrghrnhgusgdruggvqeenucggtffrrg htthgvrhhnpeffheeugeetiefhgeethfejgfdtuefggeejleehjeeutefhfeeggefhkedt keetffenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe grrhhnugesrghrnhgusgdruggv X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 79AC6B60089; Tue, 18 Oct 2022 03:49:55 -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: In-Reply-To: References: <20221010101331.29942-1-parav@nvidia.com> <59d99be6-f79e-45bd-203c-17972255cc39@gmail.com> <12f51033-1461-43f9-8d8d-cd726fbb4758@app.fastmail.com> Date: Tue, 18 Oct 2022 09:49:34 +0200 From: "Arnd Bergmann" To: "Akira Yokosawa" , "Parav Pandit" Cc: "Bagas Sanjaya" , "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 9:40 AM, Akira Yokosawa wrote: > On Tue, 18 Oct 2022 08:44:09 +0200, Arnd Bergmann wrote: >> >> Anything weaker than a full "wmb()" probably makes the driver calling >> the writel() non-portable, so that is both vague and incorrect. > > Do you mean there is a writel() implementation somewhere in the kernel > which doesn't guarantee an implicit wmb() before MMIO write? There are lots of those, but that's not what I meant. E.g. on x86, writel() does not imply a full wmb() but still guarantees serialization between DMA and the register access. > Or do you mean my version is confusing because it can imply a weaker > write barrier is sufficient before writel_relaxed()? That's what I meant, yes. On a lot of architectures, it is sufficient to have something weaker than wmb() before writel_relaxed(), especially on anything that defines writel_relaxed() to be the same as writel(), any barrier would technically work. On arm32, using __iowmb() would be sufficient, and this can be less than a full wmb() but again it's obviously not portable. These details should not be needed in the documentation. Arnd