kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: mark page dirty when page is actually modified.
@ 2010-05-05  1:09 Gui Jianfeng
  2010-05-06  9:10 ` Avi Kivity
  0 siblings, 1 reply; 2+ messages in thread
From: Gui Jianfeng @ 2010-05-05  1:09 UTC (permalink / raw)
  To: Avi Kivity, Marcelo Tosatti, kvm

Sometime cmpxchg_gpte doesn't modify gpte, in such case, don't mark
page table page as dirty.

Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
---
 arch/x86/kvm/paging_tmpl.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
index 89d66ca..1ad9843 100644
--- a/arch/x86/kvm/paging_tmpl.h
+++ b/arch/x86/kvm/paging_tmpl.h
@@ -177,10 +177,10 @@ walk:
 		if (!(pte & PT_ACCESSED_MASK)) {
 			trace_kvm_mmu_set_accessed_bit(table_gfn, index,
 						       sizeof(pte));
-			mark_page_dirty(vcpu->kvm, table_gfn);
 			if (FNAME(cmpxchg_gpte)(vcpu->kvm, table_gfn,
 			    index, pte, pte|PT_ACCESSED_MASK))
 				goto walk;
+			mark_page_dirty(vcpu->kvm, table_gfn);
 			pte |= PT_ACCESSED_MASK;
 		}
 
@@ -217,11 +217,11 @@ walk:
 		bool ret;
 
 		trace_kvm_mmu_set_dirty_bit(table_gfn, index, sizeof(pte));
-		mark_page_dirty(vcpu->kvm, table_gfn);
 		ret = FNAME(cmpxchg_gpte)(vcpu->kvm, table_gfn, index, pte,
 			    pte|PT_DIRTY_MASK);
 		if (ret)
 			goto walk;
+		mark_page_dirty(vcpu->kvm, table_gfn);
 		pte |= PT_DIRTY_MASK;
 		walker->ptes[walker->level - 1] = pte;
 	}
-- 
1.6.5.2




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] KVM: mark page dirty when page is actually modified.
  2010-05-05  1:09 [PATCH] KVM: mark page dirty when page is actually modified Gui Jianfeng
@ 2010-05-06  9:10 ` Avi Kivity
  0 siblings, 0 replies; 2+ messages in thread
From: Avi Kivity @ 2010-05-06  9:10 UTC (permalink / raw)
  To: Gui Jianfeng; +Cc: Marcelo Tosatti, kvm

On 05/05/2010 04:09 AM, Gui Jianfeng wrote:
> Sometime cmpxchg_gpte doesn't modify gpte, in such case, don't mark
> page table page as dirty.
>
>    

Applied, thanks.

-- 
error compiling committee.c: too many arguments to function


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-05-06  9:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-05  1:09 [PATCH] KVM: mark page dirty when page is actually modified Gui Jianfeng
2010-05-06  9:10 ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).