lkml.org 
[lkml]   [2009]   [Jan]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectdma_sync_api usage in drivers/ieee1394/sbp2.c
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


\
 
 \ /
  Last update: 2009-01-15 02:25    [W:0.230 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site