From: Daniel Stodden Subject: Re: Sharing Memory between userspace of dom0 and userspace of domU Date: Tue, 19 Feb 2008 22:48:33 +0100 Message-ID: <1203457713.5870.14.camel@thinkpad.localdomain> References: <3bb76bfe0802171554y34d668c9n48adb00a57cd799b@mail.gmail.com> <617dbaa80802180158g7207a21eg5688bbf927434cbb@mail.gmail.com> <1203440566.12035.31.camel@thinkpad.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Mike Sun Cc: Derek.Murray@cl.cam.ac.uk, Kareem Dana , xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org h 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. >=20 > Regarding page table pages... you mentioned: > > Xen never swaps out domain pages. So there's no need to pin them on t= he > > side of the VMM. I believe that will answer your original question > > regarding swapping out of domain page tables. >=20 > 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=3DRW, count>0) somewhere, attempts to use it as a PT frame elsewhere will fail. regards, daniel --=20 Daniel Stodden LRR - Lehrstuhl f=C3=BCr Rechnertechnik und Rechnerorganisation Institut f=C3=BCr Informatik der TU M=C3=BCnchen D-85748 Garc= hing http://www.lrr.in.tum.de/~stodden mailto:stodden@cs.tum.edu PGP Fingerprint: F5A4 1575 4C56 E26A 0B33 3D80 457E 82AE B0D8 735B