]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
KVM/VMX: Clear spec_ctrl status when resetting vcpu
authorPatrick Colp <patrick.colp@oracle.com>
Wed, 28 Mar 2018 01:30:49 +0000 (18:30 -0700)
committerJack Vogel <jack.vogel@oracle.com>
Thu, 29 Mar 2018 04:12:58 +0000 (21:12 -0700)
vmx->spec_ctrl was not set to 0 in vmx_vcpu_reset, which could result in
IBRS getting stuck on all the time, even with 'spectre_v2=off' set. This
was most notable when rebooting from an older kernel into a newer
retpoline-enabled kernel resulted in up to 80% CPU performance drop.

OraBug: 27774415

Suggested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Patrick Colp <patrick.colp@oracle.com>
Reviewed-by: Jack Vogel <jack.vogel@oracle.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
arch/x86/kvm/vmx.c

index 990a2bb920ac407bc66a62a450de08d331305753..acc269c9abc224b6137b1fa78fcfb6e0a667021a 100644 (file)
@@ -4769,6 +4769,7 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu)
        struct msr_data apic_base_msr;
 
        vmx->rmode.vm86_active = 0;
+       vmx->spec_ctrl = 0;
 
        vmx->vcpu.arch.regs[VCPU_REGS_RDX] = get_rdx_init_val();
        kvm_set_cr8(&vmx->vcpu, 0);