]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
KVM: MMU: invalidate and flush on spte small->large page size change
authorMarcelo Tosatti <mtosatti@redhat.com>
Fri, 28 May 2010 12:44:59 +0000 (09:44 -0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 2 Aug 2010 17:26:44 +0000 (10:26 -0700)
Always invalidate spte and flush TLBs when changing page size, to make
sure different sized translations for the same address are never cached
in a CPU's TLB.

Currently the only case where this occurs is when a non-leaf spte pointer is
overwritten by a leaf, large spte entry. This can happen after dirty
logging is disabled on a memslot, for example.

Noticed by Andrea.

KVM-Stable-Tag
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
(cherry picked from commit 3be2264be3c00865116f997dc53ebcc90fe7fc4b)

arch/x86/kvm/mmu.c

index 99f646f7c6a43bb4619ae720cadb59b677ff1dc4..ca7c5282adddd8206c4d55f1d80b78cc5a7cb7e3 100644 (file)
@@ -1907,6 +1907,8 @@ static void mmu_set_spte(struct kvm_vcpu *vcpu, u64 *sptep,
 
                        child = page_header(pte & PT64_BASE_ADDR_MASK);
                        mmu_page_remove_parent_pte(child, sptep);
+                       __set_spte(sptep, shadow_trap_nonpresent_pte);
+                       kvm_flush_remote_tlbs(vcpu->kvm);
                } else if (pfn != spte_to_pfn(*sptep)) {
                        pgprintk("hfn old %lx new %lx\n",
                                 spte_to_pfn(*sptep), pfn);