Re: [RFC PATCH 25/32] KVM: PPC: Book3S HV: Introduce rmap to track nested guest mappings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Sep 27, 2018 at 02:07:58PM +1000, David Gibson wrote:
> On Fri, Sep 21, 2018 at 08:01:56PM +1000, Paul Mackerras wrote:
> > From: Suraj Jitindar Singh <sjitindarsingh@xxxxxxxxx>
> > 
> > When a host (L0) page which is mapped into a (L1) guest is in turn
> > mapped through to a nested (L2) guest we keep a reverse mapping (rmap)
> > so that these mappings can be retrieved later.
> > 
> > Whenever we create an entry in a shadow_pgtable for a nested guest we
> > create a corresponding rmap entry and add it to the list for the
> > L1 guest memslot at the index of the L1 guest page it maps. This means
> > at the L1 guest memslot we end up with lists of rmaps as follows;
> > 
> >   memslot (L1)
> > -----------------
> > | gfn = 0	| -> rmap -> rmap -> rmap -> NULL
> > -----------------
> > | gfn = 1	|
> > -----------------
> > | gfn = 2	| -> rmap -> NULL
> > -----------------
> > | gfn = 3	| -> rmap -> rmap -> NULL
> > -----------------
> > | gfn = 4	|
> > -----------------
> > | gfn = n	|
> > -----------------
> > 
> > When we are notified of a host page being invalidated which has been
> > mapped through to a (L1) guest, we can then walk the rmap list for that
> > guest page, and find and invalidate all of the corresponding
> > shadow_pgtable entries.
> > 
> > Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@xxxxxxxxx>
> > Signed-off-by: Paul Mackerras <paulus@xxxxxxxxxx>
> 
> Reviewed-by: David Gibson <david@xxxxxxxxxxxxxxxxxxxxx>
> 
> Am I right in thinking that the reason we need this in addition to the
> exiting rmap for the L1 guest is that we need to know the LPID(s) to
> invalidate in the case of a host invalidation?

The existing rmap is not really used for radix guests because we get a
guest real address and we can just index into the partition-scoped
radix tree and find the one and only PTE that maps that guest real
address.

With a nested guest, a given L1 guest real page could be mapped in the
shadow partition-scoped trees for multiple nested guests at arbitrary
L2 guest real addresses.  The rmap that we implement here gives us a
list of (l1 lpid, l2 guest real address) combinations that (may) map
the target L1 guest real page.

Paul.



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux