LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Sean Christopherson <sean.j.christopherson@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	Peter Shier <pshier@google.com>,
	Aaron Lewis <aaronlewis@google.com>
Subject: Re: [PATCH v2] kvm: nVMX: Set nested_run_pending in vmx_set_nested_state after checks complete
Date: Wed, 8 May 2019 07:20:23 -0700	[thread overview]
Message-ID: <20190508142023.GA13834@linux.intel.com> (raw)
In-Reply-To: <1557317799-39866-1-git-send-email-pbonzini@redhat.com>

On Wed, May 08, 2019 at 02:16:39PM +0200, Paolo Bonzini wrote:
> From: Aaron Lewis <aaronlewis@google.com>

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 <pbonzini@redhat.com>
> ---

For the code itself:

Reviewed-by: Sean Christopherson <sean.j.christopherson@intel.com> 

>  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
> 

  reply	other threads:[~2019-05-08 14:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-08 12:16 Paolo Bonzini
2019-05-08 14:20 ` Sean Christopherson [this message]
2019-05-08 17:53   ` Aaron Lewis
2019-05-08 18:13     ` Sean Christopherson
2019-05-08 21:13       ` Aaron Lewis
2019-05-15 16:44         ` Aaron Lewis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190508142023.GA13834@linux.intel.com \
    --to=sean.j.christopherson@intel.com \
    --cc=aaronlewis@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=pshier@google.com \
    --subject='Re: [PATCH v2] kvm: nVMX: Set nested_run_pending in vmx_set_nested_state after checks complete' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).