|
|
|
|
|
|
|
|
|
|
xen-devel
Re: [Xen-devel] about domU pagetable
Hi,
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
yushang
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
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
|
|
|
|