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

Re: [Xen-devel] Re: how to enable shadow page table? Do I have torun HVM guest systems for shadow paging mode?



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


 


Rackspace

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