Re: [PATCH] KVM: VMX: Fix vm entry failure caused by invalid vmexit controls

From: Changbin Du
Date: Tue Jan 22 2019 - 19:49:40 EST


On Tue, Jan 22, 2019 at 09:00:45AM -0800, Sean Christopherson wrote:
> On Tue, Jan 22, 2019 at 11:29:52PM +0800, Changbin Du wrote:
> > The commit c73da3f ("KVM: VMX: Properly handle dynamic VM Entry/Exit
> > controls") has a typo that cause invalid vmexit controls. The
> > VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL is against _vmentry_control.
> >
> > KVM: entry failed, hardware error 0x7
> > EAX=00000000 EBX=00000000 ECX=00000000 EDX=000206c2
> > ESI=00000000 EDI=00000000 EBP=00000000 ESP=00000000
> > EIP=0000fff0 EFL=00000002 [-------] CPL=0 II=0 A20=1 SMM=0 HLT=0
> > ES =0000 00000000 0000ffff 00009300
> > CS =f000 ffff0000 0000ffff 00009b00
> > SS =0000 00000000 0000ffff 00009300
> > DS =0000 00000000 0000ffff 00009300
> > FS =0000 00000000 0000ffff 00009300
> > GS =0000 00000000 0000ffff 00009300
> > LDT=0000 00000000 0000ffff 00008200
> > TR =0000 00000000 0000ffff 00008b00
> > GDT= 00000000 0000ffff
> > IDT= 00000000 0000ffff
> > CR0=60000010 CR2=00000000 CR3=00000000 CR4=00000000
> > DR0=0000000000000000 DR1=0000000000000000 DR2=0000000000000000
> > DR3=0000000000000000 DR6=00000000ffff0ff0 DR7=0000000000000400
> > EFER=0000000000000000
> >
> > Fixes: c73da3f ("KVM: VMX: Properly handle dynamic VM Entry/Exit controls")
> > Signed-off-by: Changbin Du <changbin.du@xxxxxxxxx>
>
> Patch already submitted[1].
>
> Paolo/Radim, the VM-Exit fix needs to be queued asap. The fix for the
> objtool warning[2] should also go into v5.0.
>
echo. This bug breaks kvm on some old machines!

> [1] https://patchwork.kernel.org/patch/10763351/
> [2] https://patchwork.kernel.org/patch/10765309/
>
>
>
> > ---
> > arch/x86/kvm/vmx/vmx.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> > index f6915f10e584..0762fcab8fc9 100644
> > --- a/arch/x86/kvm/vmx/vmx.c
> > +++ b/arch/x86/kvm/vmx/vmx.c
> > @@ -2344,7 +2344,7 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf,
> > case 37: /* AAT100 */
> > case 44: /* BC86,AAY89,BD102 */
> > case 46: /* BA97 */
> > - _vmexit_control &= ~VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL;
> > + _vmentry_control &= ~VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL;
> > _vmexit_control &= ~VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL;
> > pr_warn_once("kvm: VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL "
> > "does not work properly. Using workaround\n");
> > --
> > 2.19.1
> >

--
Cheers,
Changbin Du