From: Paolo Bonzini Subject: Re: [PATCH 1/3] kvm: nVMX: Don't set vmcs12 to "launched" when VMLAUNCH fails Date: Fri, 7 Jul 2017 10:39:00 +0200 Message-ID: References: <20170706233307.85493-1-jmattson@google.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit To: Jim Mattson , kvm@vger.kernel.org Return-path: Received: from mail-wr0-f195.google.com ([209.85.128.195]:35880 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752202AbdGGIjD (ORCPT ); Fri, 7 Jul 2017 04:39:03 -0400 Received: by mail-wr0-f195.google.com with SMTP id 77so6056683wrb.3 for ; Fri, 07 Jul 2017 01:39:03 -0700 (PDT) In-Reply-To: <20170706233307.85493-1-jmattson@google.com> Content-Language: en-US Sender: kvm-owner@vger.kernel.org List-ID: On 07/07/2017 01:33, Jim Mattson wrote: > The VMCS launch state is not set to "launched" unless the VMLAUNCH > actually succeeds. VMLAUNCH failure includes VM-exits with bit 31 set. > > Note that this change does not address the general problem that a > failure to launch/resume vmcs02 (i.e. vmx->fail) is not handled > correctly. > > Signed-off-by: Jim Mattson Reviewed-by: Paolo Bonzini > --- > arch/x86/kvm/vmx.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > index b4cfdcfdc1c1..8ab625feb46e 100644 > --- a/arch/x86/kvm/vmx.c > +++ b/arch/x86/kvm/vmx.c > @@ -10411,8 +10411,6 @@ static int enter_vmx_non_root_mode(struct kvm_vcpu *vcpu, bool from_vmentry) > return 1; > } > > - vmcs12->launch_state = 1; > - > /* > * Note no nested_vmx_succeed or nested_vmx_fail here. At this point > * we are no longer running L1, and VMLAUNCH/VMRESUME has not yet > @@ -10786,6 +10784,8 @@ static void prepare_vmcs12(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12, > vmcs12->vmx_instruction_info = vmcs_read32(VMX_INSTRUCTION_INFO); > > if (!(vmcs12->vm_exit_reason & VMX_EXIT_REASONS_FAILED_VMENTRY)) { > + vmcs12->launch_state = 1; > + > /* vm_entry_intr_info_field is cleared on exit. Emulate this > * instead of reading the real value. */ > vmcs12->vm_entry_intr_info_field &= ~INTR_INFO_VALID_MASK; >