[<prev] [next>] [day] [month] [year] [list]
Message-ID: <9f4f8abe0901141722x40bbe5b5lcdd8f10463517c14@mail.gmail.com>
Date: Wed, 14 Jan 2009 17:22:39 -0800
From: "Vineet Gupta" <vineetg76@...il.com>
To: linux-kernel@...r.kernel.org
Subject: dma_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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists