Re: PCI DMA to small buffers on cache-incoherent arch

Roland Dreier
2002-06-09T00:40:29Z

>>>>> "David" == David S Miller <davem@redhat.com> writes:

David> There is no allocation scheme legal for PCI DMA which gives
David> you smaller than a cacheline of data, this includes SLAB.
David> This is why stack buffers and the like are illegal for PCI
David> DMA.

David> If the architecture allows SLAB to give smaller than
David> cacheline sized data, it must handle PCI DMA map/unmap
David> flushing in an appropriate fashion (ie. handle
David> sub-cacheline buffers).

Thanks, that's great information. However, there is one question you
didn't cover. How about using a sub-cache-line piece of a kmalloc()'ed
buffer (eg the case I described of using one member from a struct as a
DMA buffer)? As far as I can see there is no guarantee that this will
always work. Do you agree that this should be treated as a bug and
fixed when it is found? Or should we leave that usage unless it is
observed causing problems (since we almost always get lucky and don't
touch the rest of the cache line near the DMA)?

Thanks,
Roland