public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: "Woodruff, Richard" <r-woodruff2@ti.com>,
	Paul Walmsley <paul@pwsan.com>,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
	"linux-arm-kernel@lists.arm.linux.org.uk"
	<linux-arm-kernel@lists.arm.linux.org.uk>
Subject: Re: [PATCH] ARM MMU: add strongly-ordered memory type
Date: Thu, 07 Aug 2008 17:01:29 +0100	[thread overview]
Message-ID: <1218124889.7718.22.camel@pc1117.cambridge.arm.com> (raw)
In-Reply-To: <20080807073035.GA10255@flint.arm.linux.org.uk>

On Thu, 2008-08-07 at 08:30 +0100, Russell King - ARM Linux wrote:
> What we don't do is mark DMA memory ask being normal uncached memory,
> thereby allowing that to be reordered with device accesses - we make
> it strongly ordered.  The reason being that the kernel doesn't have
> barriers necessary to ensure that writes to DMA memory hit physical
> memory before the device access to enable DMA hits the DMA controller.

We have mb() and related which provides the ordering (there is also
mmiowb() but my understanding is that we don't need this on ARM).

http://lwn.net/Articles/283776/

> Those kinds of bugs can be absolute hell to track down - think about
> a DMA controller accessing an uninitialised DMA descriptor, resulting
> in it scribbing over random bits of memory.

Yes, indeed, but ARM is not the only architecture with a weak memory
ordering model so drivers should be fixed, in theory.

> Linux presently - and quite rightly - assumes that accesses to DMA
> coherent memory _are_ coherent with DMA.  If not, the API would be
> a joke.

As I understand it, the DMA mapping doesn't guarantee any ordering,
drivers must use barriers. According to Documentation/DMA-mapping.txt:

- Consistent DMA mappings which are usually mapped at driver
  initialization, unmapped at the end and for which the hardware should
  guarantee that the device and the CPU can access the data
  in parallel and will see updates made by each other without any
  explicit software flushing.

[...]

  IMPORTANT: Consistent DMA memory does not preclude the usage of
             proper memory barriers.  The CPU may reorder stores to
	     consistent memory just as it may normal memory.

-- 
Catalin


  reply	other threads:[~2008-08-07 16:02 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-04 23:40 [PATCH] ARM MMU: add strongly-ordered memory type Paul Walmsley
2008-08-05 11:49 ` Ben Dooks
2008-08-05 12:15   ` Woodruff, Richard
2008-08-06 10:20     ` Catalin Marinas
2008-08-06 12:28       ` Woodruff, Richard
2008-08-07 16:55         ` Catalin Marinas
2008-08-07  6:01       ` Paul Walmsley
2008-08-07 16:45         ` Catalin Marinas
2008-08-08  8:45           ` Paul Walmsley
2008-08-06  9:53 ` Catalin Marinas
2008-08-06 12:21   ` Woodruff, Richard
2008-08-07  7:30     ` Russell King - ARM Linux
2008-08-07 16:01       ` Catalin Marinas [this message]
2008-08-07 18:56       ` Woodruff, Richard
2008-08-07 19:25         ` Russell King - ARM Linux
2008-08-07 20:38           ` Woodruff, Richard
2008-08-07 21:20             ` Russell King - ARM Linux
2008-08-07 21:59               ` Russell King - ARM Linux
2008-08-07 23:07               ` Woodruff, Richard
2008-08-08  7:16                 ` Russell King - ARM Linux
2008-08-08 11:44               ` Catalin Marinas
2008-08-08 13:19                 ` Russell King - ARM Linux
2008-08-08 16:40                   ` Catalin Marinas
2008-08-11  7:50                 ` Paul Walmsley

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=1218124889.7718.22.camel@pc1117.cambridge.arm.com \
    --to=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=paul@pwsan.com \
    --cc=r-woodruff2@ti.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