linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Sinan Kaya <okaya@kernel.org>
Cc: John Garry <john.garry@huawei.com>,
	"xuwei (O)" <xuwei5@hisilicon.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Jiaxun Yang <jiaxun.yang@flygoat.com>,
	linux-arch <linux-arch@vger.kernel.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	Will Deacon <will@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>
Subject: Re: About commit "io: change inX() to have their own IO barrier overrides"
Date: Fri, 6 Mar 2020 08:54:26 +0100	[thread overview]
Message-ID: <CAK8P3a2Grd0JsBNsB19oAxrAFtOdpvjrpGcfeArKe7zD_jrUZw@mail.gmail.com> (raw)
In-Reply-To: <90af535f-00ef-c1e3-ec20-aae2bd2a0d88@kernel.org>

On Fri, Mar 6, 2020 at 4:44 AM Sinan Kaya <okaya@kernel.org> wrote:
>
> On 3/3/2020 11:40 AM, Arnd Bergmann wrote:
> >> -          ret = read##bw(PCI_IOBASE + addr);
> >> +          __io_pbr();
> >> +          ret = __raw_read##bw(PCI_IOBASE + addr);
> >> +          __io_pbr();
> > __io_par();
> >
>
> Why do we need to change read##bw above?
>
> read##bw already provides strong ordering guarantees across multiple
> architectures.

The exact semantics of inl() and readl() are slightly different, so they
have distinct sets of barriers in the asm-generic/io.h implementation.

For instance, the arm64 architectures defines in_par() as '__iormb(v)',
but defines __io_ar() as a  '__rmb()'. Similarly, riscv defines them
as "fence i,ior" and "fence i,r".

You could argue that the definitions are wrong (I have not checked the
history of the definitions), but as long as the inb() in asm-generic/io.h
uses those, the implementation in lib/logic_pio.c uses the same ones
to make the two behave the same way.

       Arnd

  reply	other threads:[~2020-03-06  7:54 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-28  9:52 About commit "io: change inX() to have their own IO barrier overrides" John Garry
2020-02-28 23:57 ` Sinan Kaya
2020-03-02 12:35   ` John Garry
2020-03-02 16:44     ` Sinan Kaya
2020-03-03 13:18       ` John Garry
2020-03-03 16:40         ` Arnd Bergmann
2020-03-03 17:16           ` John Garry
2020-03-06  3:44           ` Sinan Kaya
2020-03-06  7:54             ` Arnd Bergmann [this message]
2020-03-06 10:39               ` John Garry
2020-03-06 15:16                 ` Arnd Bergmann
2020-03-06 16:18                   ` John Garry
2020-03-06 16:29                     ` Arnd Bergmann
2020-03-06 16:43                       ` John Garry
2020-03-11 16:12                         ` John Garry
2020-03-06 21:15               ` Sinan Kaya

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAK8P3a2Grd0JsBNsB19oAxrAFtOdpvjrpGcfeArKe7zD_jrUZw@mail.gmail.com \
    --to=arnd@arndb.de \
    --cc=bhelgaas@google.com \
    --cc=catalin.marinas@arm.com \
    --cc=jiaxun.yang@flygoat.com \
    --cc=john.garry@huawei.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=okaya@kernel.org \
    --cc=will@kernel.org \
    --cc=xuwei5@hisilicon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).