linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* Speeding up dma_unmap
@ 2016-01-27  8:32 Jason Holt
  2016-01-27 11:22 ` Ard Biesheuvel
  2016-01-27 12:23 ` Arnd Bergmann
  0 siblings, 2 replies; 8+ messages in thread
From: Jason Holt @ 2016-01-27  8:32 UTC (permalink / raw)
  To: linux-arm-kernel

I'm new to the DMA API and looking for a sanity check.

As I understand it, dma_unmap_* is slow (for data coming from a device
to the CPU) on some ARM CPUs because the *_inv_range() functions have
to iterate in cache line sized steps through the entire buffer,
telling the cache controller "invalidate this if you have it".

For buffers larger than the size of the data cache, might it be faster
to go the other direction and check each line of the cache to see if
it's inside the buffer, then invalidate it if it is?  (I believe the
buffer must be contiguous in physical memory, so I assume that'd be a
simple bottom < x < top check).

So for a 256K L2 cache and 4MB buffer, we'd only have to check 256K
worth of cache lines instead of 4MB when we unmap.

Failing that, I suppose a very dirty hack would be to
data_cache_clean_and_invalidate if the only thing I cared about was
getting data from my DMA peripheral as fast as possible.  (I'm on
AM335X and seeing no more than 200MB/s from device to CPU with
dma_unmap_single, whereas the PRUs can write to main memory at
600MB/s.)

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

end of thread, other threads:[~2016-01-28 11:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-27  8:32 Speeding up dma_unmap Jason Holt
2016-01-27 11:22 ` Ard Biesheuvel
2016-01-27 12:23 ` Arnd Bergmann
2016-01-27 16:06   ` Catalin Marinas
2016-01-27 18:09     ` Russell King - ARM Linux
2016-01-28 10:31       ` Catalin Marinas
2016-01-28 11:20         ` Arnd Bergmann
2016-01-28 11:49           ` Catalin Marinas

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).