aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/x86.c
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2008-12-01 19:32:04 -0500
committerAvi Kivity <avi@redhat.com>2008-12-31 09:55:44 -0500
commit6cffe8ca4a2adf1ac5003d9cad08fe4434d6eee0 (patch)
tree9ee09235ed1dc1f26c8988557ddb2fb82cdb2b05 /arch/x86/kvm/x86.c
parentb1a368218ad5b6e62380c8f206f16e6f18bf154c (diff)
KVM: MMU: skip global pgtables on sync due to cr3 switch
Skip syncing global pages on cr3 switch (but not on cr4/cr0). This is important for Linux 32-bit guests with PAE, where the kmap page is marked as global. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r--arch/x86/kvm/x86.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 7a2aeba0bfbd..774db00d2db6 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -104,6 +104,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
104 { "mmu_recycled", VM_STAT(mmu_recycled) }, 104 { "mmu_recycled", VM_STAT(mmu_recycled) },
105 { "mmu_cache_miss", VM_STAT(mmu_cache_miss) }, 105 { "mmu_cache_miss", VM_STAT(mmu_cache_miss) },
106 { "mmu_unsync", VM_STAT(mmu_unsync) }, 106 { "mmu_unsync", VM_STAT(mmu_unsync) },
107 { "mmu_unsync_global", VM_STAT(mmu_unsync_global) },
107 { "remote_tlb_flush", VM_STAT(remote_tlb_flush) }, 108 { "remote_tlb_flush", VM_STAT(remote_tlb_flush) },
108 { "largepages", VM_STAT(lpages) }, 109 { "largepages", VM_STAT(lpages) },
109 { NULL } 110 { NULL }
@@ -315,6 +316,7 @@ void kvm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0)
315 kvm_x86_ops->set_cr0(vcpu, cr0); 316 kvm_x86_ops->set_cr0(vcpu, cr0);
316 vcpu->arch.cr0 = cr0; 317 vcpu->arch.cr0 = cr0;
317 318
319 kvm_mmu_sync_global(vcpu);
318 kvm_mmu_reset_context(vcpu); 320 kvm_mmu_reset_context(vcpu);
319 return; 321 return;
320} 322}
@@ -358,6 +360,7 @@ void kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
358 } 360 }
359 kvm_x86_ops->set_cr4(vcpu, cr4); 361 kvm_x86_ops->set_cr4(vcpu, cr4);
360 vcpu->arch.cr4 = cr4; 362 vcpu->arch.cr4 = cr4;
363 kvm_mmu_sync_global(vcpu);
361 kvm_mmu_reset_context(vcpu); 364 kvm_mmu_reset_context(vcpu);
362} 365}
363EXPORT_SYMBOL_GPL(kvm_set_cr4); 366EXPORT_SYMBOL_GPL(kvm_set_cr4);
@@ -4113,6 +4116,7 @@ struct kvm *kvm_arch_create_vm(void)
4113 return ERR_PTR(-ENOMEM); 4116 return ERR_PTR(-ENOMEM);
4114 4117
4115 INIT_LIST_HEAD(&kvm->arch.active_mmu_pages); 4118 INIT_LIST_HEAD(&kvm->arch.active_mmu_pages);
4119 INIT_LIST_HEAD(&kvm->arch.oos_global_pages);
4116 INIT_LIST_HEAD(&kvm->arch.assigned_dev_head); 4120 INIT_LIST_HEAD(&kvm->arch.assigned_dev_head);
4117 4121
4118 /* Reserve bit 0 of irq_sources_bitmap for userspace irq source */ 4122 /* Reserve bit 0 of irq_sources_bitmap for userspace irq source */