]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] KVM: MMU: Treat user-mode faults as a hint that a page is no longer a page...
authorAvi Kivity <avi@qumranet.com>
Sat, 6 Jan 2007 00:36:52 +0000 (16:36 -0800)
committerLinus Torvalds <torvalds@woody.osdl.org>
Sat, 6 Jan 2007 07:55:26 +0000 (23:55 -0800)
Signed-off-by: Avi Kivity <avi@qumranet.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/kvm/paging_tmpl.h

index 03c474aaedded0f09959cbefa5e26b006089aee2..6acb16ea5ce2233eb5ef799a1ca89cf6500c5417 100644 (file)
@@ -271,6 +271,7 @@ static int FNAME(fix_write_pf)(struct kvm_vcpu *vcpu,
        pt_element_t *guest_ent;
        int writable_shadow;
        gfn_t gfn;
+       struct kvm_mmu_page *page;
 
        if (is_writeble_pte(*shadow_ent))
                return 0;
@@ -303,7 +304,17 @@ static int FNAME(fix_write_pf)(struct kvm_vcpu *vcpu,
        }
 
        gfn = walker->gfn;
-       if (kvm_mmu_lookup_page(vcpu, gfn)) {
+
+       if (user) {
+               /*
+                * Usermode page faults won't be for page table updates.
+                */
+               while ((page = kvm_mmu_lookup_page(vcpu, gfn)) != NULL) {
+                       pgprintk("%s: zap %lx %x\n",
+                                __FUNCTION__, gfn, page->role.word);
+                       kvm_mmu_zap_page(vcpu, page);
+               }
+       } else if (kvm_mmu_lookup_page(vcpu, gfn)) {
                pgprintk("%s: found shadow page for %lx, marking ro\n",
                         __FUNCTION__, gfn);
                *write_pt = 1;