[PATCH kernel 3/9] KVM: PPC: Use preregistered memory API to access TCE list

David Gibson david at gibson.dropbear.id.au
Fri Mar 11 10:42:06 AEDT 2016


On Thu, Mar 10, 2016 at 07:33:05PM +1100, Paul Mackerras wrote:
> On Mon, Mar 07, 2016 at 05:00:14PM +1100, David Gibson wrote:
> > On Mon, Mar 07, 2016 at 02:41:11PM +1100, Alexey Kardashevskiy wrote:
> > > VFIO on sPAPR already implements guest memory pre-registration
> > > when the entire guest RAM gets pinned. This can be used to translate
> > > the physical address of a guest page containing the TCE list
> > > from H_PUT_TCE_INDIRECT.
> > > 
> > > This makes use of the pre-registrered memory API to access TCE list
> > > pages in order to avoid unnecessary locking on the KVM memory
> > > reverse map.
> > > 
> > > Signed-off-by: Alexey Kardashevskiy <aik at ozlabs.ru>
> > 
> > Ok.. so, what's the benefit of not having to lock the rmap?
> 
> It's not primarily about locking or not locking the rmap.  The point
> is that when memory is pre-registered, we know that all of guest
> memory is pinned and we have a flat array mapping GPA to HPA.  It's
> simpler and quicker to index into that array (even with looking up the
> kernel page tables in vmalloc_to_phys) than it is to find the memslot,
> lock the rmap entry, look up the user page tables, and unlock the rmap
> entry.  We were only locking the rmap entry to stop the page being
> unmapped and reallocated to something else, but if memory is
> pre-registered, it's all pinned, so it can't be reallocated.

Ok, that makes sense.

Alexey, can you fold some of that rationale into the commit message?

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20160311/15c2cebe/attachment.sig>


More information about the Linuxppc-dev mailing list