From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 1/3] ARM: Introduce atomic MMIO modify
Date: Fri, 30 Aug 2013 23:18:32 +0100 [thread overview]
Message-ID: <20130830221832.GC6617@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <20130830200830.GB6368@obsidianresearch.com>
On Fri, Aug 30, 2013 at 02:08:30PM -0600, Jason Gunthorpe wrote:
> On Fri, Aug 30, 2013 at 11:03:42AM +0100, Catalin Marinas wrote:
>
> > > Perhaps we should just bit the bullet and define relaxed accessors for all
> > > architectures? It's not difficult to default them to the non-relaxed
> > > variants if the architecture doesn't provide an optimised implementation.
> >
> > Yes, an asm-generic default relaxed would be good (that's what I
> > suggested earlier in this thread and it was discussed in the past). But
> > no-one volunteered ;).
>
> Something I've always been confused about..
>
> Do these _relaxed operators on ARM differ from the PCI-X definition of
> relaxed ordering, and are they expected to generate a PCI TLP with
> the relaxed ordering bit set?
It's more to do with the memory model. The _relaxed IO accessors just
read/write to the desired IO location without any ordering with respect
to memory - so if you have for instance DMA coherent memory, and you've
written a set of descriptors to that memory, there is no implicit
guarantee that those writes will be visible to the DMA engine if you
enable it using a relaxed operator unless you use an appropriate barrier
between the two.
Conversely, reading a register and then accessing memory, there is no
guarantee that you will have read the register before the memory access
has been performed with the relaxed IO.
The standard IO operations (readl, writel) contain barriers which ensure
correct ordering - the write*() have a barrier before their write, and
the read*() have a barrier after their read. This ensures correct and
expected ordering with DMA coherent memory.
However, those barriers can be very expensive - they end up having to
themselves issue a write to the L2 cache controller (which obviously
can't use the standard IO operations).
> AFAIK, on x86 read_relaxed is expected to cause the PCI behavior.
> Documentation/DocBook/deviceiobook.tmpl seems to confirm this.
I guess our read* is compatible with that (even though it has nothing
to do with PCI) - the issues in Docbook appear to suggest similar
behaviours from the CPU point of view - IOW, the visibility of DMA vs
the read transaction. The write is just an extension of that.
next prev parent reply other threads:[~2013-08-30 22:18 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-23 10:24 [PATCH v3 0/3] Introduce atomic MMIO register modify Ezequiel Garcia
2013-08-23 10:24 ` [PATCH v3 1/3] ARM: Introduce atomic MMIO modify Ezequiel Garcia
2013-08-23 10:38 ` Baruch Siach
2013-08-23 11:07 ` Ezequiel Garcia
2013-08-23 11:32 ` Ezequiel Garcia
2013-08-23 11:48 ` Catalin Marinas
2013-08-30 9:08 ` Will Deacon
2013-08-30 9:15 ` Catalin Marinas
2013-08-30 9:20 ` Will Deacon
2013-08-30 10:03 ` Catalin Marinas
2013-08-30 20:08 ` Jason Gunthorpe
2013-08-30 22:18 ` Russell King - ARM Linux [this message]
2013-09-05 8:59 ` Gregory CLEMENT
2013-09-05 9:08 ` Will Deacon
2013-09-05 9:20 ` Gregory CLEMENT
2013-09-06 16:48 ` Jason Gunthorpe
2013-08-23 11:28 ` Ezequiel Garcia
2013-08-23 10:24 ` [PATCH v3 2/3] clocksource: orion: Use atomic access for shared registers Ezequiel Garcia
2013-08-23 10:38 ` Baruch Siach
2013-08-23 10:49 ` Ezequiel Garcia
2013-08-23 10:24 ` [PATCH v3 3/3] watchdog: " Ezequiel Garcia
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=20130830221832.GC6617@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--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 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).