From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: David Miller <davem@davemloft.net>
Cc: Alexey Kardashevskiy <aik@au1.ibm.com>,
Anton Blanchard <anton@au1.ibm.com>,
paulus@samba.org, sowmini.varadhan@oracle.com,
sparclinux@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Subject: Re: Generic IOMMU pooled allocator
Date: Thu, 19 Mar 2015 16:27:57 +1100 [thread overview]
Message-ID: <550A5E5D.90907@ozlabs.ru> (raw)
In-Reply-To: <1426734106.4770.118.camel@kernel.crashing.org>
On 03/19/2015 02:01 PM, Benjamin Herrenschmidt wrote:
> On Wed, 2015-03-18 at 22:25 -0400, David Miller wrote:
>> PowerPC folks, we're trying to kill the locking contention in our
>> IOMMU allocators and noticed that you guys have a nice solution to
>> this in your IOMMU code.
>
> .../...
>
> Adding Alexei too who is currently doing some changes to our iommu
> code to deal with KVM.
>
> One thing I noticed is the asymetry in your code between the alloc
> and the free path. The alloc path is similar to us in that the lock
> covers the allocation and that's about it, there's no actual mapping to
> the HW done, it's done by the caller level right ?
>
> The free path however, in your case, takes the lock and calls back into
> "demap" (which I assume is what removes the translation from the HW)
> with the lock held. There's also some mapping between cookies
> and index which here too isn't exposed to the alloc side but is
> exposed to the free side.
>
> I'm sure there's a rationale for that but it would be good if you could
> explain it and document the semantics of those 3 callbacks in the iommu
> ops.
>
> One thing that Alexey is doing on our side is to move some of the
> hooks to manipulate the underlying TCEs (ie. iommu PTEs) from our
> global ppc_md. data structure to a new iommu_table_ops, so your patches
> will definitely collide with our current work so we'll have to figure
> out how things can made to match. We might be able to move more than
> just the allocator to the generic code, and the whole implementation of
> map_sg/unmap_sg if we have the right set of "ops", unless you see a
> reason why that wouldn't work for you ?
>
> We also need to add some additional platform specific fields to certain
> iommu table instances to deal with some KVM related tracking of pinned
> "DMAble" memory, here too we might have to be creative and possibly
> enclose the generic iommu_table in a platform specific variant.
>
> Alexey, any other comment ?
Agree about missing symmetry. In general, I would call it "zoned
pool-locked memory allocator"-ish rather than iommu_table and have no
callbacks there.
The iommu_tbl_range_free() caller could call cookie_to_index() and what the
reset() callback does here - I do not understand, some documentation would
help here, and demap() does not have to be executed under the lock (as
map() is not executed under the lock).
btw why demap, not unmap? :)
--
Alexey
next prev parent reply other threads:[~2015-03-19 5:28 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-19 2:25 Generic IOMMU pooled allocator David Miller
2015-03-19 2:46 ` Benjamin Herrenschmidt
2015-03-19 2:50 ` David Miller
2015-03-19 3:01 ` Benjamin Herrenschmidt
2015-03-19 5:27 ` Alexey Kardashevskiy [this message]
2015-03-19 13:34 ` Sowmini Varadhan
2015-03-22 19:27 ` Sowmini Varadhan
2015-03-23 16:29 ` David Miller
2015-03-23 16:54 ` Sowmini Varadhan
2015-03-23 19:05 ` David Miller
2015-03-23 19:09 ` Sowmini Varadhan
2015-03-23 22:21 ` Benjamin Herrenschmidt
2015-03-23 23:08 ` Sowmini Varadhan
2015-03-23 23:29 ` chase rayfield
2015-03-24 0:47 ` Benjamin Herrenschmidt
2015-03-24 1:11 ` Sowmini Varadhan
2015-03-24 1:44 ` David Miller
2015-03-24 1:57 ` Sowmini Varadhan
2015-03-24 2:08 ` Benjamin Herrenschmidt
2015-03-24 2:15 ` David Miller
2015-03-26 0:43 ` cascardo
2015-03-26 0:49 ` Benjamin Herrenschmidt
2015-03-26 10:56 ` Sowmini Varadhan
2015-03-26 23:00 ` David Miller
2015-03-26 23:51 ` Benjamin Herrenschmidt
2015-03-23 22:36 ` Benjamin Herrenschmidt
2015-03-23 23:19 ` Sowmini Varadhan
2015-03-24 0:48 ` Benjamin Herrenschmidt
2015-03-23 22:25 ` Benjamin Herrenschmidt
2015-03-22 19:36 ` Arnd Bergmann
2015-03-22 22:02 ` Benjamin Herrenschmidt
2015-03-22 22:07 ` Sowmini Varadhan
2015-03-22 22:22 ` Benjamin Herrenschmidt
2015-03-23 6:04 ` Arnd Bergmann
2015-03-23 11:04 ` Benjamin Herrenschmidt
2015-03-23 18:45 ` Arnd Bergmann
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=550A5E5D.90907@ozlabs.ru \
--to=aik@ozlabs.ru \
--cc=aik@au1.ibm.com \
--cc=anton@au1.ibm.com \
--cc=davem@davemloft.net \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=paulus@samba.org \
--cc=sowmini.varadhan@oracle.com \
--cc=sparclinux@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;
as well as URLs for NNTP newsgroup(s).