This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


Re: [Xen-devel] Sharing Memory between userspace of dom0 and userspace o

On Tue, 2008-02-19 at 13:34 -0500, Mike Sun wrote:
> Thanks Daniel, Derek.  I think that cleared up a good number of things for me.
> Regarding page table pages...  you mentioned:
> > Xen never swaps out domain pages. So there's no need to pin them on the
> > side of the VMM. I believe that will answer your original question
> > regarding swapping out of domain page tables.
> My question is what would happen if the guest OS swaps out page table
> pages and the mfn backing that PT page is now allocated to a normal
> user page.  How would Xen know that the type of that page has changed
> if this were allowed to happen?

The page type refcount drops to zero when the page isn't linked into the
page table structure anymore (see the page_info struct definition in the
Xen source tree for types and refcounts). So the guest just unlinks the
PT frame (via a hypercall). From there on, the guest may reuse the frame
under a writable mapping. Note that this is consistent with overall OS
behavior: First the PT usage is cleared, then the frame reused,
independent of whether the contents are swapped to disk, the process
died, etc.

Vice versa for writable (RW) types: If the guest has a writable mapping
on that page (type=RW, count>0) somewhere, attempts to use it as a PT
frame elsewhere will fail.


Daniel Stodden
LRR     -      Lehrstuhl für Rechnertechnik und Rechnerorganisation
Institut für Informatik der TU München             D-85748 Garching
http://www.lrr.in.tum.de/~stodden         mailto:stodden@xxxxxxxxxx
PGP Fingerprint: F5A4 1575 4C56 E26A 0B33  3D80 457E 82AE B0D8 735B

Xen-devel mailing list