summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/vmx.c
diff options
context:
space:
mode:
authorLongpeng(Mike)2017-08-08 06:05:33 +0200
committerPaolo Bonzini2017-08-08 10:57:43 +0200
commitde63ad4cf4973462953c29c363f3cfa7117c2b2d (patch)
treeb269d3a1c04045d9f4f7005f8004f7da082bf0be /arch/x86/kvm/vmx.c
parentKVM: add spinlock optimization framework (diff)
downloadkernel-qcow2-linux-de63ad4cf4973462953c29c363f3cfa7117c2b2d.tar.gz
kernel-qcow2-linux-de63ad4cf4973462953c29c363f3cfa7117c2b2d.tar.xz
kernel-qcow2-linux-de63ad4cf4973462953c29c363f3cfa7117c2b2d.zip
KVM: X86: implement the logic for spinlock optimization
get_cpl requires vcpu_load, so we must cache the result (whether the vcpu was preempted when its cpl=0) in kvm_vcpu_arch. Signed-off-by: Longpeng(Mike) <longpeng2@huawei.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r--arch/x86/kvm/vmx.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index fef784c22190..46d08b389e36 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -6781,7 +6781,13 @@ static int handle_pause(struct kvm_vcpu *vcpu)
if (ple_gap)
grow_ple_window(vcpu);
- kvm_vcpu_on_spin(vcpu, false);
+ /*
+ * Intel sdm vol3 ch-25.1.3 says: The "PAUSE-loop exiting"
+ * VM-execution control is ignored if CPL > 0. OTOH, KVM
+ * never set PAUSE_EXITING and just set PLE if supported,
+ * so the vcpu must be CPL=0 if it gets a PAUSE exit.
+ */
+ kvm_vcpu_on_spin(vcpu, true);
return kvm_skip_emulated_instruction(vcpu);
}