From: "Vineet Gupta" <vineetg76@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: dma_sync_api usage in drivers/ieee1394/sbp2.c
Date: Wed, 14 Jan 2009 17:22:39 -0800 [thread overview]
Message-ID: <9f4f8abe0901141722x40bbe5b5lcdd8f10463517c14@mail.gmail.com> (raw)
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
reply other threads:[~2009-01-15 1:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9f4f8abe0901141722x40bbe5b5lcdd8f10463517c14@mail.gmail.com \
--to=vineetg76@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®