From: catalin.marinas@arm.com (Catalin Marinas)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: mm: dma: Update coherent streaming apis with missing memory barrier
Date: Thu, 24 Apr 2014 11:13:56 +0100 [thread overview]
Message-ID: <20140424101355.GD8521@arm.com> (raw)
In-Reply-To: <20140424091624.GG26756@n2100.arm.linux.org.uk>
On Thu, Apr 24, 2014 at 10:16:24AM +0100, Russell King - ARM Linux wrote:
> On Thu, Apr 24, 2014 at 10:09:27AM +0100, Catalin Marinas wrote:
> > If we only do D-cache maintenance by MVA, the ARM ARM (both v7 and v8)
> > claims that these are ordered relative to any explicit load/stores to
> > the same address. So in theory we don't even need a DMB for unmapping
> > with DMA_FROM_DEVICE. But in practice, we may have the outer cache,
> > hence a DSB is required before the outer_sync() (we could move it there
> > though).
>
> The general usecase for outer_sync() is: dsb(); outer_sync(); Why would
> we want to change this to dsb(); dmb(); outer_sync(); (where the dmb is
> in outer_sync itself?)
>
> Seems more sensible for it to stay at the outer_sync() call site where
> it's needed.
You are right, it gets worse for the wmb() case if we change
outer_sync(), I was thinking about cache maintenance.
An optimisation would be for functions like v7_dma_inv_range() to no
longer have the dsb but move it to the __dma_page_cpu_to_dev() before
the outer_*_range() ops. If we assume that a streaming DMA is started by
a writel() access which has a dsb already, in the absence of outer cache
we wouldn't need any dsb at all, hence something like a conditional
sync_for_outer() barrier (dsb if outer cache or no-op otherwise) in
__dma_page_cpu_to_dev().
In the __dma_page_dev_to_cpu() we wouldn't need any dsb at all for cache
maintenance since subsequent accesses to the same address are ordered by
the hardware (and outer cache maintenance is done before the inner
anyway).
(that's from an ARMv7 perspective, we need to check ordering on earlier
architectures)
--
Catalin
next prev parent reply other threads:[~2014-04-24 10:13 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-21 18:03 [PATCH] ARM: mm: dma: Update coherent streaming apis with missing memory barrier Santosh Shilimkar
2014-04-22 10:28 ` Will Deacon
2014-04-22 13:49 ` Santosh Shilimkar
2014-04-22 14:08 ` Arnd Bergmann
2014-04-22 14:36 ` Santosh Shilimkar
2014-04-22 19:53 ` Arnd Bergmann
2014-04-22 19:58 ` Santosh Shilimkar
2014-04-22 20:23 ` Arnd Bergmann
2014-04-22 20:30 ` Santosh Shilimkar
2014-04-23 9:02 ` Will Deacon
2014-04-23 16:02 ` Catalin Marinas
2014-04-23 17:17 ` Will Deacon
2014-04-23 18:37 ` Russell King - ARM Linux
2014-04-23 18:58 ` Arnd Bergmann
2014-04-23 19:04 ` Russell King - ARM Linux
2014-04-24 10:47 ` Catalin Marinas
2014-04-24 11:15 ` Russell King - ARM Linux
2014-04-24 11:21 ` Will Deacon
2014-04-24 13:38 ` Santosh Shilimkar
2014-04-24 14:09 ` Will Deacon
2014-04-24 14:44 ` Santosh Shilimkar
2014-04-24 19:12 ` Russell King - ARM Linux
2014-04-23 19:34 ` Jason Gunthorpe
2014-04-24 10:58 ` Will Deacon
2014-04-24 12:12 ` Arnd Bergmann
2014-04-24 12:37 ` Will Deacon
2014-04-24 9:54 ` Catalin Marinas
2014-04-24 11:13 ` Russell King - ARM Linux
2014-04-24 9:09 ` Catalin Marinas
2014-04-24 9:16 ` Russell King - ARM Linux
2014-04-24 10:13 ` Catalin Marinas [this message]
2014-05-02 21:33 ` Joel Fernandes
2014-05-06 10:01 ` Will Deacon
2014-04-22 15:07 ` Catalin Marinas
2014-04-22 15:18 ` Santosh Shilimkar
2014-04-22 15:30 ` Catalin Marinas
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=20140424101355.GD8521@arm.com \
--to=catalin.marinas@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 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).