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

Paul Mackerras paulus at ozlabs.org
Thu Mar 10 19:33:05 AEDT 2016


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.

Paul.






More information about the Linuxppc-dev mailing list