From: Avi Kivity Date: Mon, 7 Mar 2011 12:54:28 +0000 (+0200) Subject: KVM: VMX: Optimize vmx_get_cpl() X-Git-Tag: MMI-PSA29.97-13-9~19664^2~128 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f4c63e5d5a356b652a3d984edbefca289176c40f;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git KVM: VMX: Optimize vmx_get_cpl() In long mode, vm86 mode is disallowed, so we need not check for it. Reading rflags.vm may require a VMREAD, so it is expensive. Signed-off-by: Avi Kivity --- diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 4d117072acf8..e8a35ee00735 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -2120,7 +2120,8 @@ static int vmx_get_cpl(struct kvm_vcpu *vcpu) if (!is_protmode(vcpu)) return 0; - if (kvm_get_rflags(vcpu) & X86_EFLAGS_VM) /* if virtual 8086 */ + if (!is_long_mode(vcpu) + && (kvm_get_rflags(vcpu) & X86_EFLAGS_VM)) /* if virtual 8086 */ return 3; return vmcs_read16(GUEST_CS_SELECTOR) & 3;