On Sun, Mar 23, 2008 at 10:50:18AM +0200, Avi Kivity wrote:
> btw, when we nuke an spte, don't we lose dirty bit information?  That 
> doesn't matter with madvise(), but it does when removing a pte for other 
> reasons, say swapping.  Don't we need to clear the spte with cmpxchg(), to 
> make sure the dirty bit is what we think it is?

get_user_pages is always called with dirty=1, so we know PG_dirty will
be set on the page_t when the pte is cleared. The invalidate_page
method is called by the rmap code just after clearing the pte while
the page_t is locked, and while the page is locked PG_dirty shouldn't
disappear. So as long as we only map anonymous memory we should be
safe. (hugetlbfs wasn't allowed as guest physical memory yet when I
wrote that code)

But if we want to also call set_page_dirty and check the spte dirty
bit, that's sure safe addition to make it less dependent on mmu
notifier invocation details (notably PG_lock being set).

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to