Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp987204pxb; Tue, 17 Aug 2021 00:38:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZlhIHtvP/RmNA+mhA4el0AEhnzZF9Rj/RJv+gg0GBN09zB+Ru0J4JJnK3a+AYTZYZcWio X-Received: by 2002:a05:6402:1d19:: with SMTP id dg25mr2608882edb.153.1629185913240; Tue, 17 Aug 2021 00:38:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629185913; cv=none; d=google.com; s=arc-20160816; b=G5AgmM5a2agarkjsTMMuVUmQyeUsuVIYapWf5IpkVAMEHyyFmOgJyN8NmmsF1aCwR/ 65xxr5Qj+VjByZEKspeWnTRzdoDba0cRcZBQwdHoG/yBp0ugY4sc3nwCgD1Tj4qFngng f5JMylZazIL94pi6l9HY2YR7kSW0JNSvcXoOPVHolulq4MkmOSSeLvoAEMNQ2wWLIf7w TBKlu40DP5chNtoMrIXnd+mJAMlvewr9Ff5Nou3WyFyiwZwlyOUkmzOgfUKBOw6lWXZK PBv5pr9y1TESVZ3KNYofANyn+IXEtnbJpbQg5UXKd4GrykEWFHnOriolDIZvox+k6ULc bM4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=kAxzNVoFxArrz3cCJ/czyE5D3teTd9yPaUSs/zCcd34=; b=LHuG92x4tR1r57NixLEiUYLYCRPAHfNTZbXg5NZ31SrmQC63Y9BJmy2F0wb4jQtVGK 6PzPqIwMeNJSdlhyRKhyki3hU1Ihv3JtCOPsofBUcPqwvzS1qs/1WGceQmF7llWrYDpZ Typ1/aWTfGikhqLMqabPlXDe5J5WiqBxyElTp7Ie3cATMZ5sKWGqhcjFWCdlbGSLDun7 za/j+mHQ8g04MmHY5q0DXbzl/MbLpRa7T35/q8O4dWiyOCm7NESW+G0SdvVTpbAkDvzJ 6UGF57f11b+bydbDRAc+6LLYz4Vke9gLB9SOJzzeTu9VD2HfINP3idh92Kv+buD1tTUc ERRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OXr83AwR; 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 dn18si1412631edb.220.2021.08.17.00.38.10; Tue, 17 Aug 2021 00:38:33 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OXr83AwR; 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 S238067AbhHQHf0 (ORCPT + 99 others); Tue, 17 Aug 2021 03:35:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:52188 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234601AbhHQHf0 (ORCPT ); Tue, 17 Aug 2021 03:35:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2B59060FA0; Tue, 17 Aug 2021 07:34:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629185693; bh=SemVCuGqjhzqig8PxA4tle98CZxitX+M8IpUnKNEyUA=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=OXr83AwRHiFqs1oqVG1TVqjHBFonZfn/qj2J0TnkQlvi1H+VSJEZBjtKrVjpSr+65 NarL9M7xI5huBerrqXPxOJHPD6AD3fjQPLqZHoUDgwFt0I5wdJzV5vOw71uZnCGXuM AgsxghosI/L4IklLbZWc78qF7jDaeVJhiOZ3RhKhC0VsbLXVD6o2Yg4oZYy83frnBp L9DhJo4UbsBlPfLGPtNzVYHgS+QPbr1HCUq/l/KJAitZt1GAY2NRwc9F97w/RxlJeG WyBgQwS7Zhs8MNGt04x7dma09CqjE8n2WkKfc3/eumPiP7kYPxTlmVxYIRPmfcI7rJ SEgioVVlQv2ww== Received: by mail-wr1-f52.google.com with SMTP id r7so27248897wrs.0; Tue, 17 Aug 2021 00:34:53 -0700 (PDT) X-Gm-Message-State: AOAM531gf/T9OnTdWH3bIp+U0mL3USD26k7kCm6Za/6AutTXGVqDTpFe WZ+KUGTLHyvseQ+0ckwo2w00eNuXTC+EddfhqxU= X-Received: by 2002:adf:f202:: with SMTP id p2mr2327557wro.361.1629185691739; Tue, 17 Aug 2021 00:34:51 -0700 (PDT) MIME-Version: 1.0 References: <20210815042525.36878-1-alyssa@rosenzweig.io> <20210815042525.36878-3-alyssa@rosenzweig.io> <87a6lj17d1.wl-maz@kernel.org> <87tujpyrxu.wl-maz@kernel.org> In-Reply-To: <87tujpyrxu.wl-maz@kernel.org> From: Arnd Bergmann Date: Tue, 17 Aug 2021 09:34:35 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH 2/2] PCI: apple: Add driver for the Apple M1 To: Marc Zyngier Cc: Alyssa Rosenzweig , linux-pci , Bjorn Helgaas , Rob Herring , Lorenzo Pieralisi , =?UTF-8?Q?Krzysztof_Wilczy=C5=84ski?= , Stan Skowronek , Mark Kettenis , Sven Peter , Hector Martin , DTML , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 throughou= t > > > the patch. > > > > Relaxed accessors are used throughout in v2... it Works For Me=E2=84=A2= 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. Arnd