]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
KVM: MMU: Segregate mmu pages created with different cr4.pge settings
authorAvi Kivity <avi@redhat.com>
Sun, 21 Dec 2008 17:27:36 +0000 (19:27 +0200)
committerAvi Kivity <avi@redhat.com>
Tue, 24 Mar 2009 09:02:51 +0000 (11:02 +0200)
Don't allow a vcpu with cr4.pge cleared to use a shadow page created with
cr4.pge set; this might cause a cr3 switch not to sync ptes that have the
global bit set (the global bit has no effect if !cr4.pge).

This can only occur on smp with different cr4.pge settings for different
vcpus (since a cr4 change will resync the shadow ptes), but there's no
cost to being correct here.

Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/x86.c

index 28f875f28f58795924662e18f2753d2e3ede7686..c2a01d0513f530ccb248a0063fcb2bb3dfa5d4a5 100644 (file)
@@ -183,6 +183,7 @@ union kvm_mmu_page_role {
                unsigned metaphysical:1;
                unsigned access:3;
                unsigned invalid:1;
+               unsigned cr4_pge:1;
        };
 };
 
index 2477e87b2f84251e1576977b42e367ed217e2922..873602b5edfd2ed5127651329ddd27036e0d00ab 100644 (file)
@@ -364,6 +364,7 @@ void kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
        }
        kvm_x86_ops->set_cr4(vcpu, cr4);
        vcpu->arch.cr4 = cr4;
+       vcpu->arch.mmu.base_role.cr4_pge = !!(cr4 & X86_CR4_PGE);
        kvm_mmu_sync_global(vcpu);
        kvm_mmu_reset_context(vcpu);
 }