WARNING - OLD ARCHIVES

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/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] about domU pagetable

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Xen-devel] about domU pagetable
From: Mark Williamson <mark.williamson@xxxxxxxxxxxx>
Date: Sun, 24 Feb 2008 02:37:54 +0000
Cc: 余上 <yusunn@xxxxxxxxx>
Delivery-date: Sat, 23 Feb 2008 18:38:18 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <298d852f0802170452k5ac00f8bkc1a2938abe4c4c8@xxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <298d852f0802170452k5ac00f8bkc1a2938abe4c4c8@xxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: KMail/1.9.6 (enterprise 0.20070907.709405)
> As I know , dom0 pagetable gets its PGT flags explicitly set in
> construct_dom0 , for example:
>
> page->u.inuse.type_info |= PGT_l3_page_table
>
> but how about domU's ? Where it get set ? By means of hypercall ? If
> so , which one ?

construct_dom0 scares me a little :-)

I'll try and give you a quick overview of how this all works, based on my 
current understanding.  I believe this to all be correct but bear in mind I 
might make mistakes.  Feel free to ask questions about anything.

Pages are identified as being pagetables when either a) they are loaded into 
CR3, the pagetable base register (on x86_32) b) they are referenced as part 
of an existing pagetable tree or c) they are pinned with pagetable type.

The initial state of a domain includes a set of bootstrap pagetables which map 
enough memory for the domain to get itself started.  Once the domain is 
running it'll probably build itself new pagetables.  The process of creating 
the bootstrap pagetables is being done in construct_dom0 for the initial 
domain (dom0 itself).  For other Xen domains, they are built in the userspace 
domain builder tool.  The code of this tool is different to when I last 
looked in detail but I think the pagetables are built in 
tools/libxc/xc_dom_x86.c and then pinned using hypercalls in 
tools/libxc/xc_dom_boot.c.

This is all just to build minimal pagetables to get the domain up and running.  
Once the domain is running, it'll probably create new and larger pagetables.  
The will be validated by Xen at runtime:

When a new pagetable base pointer is loaded into CR3, the page pointed to and 
all pages that are also part of that pagetable tree will be validated and 
assigned the right types.  A domain may explicitly request that a pagetable 
(even one that isn't loaded into CR3) is validated by "pinning" it.  Xen sets 
the type when the table is pinned so that it won't have to check it every 
time the pagetable is loaded into CR3.  This improves performance.  It won't 
let the guest change the contents of the pagetable whilst it's pinned, so 
this is safe.

The leaf entries of a pagetable can be written to directly by a guest using 
the "writable pagetables" API.  The internal nodes of a pagetable (the ones 
that just point to other pagetable pages) cannot (if i remember right!) be 
written directly like this, they have to be set using a hypercall.

Cheers,
Mark

-- 
Push Me Pull You - Distributed SCM tool (http://www.cl.cam.ac.uk/~maw48/pmpu/)

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>