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] Need information related to shadowing

To: Sameer Ahuja <sameer.ahuja@xxxxxxxxxxx>
Subject: Re: [Xen-devel] Need information related to shadowing
From: Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>
Date: Wed, 15 Nov 2006 10:13:37 +0000
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Wed, 15 Nov 2006 02:13:48 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <0A8CFEC45B7F4C419F7543867C47442357F42A@xxxxxxxxxxxxxxxxxxxxxx>
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: <0A8CFEC45B7F4C419F7543867C47442357F42A@xxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.13 (2006-08-11)
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