OpenCloudOS-Kernel/arch/x86/kvm
Avi Kivity 33f9c505ed KVM: VMX: Avoid rearranging switched guest msrs while they are loaded
KVM tries to run as much as possible with the guest msrs loaded instead of
host msrs, since switching msrs is very expensive.  It also tries to minimize
the number of msrs switched according to the guest mode; for example,
MSR_LSTAR is needed only by long mode guests.  This optimization is done by
setup_msrs().

However, we must not change which msrs are switched while we are running with
guest msr state:

 - switch to guest msr state
 - call setup_msrs(), removing some msrs from the list
 - switch to host msr state, leaving a few guest msrs loaded

An easy way to trigger this is to kexec an x86_64 linux guest.  Early during
setup, the guest will switch EFER to not include SCE.  KVM will stop saving
MSR_LSTAR, and on the next msr switch it will leave the guest LSTAR loaded.
The next host syscall will end up in a random location in the kernel.

Fix by reloading the host msrs before changing the msr list.

Signed-off-by: Avi Kivity <avi@qumranet.com>
2008-03-04 15:19:50 +02:00
..
Kconfig virtio: Put the virtio under the virtualization menu 2008-02-04 23:50:05 +11:00
Makefile KVM: Move ioapic code to common directory. 2008-01-30 18:01:19 +02:00
i8259.c KVM: Move arch dependent files to new directory arch/x86/kvm/ 2008-01-30 18:01:18 +02:00
irq.c KVM: Move kvm_vcpu_kick() to x86.c 2008-01-30 18:01:19 +02:00
irq.h KVM: Move apic timer migration away from critical section 2008-01-30 18:01:22 +02:00
kvm_svm.h KVM: Move arch dependent files to new directory arch/x86/kvm/ 2008-01-30 18:01:18 +02:00
lapic.c KVM: Avoid infinite-frequency local apic timer 2008-03-04 15:19:48 +02:00
lapic.h KVM: Accelerated apic support 2008-01-30 18:01:20 +02:00
mmu.c KVM: MMU: Fix race when instantiating a shadow pte 2008-03-04 15:19:49 +02:00
mmu.h KVM: Move arch dependent files to new directory arch/x86/kvm/ 2008-01-30 18:01:18 +02:00
paging_tmpl.h KVM: MMU: Fix race when instantiating a shadow pte 2008-03-04 15:19:49 +02:00
segment_descriptor.h KVM: Move arch dependent files to new directory arch/x86/kvm/ 2008-01-30 18:01:18 +02:00
svm.c KVM: SVM: fix Windows XP 64 bit installation crash 2008-03-04 15:19:45 +02:00
svm.h KVM: Move arch dependent files to new directory arch/x86/kvm/ 2008-01-30 18:01:18 +02:00
vmx.c KVM: VMX: Avoid rearranging switched guest msrs while they are loaded 2008-03-04 15:19:50 +02:00
vmx.h KVM: Move arch dependent files to new directory arch/x86/kvm/ 2008-01-30 18:01:18 +02:00
x86.c KVM: remove the usage of the mmap_sem for the protection of the memory slots. 2008-03-04 15:19:40 +02:00
x86_emulate.c KVM: Move arch dependent files to new directory arch/x86/kvm/ 2008-01-30 18:01:18 +02:00