]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
KVM: MMU: nuke shadowed pgtable pages and ptes on memslot destruction
authorMarcelo Tosatti <mtosatti@redhat.com>
Thu, 10 Jul 2008 23:49:31 +0000 (20:49 -0300)
committerAvi Kivity <avi@qumranet.com>
Sun, 20 Jul 2008 09:42:40 +0000 (12:42 +0300)
Flush the shadow mmu before removing regions to avoid stale entries.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
arch/ia64/kvm/kvm-ia64.c
arch/powerpc/kvm/powerpc.c
arch/s390/kvm/kvm-s390.c
arch/x86/kvm/x86.c
include/linux/kvm_host.h
virt/kvm/kvm_main.c

index 9408b30576d6437147c0bf2b45baa2a6eeab9203..2672f4d278ac52695592f23f6ddc501fcce3b7a8 100644 (file)
@@ -1455,6 +1455,9 @@ int kvm_arch_set_memory_region(struct kvm *kvm,
        return 0;
 }
 
+void kvm_arch_flush_shadow(struct kvm *kvm)
+{
+}
 
 long kvm_arch_dev_ioctl(struct file *filp,
                unsigned int ioctl, unsigned long arg)
index b850d24970272cd130bcf6047f9583d4c310422b..53826a5f6c06d406bb7a95ebb8017f0b4d1a1185 100644 (file)
@@ -170,6 +170,10 @@ int kvm_arch_set_memory_region(struct kvm *kvm,
        return 0;
 }
 
+void kvm_arch_flush_shadow(struct kvm *kvm)
+{
+}
+
 struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id)
 {
        struct kvm_vcpu *vcpu;
index 399acf3f64dd054ba90bd9e7d083c49c923605d0..1782cbcd2829545270d897cd4f911d95f54d0fa7 100644 (file)
@@ -675,6 +675,10 @@ int kvm_arch_set_memory_region(struct kvm *kvm,
        return 0;
 }
 
+void kvm_arch_flush_shadow(struct kvm *kvm)
+{
+}
+
 gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn)
 {
        return gfn;
index b131f3c0cf64ff00578cef2a12b7da5c72704f7c..9f1cdb011cfff3d93b4cf8fe1f64349768183742 100644 (file)
@@ -4032,6 +4032,11 @@ int kvm_arch_set_memory_region(struct kvm *kvm,
        return 0;
 }
 
+void kvm_arch_flush_shadow(struct kvm *kvm)
+{
+       kvm_mmu_zap_all(kvm);
+}
+
 int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu)
 {
        return vcpu->arch.mp_state == KVM_MP_STATE_RUNNABLE
index d220b4926c4ac0c405987a5c12af427abd529da4..07d68a8ae8e950bc21bdb86b8900aea4ee68b46e 100644 (file)
@@ -168,6 +168,7 @@ int kvm_arch_set_memory_region(struct kvm *kvm,
                                struct kvm_userspace_memory_region *mem,
                                struct kvm_memory_slot old,
                                int user_alloc);
+void kvm_arch_flush_shadow(struct kvm *kvm);
 gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn);
 struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn);
 unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn);
index 9ccaf8f5402ec05250b11e299271bdb22ff7b00b..30b36368fcdfc3722ff4e53c764f4d14df08f321 100644 (file)
@@ -405,6 +405,9 @@ int __kvm_set_memory_region(struct kvm *kvm,
        if (mem->slot >= kvm->nmemslots)
                kvm->nmemslots = mem->slot + 1;
 
+       if (!npages)
+               kvm_arch_flush_shadow(kvm);
+
        *memslot = new;
 
        r = kvm_arch_set_memory_region(kvm, mem, old, user_alloc);