From: Russell King <rmk+lkml@arm.linux.org.uk>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>,
David Miller <davem@davemloft.net>,
clameter@sgi.com, hugh@veritas.com, James.Bottomley@steeleye.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Containment measures for slab objects on scatter gather lists
Date: Sat, 30 Jun 2007 08:54:29 +0100 [thread overview]
Message-ID: <20070630075429.GA26051@flint.arm.linux.org.uk> (raw)
In-Reply-To: <20070630001138.6caeb745@the-village.bc.nu>
On Sat, Jun 30, 2007 at 12:11:38AM +0100, Alan Cox wrote:
> > DMA to or from memory should be done via the DMA mapping API. If we're
> > DMAing to/from a limited range within a page, either we should be using
> > dma_map_single(), or dma_map_page() with an appropriate offset and size.
>
> If those ranges overlap a cache line then the dma mapping API will not
> save your backside.
There's nothing much that the DMA API can do though. Consider DMA
to a result buffer which is, eg, only 16 bytes in size. So you get
passed a size of '16' to the DMA API. What should you do at this
point? BUG()?
What if you have 64 or 128 byte cache lines?
> > sizes, but they do happen. We handle this on ARM by writing back
> > the overlapped lines and invalidating the rest before the DMA operation
> > commences, and hope that the overlapped lines aren't touched for the
> > duration of the DMA.)
>
> The combination of "hope" and "DMA" isn't a good one for stable system
> design. In this situation we should be waving large red flags
I agree.
However, I don't think this is an issue for the DMA API to handle; it's
something that driver authors need to be aware of. If they wish to do
a DMA to a kmalloc'd buffer or even a page, we could require that
offsets and sizes are cache line aligned.
However, remember that turning on slab debugging turns off cache line
alignment, so imposing such a requirement implies that the slab
debugging will break DMA, or driver authors also have to be aware of
that and do their own alignment internally, *or* we provide an allocator
which does unconditionally align.
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of:
next prev parent reply other threads:[~2007-06-30 7:55 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-29 4:01 [PATCH] Containment measures for slab objects on scatter gather lists Christoph Lameter
2007-06-29 4:10 ` David Miller
2007-06-29 4:22 ` Christoph Lameter
2007-06-29 4:28 ` David Miller
2007-06-29 4:39 ` Christoph Lameter
2007-06-29 5:06 ` David Miller
2007-06-29 5:24 ` Andrew Morton
2007-06-29 5:37 ` David Miller
2007-06-29 5:45 ` Andrew Morton
2007-06-29 6:51 ` Christoph Lameter
2007-06-29 12:16 ` Alan Cox
2007-06-29 20:45 ` Andrew Morton
2007-06-29 21:14 ` Russell King
2007-06-29 23:11 ` Alan Cox
2007-06-30 7:54 ` Russell King [this message]
2007-06-29 22:39 ` Alan Cox
2007-06-29 6:50 ` Christoph Lameter
2007-06-30 8:49 ` Christoph Hellwig
2007-06-29 7:00 ` Christoph Lameter
2007-06-29 9:06 ` David Miller
2007-06-29 13:04 ` Hugh Dickins
2007-06-29 14:15 ` Christoph Lameter
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=20070630075429.GA26051@flint.arm.linux.org.uk \
--to=rmk+lkml@arm.linux.org.uk \
--cc=James.Bottomley@steeleye.com \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=clameter@sgi.com \
--cc=davem@davemloft.net \
--cc=hugh@veritas.com \
--cc=linux-kernel@vger.kernel.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