KVM: MMU: When updating the dirty bit, inform the mmu about it
authorAvi Kivity <avi@qumranet.com>
Thu, 11 Oct 2007 13:30:21 +0000 (15:30 +0200)
committerAvi Kivity <avi@qumranet.com>
Wed, 30 Jan 2008 15:52:52 +0000 (17:52 +0200)
Since the mmu uses different shadow pages for dirty large pages and clean
large pages, this allows the mmu to drop ptes that are now invalid.

Signed-off-by: Avi Kivity <avi@qumranet.com>
drivers/kvm/paging_tmpl.h

index a0f84a5379a4766b8d0282f6604f13f3664c7ca5..a9e687b5c1e932277eb5ced9650e80a80626c6e8 100644 (file)
@@ -74,9 +74,14 @@ static void FNAME(update_dirty_bit)(struct kvm_vcpu *vcpu,
                                    pt_element_t *ptep,
                                    gfn_t table_gfn)
 {
+       gpa_t pte_gpa;
+
        if (write_fault && !is_dirty_pte(*ptep)) {
                mark_page_dirty(vcpu->kvm, table_gfn);
                *ptep |= PT_DIRTY_MASK;
+               pte_gpa = ((gpa_t)table_gfn << PAGE_SHIFT);
+               pte_gpa += offset_in_page(ptep);
+               kvm_mmu_pte_write(vcpu, pte_gpa, (u8 *)ptep, sizeof(*ptep));
        }
 }