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] Re: how to enable shadow page table? Do I have torun HVM

To: Long Wang <longwang@xxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] Re: how to enable shadow page table? Do I have torun HVM guest systems for shadow paging mode?
From: Tim Deegan <Tim.Deegan@xxxxxxxxxx>
Date: Thu, 19 Mar 2009 09:51:11 +0000
Cc: 'Jeremy Fitzhardinge' <jeremy@xxxxxxxx>, 'Xen-devel' <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Thu, 19 Mar 2009 02:51:43 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20090319050313.CAEF93400095@xxxxxxxxxxxxxxxxxx>
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/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20090317093441.GB11733@xxxxxxxxxxxxxxxxxxxxx> <20090319050313.CAEF93400095@xxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.17 (2007-11-01)
Hi,

At 05:03 +0000 on 19 Mar (1237439004), Long Wang wrote:
> Here is another question. In the log-dirty mode, who sets the "dirty" bit of
> a level-1 entry?

Depends what you mean.  The dirty bit of a *guest* PTE is set either
directly by the guest or by guest_walk_tables().

The dirty bit of a *shadow* PTE is usually set by _sh_propagate (since
we don't care about it) except for some optimizations to do with HVM
video RAM mappings, where it's set by the MMU.

The dirty bit in the log-dirty bitmap is set by paging_mark_dirty(),
which is called from anywhere that writes to guest memory or allows the
guest a writeable mapping.  It has nothing to do with the dirty bits in
PTEs.

> The mmu, or _sh_propagate()? As far as I know about the x86
> hardware, the dirty bit is independent of the R/W bit. But it seems that
> _sh_propagate() sets all pages as read-only and then sets the dirty bit when
> handling the page fault. 

In order to get the *guest* PTE's dirty bit set correctly, we leave the
*shadow* PTE read-only in order to intercept the guest's first write to
the page.  At that point guest_walk_tables() sets the guest-PTE dirty
bit (as an MMU would if shadows were not in use) and _sh_propagate()
makes the shadow PTE R/W.

> Will the mmu sets the dirty bit for a page when the page is written?

Only for the *shadow* PTE, since that's the only one the MMU ever
sees. 

Cheers,

Tim.

-- 
Tim Deegan <Tim.Deegan@xxxxxxxxxx>
Principal Software Engineer, Citrix Systems (R&D) Ltd.
[Company #02300071, SL9 0DZ, UK.]

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