public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Aaron Lewis <aaronlewis@google.com>
Cc: Peter Shier <pshier@google.com>,
	pbonzini@redhat.com, rkrcmar@redhat.com, jmattson@google.com,
	marcorr@google.com, kvm@vger.kernel.org
Subject: Re: [PATCH 2/3] KVM: nVMX: KVM_SET_NESTED_STATE - Tear down old EVMCS state before setting new state
Date: Fri, 03 May 2019 12:25:42 +0200	[thread overview]
Message-ID: <87zho37s2h.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <20190502183133.258026-1-aaronlewis@google.com>

Aaron Lewis <aaronlewis@google.com> writes:

> Move call to nested_enable_evmcs until after free_nested() is complete.
>
> Signed-off-by: Aaron Lewis <aaronlewis@google.com>
> Reviewed-by: Marc Orr <marcorr@google.com>
> Reviewed-by: Peter Shier <pshier@google.com>
> ---
>  arch/x86/kvm/vmx/nested.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
> index 081dea6e211a..3b39c60951ac 100644
> --- a/arch/x86/kvm/vmx/nested.c
> +++ b/arch/x86/kvm/vmx/nested.c
> @@ -5373,9 +5373,6 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu,
>  	if (kvm_state->format != 0)
>  		return -EINVAL;
>  
> -	if (kvm_state->flags & KVM_STATE_NESTED_EVMCS)
> -		nested_enable_evmcs(vcpu, NULL);
> -
>  	if (!nested_vmx_allowed(vcpu))
>  		return kvm_state->vmx.vmxon_pa == -1ull ? 0 : -EINVAL;
>  
> @@ -5417,6 +5414,9 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu,
>  	if (kvm_state->vmx.vmxon_pa == -1ull)
>  		return 0;
>  
> +	if (kvm_state->flags & KVM_STATE_NESTED_EVMCS)
> +		nested_enable_evmcs(vcpu, NULL);
> +
>  	vmx->nested.vmxon_ptr = kvm_state->vmx.vmxon_pa;
>  	ret = enter_vmx_operation(vcpu);
>  	if (ret)

nested_enable_evmcs() doesn't do much, actually, in case it was
previously enabled it doesn't do anything and in case it wasn't ordering
with free_nested() (where you're aiming at nested_release_evmcs() I
would guess) shouldn't matter. So could you please elaborate (better in
the commit message) why do we need this re-ordered? My guess is that
you'd like to perform checks for e.g. 'vmx.vmxon_pa == -1ull' before
we actually start doing any changes but let's clarify that.

Thanks!

-- 
Vitaly

  reply	other threads:[~2019-05-03 10:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-02 18:31 [PATCH 2/3] KVM: nVMX: KVM_SET_NESTED_STATE - Tear down old EVMCS state before setting new state Aaron Lewis
2019-05-03 10:25 ` Vitaly Kuznetsov [this message]
2019-05-08 19:21   ` Aaron Lewis
2019-05-08 19:54     ` Vitaly Kuznetsov
2019-05-08 21:18       ` Aaron Lewis
2019-05-15 16:42         ` Aaron Lewis
2019-05-15 18:48           ` Vitaly Kuznetsov

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=87zho37s2h.fsf@vitty.brq.redhat.com \
    --to=vkuznets@redhat.com \
    --cc=aaronlewis@google.com \
    --cc=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=marcorr@google.com \
    --cc=pbonzini@redhat.com \
    --cc=pshier@google.com \
    --cc=rkrcmar@redhat.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox