linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [Question] cacheline sharing problem on DMA for custom outer-cache
@ 2016-01-15  2:36 Masahiro Yamada
  2016-01-15  8:33 ` Arnd Bergmann
  0 siblings, 1 reply; 5+ messages in thread
From: Masahiro Yamada @ 2016-01-15  2:36 UTC (permalink / raw)
  To: linux-arm-kernel

Hi.


Documentation/DMA-API-HOWTO.txt states as follows.

--------------->8---------------------
Even if those classes of
memory could physically work with DMA, you'd need to ensure the I/O
buffers were cacheline-aligned.  Without that, you'd see cacheline
sharing problems (data corruption) on CPUs with DMA-incoherent caches.
(The CPU could write to one word, DMA would write to a different one
in the same cache line, and one of them could be overwritten.)
---------------8<-----------------------


The UniPhier SoC series (ARM SoC) uses
its own custom outer-cache, not the one from ARM Ltd.
(arch/arm/mm/cache-uniphier.c)

Its line-size is 128 byte.


As far as I tested on my board, the memory allocated by kmalloc()
is 64byte-aligned.
(the kernel image is configured with multi_v7_defconfig)


For example,
  a = kmalloc(1, GFP_KERNEL);
  b = kmalloc(1, GFP_KERNEL);
  printk("a=%p, b=%p\n", a, b);

shows console log as follows

  a=ee5db9c0, b=ee5dba00





When only L1-cache is enabled, it is OK.


If L2 is also enabled,
kmalloc() & dma_map_single() could be a cacheline sharing problem.


Is there any good solution?


-- 
Best Regards
Masahiro Yamada

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

end of thread, other threads:[~2016-01-19  8:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-15  2:36 [Question] cacheline sharing problem on DMA for custom outer-cache Masahiro Yamada
2016-01-15  8:33 ` Arnd Bergmann
2016-01-18 12:05   ` Masahiro Yamada
2016-01-18 12:32     ` Russell King - ARM Linux
2016-01-19  8:25       ` Masahiro Yamada

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