From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv3 1/3] ARM: mm: allow sub-architectures to override PCI I/O memory type
Date: Mon, 19 May 2014 15:23:55 +0100 [thread overview]
Message-ID: <20140519142355.GD15130@arm.com> (raw)
In-Reply-To: <66413148.lBD9c9XUns@wuerfel>
On Mon, May 19, 2014 at 02:19:58PM +0100, Arnd Bergmann wrote:
> On Friday 16 May 2014 10:53:33 Will Deacon wrote:
> > On Thu, May 15, 2014 at 04:55:52PM +0100, Arnd Bergmann wrote:
> > > On Thursday 15 May 2014 16:34:30 Will Deacon wrote:
> > > > > If this is used to synchronize with a DMA, there is no guarantee that the
> > > > > transaction from PCI will be visible in memory by then.
> > > >
> > > > Can you elaborate on this scenario please? When would we use an I/O space
> > > > write to synchronise with a DMA transfer from a PCI endpoint? You're
> > > > definitely referring to I/O space as opposed to Configuration Space, right?
> > >
> > > Correct. Assume a PCI device uses PIO and DMA. It sends a DMA to main memory
> > > and lets the CPU know about the data using a level (IntA as opposed to MSI)
> > > interrupt. The CPU performs an outl() operation to an I/O port to let the
> > > hardware know it has received the IRQ and the response of the outl() is
> > > guaranteed to flush the DMA transaction: by the time the outl() completes
> > > we know that the data in memory is valid because it is strongly ordered
> > > relative to the DMA.
> >
> > Hmm, when you say `guaranteed to flush the DMA transaction', is that a PCI
> > requirement? If so, whether or not that DMA data is then visible to the CPU
> > is really specific to the host-controller implementation. It could easily be
> > buffered somewhere between the host controller and memory, for example.
>
> It's something that drivers are supposed to rely on, and the PCI host
> already has to make the same guarantee about ordering of MSI, MMIO-read
> and DMA transactions, all of which we definitely rely on in the kernel.
Supposed to rely on for x86, sure. I don't think we can even give you this
guarantee for arm64, where nE is nothing more than a *hint* to the memory
subsystem.
For the MSI case, I thought we had to go and poke the SCU for the Marvell
SoC?
> > > outl() actually does a dsb() internally, but unfortunately that is
> > > before the store, not after, so I assume that a driver relying on the
> > > behavior above would still be racy.
> >
> > Yup, we'd need an additional dsb. I think we're confusing what the PCI
> > specification says about ordering and what the inb/outb instructions provide
> > on x86. It may well be that we want to emulate the x86 behaviour on ARM, but
> > that's not going to come cheap and I don't think it's a decision we should
> > take lightly.
>
> outb() is expected to be an extremely heavyweight operation, that's why nobody
> uses it. Why would you care about whether it's one or two microsecond latency
> on a MIDI port or an ISDN adapter?
Fair enough -- I just don't think we should dress up an erratum workaround as
a bug fix, especially when it's adding a new user of strongly-ordered memory
to the kernel which we can't honour for arm64.
> We can decide that we don't care about correctness here, but the performance
> argument doesn't seem overly important.
In this case, I think that's true.
Will
WARNING: multiple messages have this Message-ID (diff)
From: Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org>
To: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
Cc: "linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
Thomas Petazzoni
<thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Russell King <linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>,
Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>,
Tawfik Bayouk <tawfik-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>,
Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>,
Catalin Marinas <Catalin.Marinas-5wv7dgnIgG8@public.gmane.org>,
Grant Likely
<grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>,
Albin Tonnerre <Albin.Tonnerre-5wv7dgnIgG8@public.gmane.org>,
Lior Amsalem <alior-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>,
Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Ezequiel Garcia
<ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
Gregory Clement
<gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
Nadav Haklai <nadavh-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>,
Sebastian Hesselbarth
<sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCHv3 1/3] ARM: mm: allow sub-architectures to override PCI I/O memory type
Date: Mon, 19 May 2014 15:23:55 +0100 [thread overview]
Message-ID: <20140519142355.GD15130@arm.com> (raw)
In-Reply-To: <66413148.lBD9c9XUns@wuerfel>
On Mon, May 19, 2014 at 02:19:58PM +0100, Arnd Bergmann wrote:
> On Friday 16 May 2014 10:53:33 Will Deacon wrote:
> > On Thu, May 15, 2014 at 04:55:52PM +0100, Arnd Bergmann wrote:
> > > On Thursday 15 May 2014 16:34:30 Will Deacon wrote:
> > > > > If this is used to synchronize with a DMA, there is no guarantee that the
> > > > > transaction from PCI will be visible in memory by then.
> > > >
> > > > Can you elaborate on this scenario please? When would we use an I/O space
> > > > write to synchronise with a DMA transfer from a PCI endpoint? You're
> > > > definitely referring to I/O space as opposed to Configuration Space, right?
> > >
> > > Correct. Assume a PCI device uses PIO and DMA. It sends a DMA to main memory
> > > and lets the CPU know about the data using a level (IntA as opposed to MSI)
> > > interrupt. The CPU performs an outl() operation to an I/O port to let the
> > > hardware know it has received the IRQ and the response of the outl() is
> > > guaranteed to flush the DMA transaction: by the time the outl() completes
> > > we know that the data in memory is valid because it is strongly ordered
> > > relative to the DMA.
> >
> > Hmm, when you say `guaranteed to flush the DMA transaction', is that a PCI
> > requirement? If so, whether or not that DMA data is then visible to the CPU
> > is really specific to the host-controller implementation. It could easily be
> > buffered somewhere between the host controller and memory, for example.
>
> It's something that drivers are supposed to rely on, and the PCI host
> already has to make the same guarantee about ordering of MSI, MMIO-read
> and DMA transactions, all of which we definitely rely on in the kernel.
Supposed to rely on for x86, sure. I don't think we can even give you this
guarantee for arm64, where nE is nothing more than a *hint* to the memory
subsystem.
For the MSI case, I thought we had to go and poke the SCU for the Marvell
SoC?
> > > outl() actually does a dsb() internally, but unfortunately that is
> > > before the store, not after, so I assume that a driver relying on the
> > > behavior above would still be racy.
> >
> > Yup, we'd need an additional dsb. I think we're confusing what the PCI
> > specification says about ordering and what the inb/outb instructions provide
> > on x86. It may well be that we want to emulate the x86 behaviour on ARM, but
> > that's not going to come cheap and I don't think it's a decision we should
> > take lightly.
>
> outb() is expected to be an extremely heavyweight operation, that's why nobody
> uses it. Why would you care about whether it's one or two microsecond latency
> on a MIDI port or an ISDN adapter?
Fair enough -- I just don't think we should dress up an erratum workaround as
a bug fix, especially when it's adding a new user of strongly-ordered memory
to the kernel which we can't honour for arm64.
> We can decide that we don't care about correctness here, but the performance
> argument doesn't seem overly important.
In this case, I think that's true.
Will
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2014-05-19 14:23 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-15 9:18 [PATCHv3 0/3] ARM: implement workaround for Cortex-A9/PL310/PCIe deadlock Thomas Petazzoni
2014-05-15 9:18 ` Thomas Petazzoni
2014-05-15 9:18 ` [PATCHv3 1/3] ARM: mm: allow sub-architectures to override PCI I/O memory type Thomas Petazzoni
2014-05-15 9:18 ` Thomas Petazzoni
2014-05-15 13:21 ` Arnd Bergmann
2014-05-15 13:21 ` Arnd Bergmann
2014-05-15 13:51 ` Thomas Petazzoni
2014-05-15 13:51 ` Thomas Petazzoni
2014-05-15 14:29 ` Will Deacon
2014-05-15 14:29 ` Will Deacon
2014-05-15 14:32 ` Arnd Bergmann
2014-05-15 14:32 ` Arnd Bergmann
2014-05-15 15:34 ` Will Deacon
2014-05-15 15:34 ` Will Deacon
2014-05-15 15:55 ` Arnd Bergmann
2014-05-15 15:55 ` Arnd Bergmann
2014-05-16 9:53 ` Will Deacon
2014-05-16 9:53 ` Will Deacon
2014-05-19 13:19 ` Arnd Bergmann
2014-05-19 13:19 ` Arnd Bergmann
2014-05-19 14:23 ` Will Deacon [this message]
2014-05-19 14:23 ` Will Deacon
2014-05-19 16:40 ` Arnd Bergmann
2014-05-19 16:40 ` Arnd Bergmann
2014-05-19 16:50 ` Will Deacon
2014-05-19 16:50 ` Will Deacon
2014-05-19 17:04 ` Arnd Bergmann
2014-05-19 17:04 ` Arnd Bergmann
2014-05-21 5:20 ` Jason Gunthorpe
2014-05-21 5:20 ` Jason Gunthorpe
2014-05-21 8:20 ` Arnd Bergmann
2014-05-21 8:20 ` Arnd Bergmann
2014-05-15 17:53 ` Jason Gunthorpe
2014-05-15 17:53 ` Jason Gunthorpe
2014-05-16 9:57 ` Will Deacon
2014-05-16 9:57 ` Will Deacon
2014-05-16 15:33 ` Jason Gunthorpe
2014-05-16 15:33 ` Jason Gunthorpe
2014-05-15 9:18 ` [PATCHv3 2/3] ARM: mm: add support for HW coherent systems in PL310 Thomas Petazzoni
2014-05-15 9:18 ` Thomas Petazzoni
2014-05-15 9:36 ` Catalin Marinas
2014-05-15 9:36 ` Catalin Marinas
2014-05-15 11:39 ` Thomas Petazzoni
2014-05-15 11:39 ` Thomas Petazzoni
2014-05-15 13:23 ` Arnd Bergmann
2014-05-15 13:23 ` Arnd Bergmann
2014-05-15 13:35 ` Rob Herring
2014-05-15 13:35 ` Rob Herring
2014-05-15 13:46 ` Thomas Petazzoni
2014-05-15 13:46 ` Thomas Petazzoni
2014-05-15 9:18 ` [PATCHv3 3/3] ARM: mvebu: implement L2/PCIe deadlock workaround Thomas Petazzoni
2014-05-15 9:18 ` Thomas Petazzoni
2014-05-15 9:36 ` Catalin Marinas
2014-05-15 9:36 ` Catalin Marinas
2014-05-15 13:21 ` Jason Cooper
2014-05-15 13:21 ` Jason Cooper
2014-05-15 13:50 ` Thomas Petazzoni
2014-05-15 13:50 ` Thomas Petazzoni
2014-05-15 15:31 ` Jason Cooper
2014-05-15 15:31 ` Jason Cooper
2014-05-16 7:19 ` Thomas Petazzoni
2014-05-16 7:19 ` Thomas Petazzoni
2014-05-15 13:26 ` Arnd Bergmann
2014-05-15 13:26 ` Arnd Bergmann
2014-05-15 14:22 ` Thomas Petazzoni
2014-05-15 14:22 ` Thomas Petazzoni
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=20140519142355.GD15130@arm.com \
--to=will.deacon@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.