[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Need information related to shadowing



At 09:41 +0530 on 15 Nov (1163583694), Sameer Ahuja wrote:
> Can you please tell me how is Shadow Page Table generated/maintained?

Shadow pagetables are generated in two places in the shadow code: on a
guest CR3 change a top-level shadow is generated (multi.c:
sh_update_cr3() calls sh_set_toplevel_shadow()), and all other shadows are
generated in the page fault handler (sh_page_fault() calls
shadow_get_and_create_l1e(), which recursively builds the shadow
tables).

Shadow entries are filled in by the l*e_propagate_from_guest()
functions, which are called directly from the page fault handler and
when we see a write to a guest pagetable (via the
shadow_validate_guest_entry() and shadow_validate_guest_pt_write()
functions).

The control flow is a bit tricky there because we need to track shadows
of different paging modes at the same time: a single page can have up
to eight different shadows.  To deal with different paging modes, the
file multi.c is compiled multiple times, and its functions renamed to
include the paging mode they handle.  We can then call the correct
function by name (see the various dispatch tables in common.c), or call
the functions for the paging mode each vcpu is currently in, via the
v->arch.shadow.mode array of pointers.

Shadows are destroyed when their reference count hits zero, typically
because shadow memory is being reclaimed: shadow_prealloc() un-pins
top-level shadows which causes them to recursively destroy all their
children.

Cheers,

Tim.

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.