Skip to contentSkip to conversation

KVM: mark page dirty when page is actually modified.

PATCH Applied Gui Jianfeng 2 participants 2 messages May 5, 2010 – May 6, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: mark page dirty when page is actually modified.

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

---
 arch/x86/kvm/paging_tmpl.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/kvm/paging_tmpl.h +2 -2
index 89d66ca..1ad9843 100644
@@ -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;
 	}
Signature · 1 line
1.6.5.2
Applied
#1 lore raw
Quoted 4 lines · Gui Jianfeng

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

Applied, thanks.

Signature · 1 line
error compiling committee.c: too many arguments to function