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] about domU pagetable

To: "Mark Williamson" <mark.williamson@xxxxxxxxxxxx>
Subject: Re: [Xen-devel] about domU pagetable
From: "余上" <yusunn@xxxxxxxxx>
Date: Mon, 25 Feb 2008 11:59:46 +0800
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Sun, 24 Feb 2008 20:00:08 -0800
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=4KsxBL7UBX5H/waQh+Gbuqvgfymq4DzfyQkjiiBXKac=; b=L4q8C/TafnW1tMuAJ/hbpo0p3Jjcxsv1+t+K7BT3rbNdIEg7DDOM/tChmr6Th/FdqCNMzrz2S7jOE0CxERf3a8Zv9aivikjP1UBlF0p4FhYkfqD7IsSPMfzAei1dNaF8uD/36Y91MbQuFUqjFuAaXthhcN7rN70jScHxKBg+xZ0=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=nIT0C52OfOSvY04SKRv5BuqIb4mE9MS0K06wV5C85YF9/f6JHKqHHKJSlZuKBGbe8YpgAVtB5ldW/iWJin2rub5vbrMpPlYZEJuoDshXA7LM1eN0868A26JZlCQf9bcNvkma7nud3ueAmvGsvWfMTI/1nk/YcowvYPqzAS9ZIbg=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <200802240237.54414.mark.williamson@xxxxxxxxxxxx>
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> <200802240237.54414.mark.williamson@xxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
I have checked the code again . The basic logic is as you said .
Firstly the topmost pagetable(it may be l4,l3 and so on) is pinned .
Then the pinning hpyercall will call get_page_* family , which will
set the PGT flags and call alloc_page_type , the latter will setup the
internal nodes , again , sets the corresponding PGT falgs .

Many thanks

2008/2/24, Mark Williamson <mark.williamson@xxxxxxxxxxxx>:
> > 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

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