Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5093768yba; Wed, 8 May 2019 07:48:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqysPEKjf5z081qTlrRk7vxR5v2P1DSgDAc2vxPZpoGGu6/A1VrjF8OUBw1viWH9eMZpkeNr X-Received: by 2002:a63:224a:: with SMTP id t10mr2290060pgm.271.1557326911657; Wed, 08 May 2019 07:48:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557326911; cv=none; d=google.com; s=arc-20160816; b=it23jLD6jzMEOucWSoNzHuYesvlpF0kdd2e7+OwU1/05q6l8ORnSUBev3/yt3sJ4r4 YJWbubvdggSLcpSZfq7gRUeOE/k2fJvS6SRc4Wt2DMmLhzp7yrw8Dah7yd284l+q998T llZRC1Nol6wQ7nPBPL1QCS4/vpO05RPVlN11yCtGjTVNHzr4DBgbY056xjnyOChI3crY HwCGork+oDmFNsUgGc22w8LYarDcGF2VMHh0Y8P/05Duet/khYANA6CRUNtNsYz+EM7O AfgWswcIv8hOPdGWpVocQS1JETJkAzEvfnSmioM/1o1ttINRY7PmSpBIBV5YIfxvpDGp 1Fwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=GVvua4yh6ClmqZFfBRe+zNB87URDBhIho46zwA01IsQ=; b=J/x7NbGCBQb6gdDk/sZ8TCP25u4RN0Kn/knhQhiklTjPky9wg1vBVA6OF4N6sC7t/s wucmZzJ7RHN+kAJjeqcBAcXjzsW3iq0kEp4X//6YKvz/AlghcGoyLyUa4GC51hlohwPk HoWM1yb5eCEpR+LbnxEDhYG6Jrw/0zlfe8Y5uZuSQmj0WBOvVk25lEV/NJJC+eCgyA5A G+ydePMt9MdOmsuf7jg0KOat3w3Uto7NCnZeBa7pvhyP3RnwmutBqULlClJxgfRRyOL5 Ikfa9c+TT8I2OWfxstwgGjxxVM7xDYC1SZKuYdnO3BozUgPmx8FM+lsIP66snEmxMcGt DhNg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r23si21800930pgv.471.2019.05.08.07.48.15; Wed, 08 May 2019 07:48:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727144AbfEHOUY (ORCPT + 99 others); Wed, 8 May 2019 10:20:24 -0400 Received: from mga04.intel.com ([192.55.52.120]:60209 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726700AbfEHOUY (ORCPT ); Wed, 8 May 2019 10:20:24 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 May 2019 07:20:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,446,1549958400"; d="scan'208";a="169650244" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.36]) by fmsmga002.fm.intel.com with ESMTP; 08 May 2019 07:20:23 -0700 Date: Wed, 8 May 2019 07:20:23 -0700 From: Sean Christopherson To: Paolo Bonzini Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Peter Shier , Aaron Lewis Subject: Re: [PATCH v2] kvm: nVMX: Set nested_run_pending in vmx_set_nested_state after checks complete Message-ID: <20190508142023.GA13834@linux.intel.com> References: <1557317799-39866-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1557317799-39866-1-git-send-email-pbonzini@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 08, 2019 at 02:16:39PM +0200, Paolo Bonzini wrote: > From: Aaron Lewis If this is actually attributed to Aaron it needs his SOB. > nested_run_pending=1 implies we have successfully entered guest mode. > Move setting from external state in vmx_set_nested_state() until after > all other checks are complete. It'd be helpful to at least mention the flag is consumed by nested_vmx_enter_non_root_mode(). > Based on a patch by Aaron Lewis. > > Signed-off-by: Paolo Bonzini > --- For the code itself: Reviewed-by: Sean Christopherson > arch/x86/kvm/vmx/nested.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c > index cec77f30f61c..e58caff92694 100644 > --- a/arch/x86/kvm/vmx/nested.c > +++ b/arch/x86/kvm/vmx/nested.c > @@ -5420,9 +5420,6 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu, > if (!(kvm_state->flags & KVM_STATE_NESTED_GUEST_MODE)) > return 0; > > - vmx->nested.nested_run_pending = > - !!(kvm_state->flags & KVM_STATE_NESTED_RUN_PENDING); > - > if (nested_cpu_has_shadow_vmcs(vmcs12) && > vmcs12->vmcs_link_pointer != -1ull) { > struct vmcs12 *shadow_vmcs12 = get_shadow_vmcs12(vcpu); > @@ -5446,9 +5443,14 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu, > return -EINVAL; > > vmx->nested.dirty_vmcs12 = true; > + vmx->nested.nested_run_pending = > + !!(kvm_state->flags & KVM_STATE_NESTED_RUN_PENDING); > + > ret = nested_vmx_enter_non_root_mode(vcpu, false); > - if (ret) > + if (ret) { > + vmx->nested.nested_run_pending = 0; > return -EINVAL; > + } > > return 0; > } > -- > 1.8.3.1 >