From: Roland Dreier <rdreier@cisco.com>
To: Ralph Campbell <ralphc@pathscale.com>
Cc: Roland Dreier <rolandd@cisco.com>,
openib-general <openib-general@openib.org>,
linux-kernel@vger.kernel.org
Subject: Re: Suggestions for how to remove bus_to_virt()
Date: Wed, 12 Jul 2006 17:11:26 -0700 [thread overview]
Message-ID: <adar70quzwx.fsf@cisco.com> (raw)
In-Reply-To: <1152746967.4572.263.camel@brick.pathscale.com> (Ralph Campbell's message of "Wed, 12 Jul 2006 16:29:27 -0700")
> One solution is to change the IB device driver interface so that
> kernel virtual addresses are passed to the IB device driver and
> the device driver is responsible for calling dma_map_single(), etc.
> I believe this will be unacceptable to the OpenFabrics community
Actually it's worse than unacceptable -- I don't see how this can work
at all. The problem is that addresses are not just passed directly to
the local HCA; they also might be embedded in protocol messages that
are sent to a remote HCA and then used by the remote HCA to initiate
RDMA.
For example, the SRP driver uses ib_get_dma_mr() to get an R_Key,
which it then sends to the target along with a DMA address. The
target uses that R_Key/address to RDMA data directly to or from the
host. There's no good way for the low-level driver to handle the DMA
mapping, since the address is embedded in a protocol message that the
low-level driver knows nothing about.
> Another solution is to change the IB device driver interface to add
> a function which tells the caller what type of addresses the device
> expects. Kernel modules would then be required to pass either a
> dma_map_xxx() address or a kernel virtual address based on the
> driver's preference.
> The current set of IB consumers either start with kmalloc/vmalloc
> memory (such as the MAD layer) or a list of physical pages
> (such as ISER and SRP). The current code could therefore be
> fairly easily changed except for ISER/SRP when a struct page
> doesn't have a direct kernel address (high pages) and would
> need to call kmap()/kunmap() in that case.
I have a few problems with this: first, it's unfortunate that every
consumer needs two code paths to handle the two possibilities; second,
I don't see how it handles the case of SRP's use of the
ib_get_dma_mr() R_Key as above anyway; third, expecting consumers to
kmap pages for a long time across work request execution is a bad
idea.
Maybe the least bad solution would be to add rdma_XXX wrappers around
the dma mapping functions that RDMA consumers use; then most low-level
drivers could just pass them through to the DMA mapping API, while the
ipath driver could handle things itself.
The problem with that is that it ends up wrapping a huge API -- for
example, you need both dma_map_single and dma_map_sg at least, plus
someone might want to use dma_alloc_coherent memory, not to mention
the dma_pool stuff, etc.
A cleaner solution would be to make the dma_ API really use the device
it's passed anyway, and allow drivers to override the standard PCI
stuff nicely. But that would be major surgery, I guess.
(BTW, vmalloc memory should not be used for DMA, since it's not
guaranteed to be DMA-able -- so anyone doing that is just wrong)
- R.
next prev parent reply other threads:[~2006-07-13 0:11 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-12 23:29 Suggestions for how to remove bus_to_virt() Ralph Campbell
2006-07-12 23:40 ` David Miller
2006-07-13 0:11 ` Roland Dreier [this message]
2006-07-13 0:40 ` David Miller
2006-07-13 5:46 ` [openib-general] " Muli Ben-Yehuda
2006-07-14 22:27 ` Ralph Campbell
2006-07-14 22:35 ` David Miller
2006-07-14 23:45 ` Ralph Campbell
2006-07-15 13:42 ` Stefan Richter
2006-07-13 7:45 ` Stefan Richter
2006-07-13 16:02 ` Roland Dreier
2006-07-13 16:37 ` Ralph Campbell
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=adar70quzwx.fsf@cisco.com \
--to=rdreier@cisco.com \
--cc=linux-kernel@vger.kernel.org \
--cc=openib-general@openib.org \
--cc=ralphc@pathscale.com \
--cc=rolandd@cisco.com \
/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