mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* dma_sync_api usage in drivers/ieee1394/sbp2.c
@ 2009-01-15  1:22 Vineet Gupta
  0 siblings, 0 replies; only message in thread
From: Vineet Gupta @ 2009-01-15  1:22 UTC (permalink / raw)
  To: linux-kernel

Hi,

While implementing dma map/sync APIs for a non-coherent DMA arch I ran
into a use-case in IEEE1394 driver.

1. In sbp2util_create_command_orb_pool( ),  dma_map_single(TO_DEVICE)
is called for cmd->command_orb. Since this is ownership handover to
driver, dcache wback #1 done for arch such as ARM]

2. In sbp2_create_command_orb ( ), it's ownership is transferred back
to CPU so that driver can mod it by calling dma_sync_single_for_cpu (
TO_DEVICE ), [ this causes dcache wback #2]

3. at the end of same function, when finally driver is done with
creating the cmd, it calls dma_sync_single_for_device (TO_DEVICE) [
dcache wback #3]

So dcache lines were flushed for the buffer 3 times whereas it was
really required only once (maybe it was ok to do it at the time of map
, but certainly for every sbp2_create_command_orb( ) it can be done
only once instead of twice).

This is happening because ownership handover is being explicitly
specified using _cpu( )  and _device( ) which has the upside that it
makes the code really readable but the downside being it is not really
efficient

As an optimization can sync_for_cpu (TO_DEVICE) be implemented as nop
because that would REALLY mean cpu wants to own it. Similarly
corollary case, sync_for_device (FROM_DEVICE) can be made a nop.

Do other people think the same too or am I missing something really
fundamental here...

Thanks,
Vineet

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-01-15  1:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-15  1:22 dma_sync_api usage in drivers/ieee1394/sbp2.c Vineet Gupta

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

all inboxes | Powered by JetHome®