Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1006908pxb; Tue, 17 Aug 2021 01:14:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxgVExjRKJ+LkCR0/1Gn2p5oZjkATxNecevZC4NbXPdHiOoN9ACl4/wQ//sjeMaxvIqfH5J X-Received: by 2002:a92:6408:: with SMTP id y8mr1624994ilb.84.1629188075474; Tue, 17 Aug 2021 01:14:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629188075; cv=none; d=google.com; s=arc-20160816; b=HBTenstc5oo6cjwbV9sqmlp2lqDQqVLNWi0UGa/RutXxqMpM4KqMee8fwF//fs2+ev aKUv9VYkAmqXlI3/jJMfDGOkHqHsjU0fqaboeDD56o+g8tOUMuStu8p4V40urQe42BXE vuU0N85lu7zSrp1/fWfbQ2Jnv9mCwXFelgiwodVym6lGKEa2KI3X8rJV9YLg/v4N74Na M9MRDa27RGD1QBk/Ry943tLY/CDYApcCpW+ueUyP5oeykXipVpjrCHnKLgQMGVM46n+v 9DHxuKQpiqVi5YQiMN1HhH2aieBB9uYhL/eaPJtncnyY3CfSxz/6bnEB5aU1gWBbEUUM Js9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:subject:cc:to:from:message-id :date; bh=plYTELTLUI+Vn+NupYG5K3odq/9cHsRmcEyMqxDxhds=; b=Rc37wdljCsLYqQBGkwd/hSwMMPS9ASWiHzc7EQuLlLTyCdc1NU8rEyII5ijsrtdWBS RpTaQeSpbJ7hucNqeUxiwI3wAXagrFbDHAAjKag7G/SSER1S5vDonP4NvMruVFMqZZsx G6Fp2HEzXNAoMguXC7euyCRXwJnuq8itZSYwG9giYLvAsfq3rQLh88MVsvfCUZ8viCyM dtokJLeF4Dlh/cCaZfr6lMRW2WCZ3ryKEtVYTubBkzuD5SKqBRHbk3RjKIVvSmRutPfl PbfSGBzLngAKo5SoG7pEbL5PZYFuZd5ZgC5MGjzqCXE5wRgQYdbn7pbfeb17e9wlXjWW NNHQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b16si1630453ior.73.2021.08.17.01.14.24; Tue, 17 Aug 2021 01:14:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S239135AbhHQINX convert rfc822-to-8bit (ORCPT + 99 others); Tue, 17 Aug 2021 04:13:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:34522 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239134AbhHQINP (ORCPT ); Tue, 17 Aug 2021 04:13:15 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 61B9560F22; Tue, 17 Aug 2021 08:12:42 +0000 (UTC) Received: from 109-170-232-56.xdsl.murphx.net ([109.170.232.56] helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mFuDA-005TPf-JW; Tue, 17 Aug 2021 09:12:40 +0100 Date: Tue, 17 Aug 2021 09:12:40 +0100 Message-ID: <87sfz8zdzb.wl-maz@kernel.org> From: Marc Zyngier To: Arnd Bergmann Cc: Alyssa Rosenzweig , linux-pci , Bjorn Helgaas , Rob Herring , Lorenzo Pieralisi , Krzysztof =?UTF-8?B?V2lsY3p5xYRza2k=?= , Stan Skowronek , Mark Kettenis , Sven Peter , Hector Martin , DTML , Linux Kernel Mailing List Subject: Re: [RFC PATCH 2/2] PCI: apple: Add driver for the Apple M1 In-Reply-To: References: <20210815042525.36878-1-alyssa@rosenzweig.io> <20210815042525.36878-3-alyssa@rosenzweig.io> <87a6lj17d1.wl-maz@kernel.org> <87tujpyrxu.wl-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-SA-Exim-Connect-IP: 109.170.232.56 X-SA-Exim-Rcpt-To: arnd@kernel.org, alyssa@rosenzweig.io, linux-pci@vger.kernel.org, bhelgaas@google.com, robh+dt@kernel.org, lorenzo.pieralisi@arm.com, kw@linux.com, stan@corellium.com, kettenis@openbsd.org, sven@svenpeter.dev, marcan@marcan.st, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 17 Aug 2021 08:34:35 +0100, Arnd Bergmann wrote: > > On Mon, Aug 16, 2021 at 11:57 PM Marc Zyngier wrote: > > On Mon, 16 Aug 2021 02:31:40 +0100, Alyssa Rosenzweig wrote: > > > > > > Please use relaxed accessors. If the barriers are actually needed, > > > > please document what you are ordering against. This applies throughout > > > > the patch. > > > > > > Relaxed accessors are used throughout in v2... it Works For Me™ but no > > > guarantees I didn't introduce a race... > > > > That's not exactly what I wanted to read... You really need to make an > > informed decision on the need of barriers. If the MMIO write needs to > > be ordered after a main memory write (i.e. a memory write that is > > consumed by the device you are subsequently writing to), you then need > > a barrier. If, as I suspect, the device isn't DMA capable and doesn't > > require ordering with the rest of the memory accesses, then no > > barriers are required. > > My normal rule is to always use the normal accessors, and only use > any special variants if this is either required for correct operation > (e.g. heavy barriers on arm32 may call code that must not recursively > use heavy barriers) or that you have proven to /both/ be correct and > relevant for performance. IOW, don't use the relaxed accessors just > because it isn't wrong in your driver, other developers may copy the > code into a driver that can't do it. And that exactly the reason why I think we should *not* use heavy accessors if they are not required. I have little sympathy for blindly copied code, and spreading unnecessary barriers means that we cannot further reason about the actual ordering requirements. In other words, blanket use of heavy MMIO accessors to guarantee memory ordering is not dissimilar to reintroducing the BKL because we don't want people to worry about concurrency. M. -- Without deviation from the norm, progress is not possible.