public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: PCI DMA to small buffers on cache-incoherent arch
@ 2002-06-11  5:31 David Brownell
  2002-06-11  5:44 ` David S. Miller
  0 siblings, 1 reply; 26+ messages in thread
From: David Brownell @ 2002-06-11  5:31 UTC (permalink / raw)
  To: David S. Miller; +Cc: linux-kernel

> From: Roland Dreier <roland@topspin.com>
> Date: 10 Jun 2002 21:39:27 -0700
> 
>        David> How about allocating struct something using pci_pool?
>    
>    The problem is the driver can't safely touch field1 or field2 near the
>    DMA (it might pull the cache line back in too soon, or dirty the cache
>    line and have it written back on top of DMA'ed data)
> 
> Oh duh, I see, then go to making the thing a pointer to the
> dma area.

If it's going to be a pointer, it might as well be normal kmalloc data,
avoiding obfuscation of the memory model used by USB device drivers.
(They don't have to worry about DMA addresses, which IMO is a feature.)

Seems like there are two basic options for how to handle all this.

(a) Expose the dma/cache interaction to device drivers, so
     they can manage (and prevent) bad ones like the cacheline
     sharing scenarios.

(b) Require drivers to provide I/O buffers that are slab/page/...
     pointers from some API that prevents such problems.

I think (a) is more or less a variant of the existing alignment
requirements that get embedded in ABIs, but which still show up
in code that's very close to the hardware.  Many device driver
folk are familiar with them, or performance tuners, but not so
many folk doing USB device drivers would be.  (They are thankfully
far from host controller hardware and its quirks!)

Personally I'd avoid (b) since I like to allocate memory all at
once in most cases ... lots fewer error cases to cope with (or,
more typically _not_ cope with :).

One question is whether to support only one of them, or allow both.
In either case the DMA-mapping.txt will need to touch on the issue.

- Dave





^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2002-06-13  9:43 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-06-11  5:31 PCI DMA to small buffers on cache-incoherent arch David Brownell
2002-06-11  5:44 ` David S. Miller
2002-06-11 15:12   ` David Brownell
2002-06-11 15:44     ` Oliver Neukum
2002-06-12  3:25     ` David S. Miller
2002-06-11 17:33       ` Benjamin Herrenschmidt
2002-06-12  9:42         ` David S. Miller
2002-06-12 14:14           ` David Brownell
2002-06-12 15:00             ` Benjamin Herrenschmidt
2002-06-12 18:44             ` Roland Dreier
2002-06-12 19:13               ` David Brownell
2002-06-12 19:58                 ` Oliver Neukum
2002-06-12 22:51                   ` David S. Miller
2002-06-12 23:17                     ` Oliver Neukum
2002-06-13  4:57                   ` David Brownell
2002-06-12 22:46                 ` David S. Miller
2002-06-13  5:13                   ` David Brownell
2002-06-13  9:38                     ` David S. Miller
2002-06-12 22:50                 ` David S. Miller
2002-06-13  0:23                 ` [PATCH] 2.4 add __dma_buffer alignment macro Roland Dreier
2002-06-13  1:07                   ` David S. Miller
2002-06-13  1:19                     ` Roland Dreier
2002-06-12  6:25       ` PCI DMA to small buffers on cache-incoherent arch David Brownell
2002-06-12  6:24         ` David S. Miller
2002-06-12  7:06           ` David Brownell
2002-06-12  9:22             ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox