All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Yu Zhang <yu.c.zhang@linux.intel.com>
Cc: pbonzini@redhat.com, vkuznets@redhat.com, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org, wanpengli@tencent.com,
	jmattson@google.com, joro@8bytes.org
Subject: Re: [PATCH] KVM: nVMX: Reset vmxon_ptr upon VMXOFF emulation.
Date: Thu, 9 Sep 2021 16:20:35 +0000	[thread overview]
Message-ID: <YTo0U0ae3shRbUYC@google.com> (raw)
In-Reply-To: <20210909124846.13854-1-yu.c.zhang@linux.intel.com>

On Thu, Sep 09, 2021, Yu Zhang wrote:
> From: Vitaly Kuznetsov <vkuznets@redhat.com>
> 
> Currently, 'vmx->nested.vmxon_ptr' is not reset upon VMXOFF
> emulation. This is not a problem per se as we never access
> it when !vmx->nested.vmxon. But this should be done to avoid
> any issue in the future.
> 
> Also, initialize the vmxon_ptr when vcpu is created.
> 
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> Signed-off-by: Yu Zhang <yu.c.zhang@linux.intel.com>
> ---
>  arch/x86/kvm/vmx/nested.c | 1 +
>  arch/x86/kvm/vmx/vmx.c    | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
> index 90f34f12f883..e4260f67caac 100644
> --- a/arch/x86/kvm/vmx/nested.c
> +++ b/arch/x86/kvm/vmx/nested.c
> @@ -289,6 +289,7 @@ static void free_nested(struct kvm_vcpu *vcpu)
>  	kvm_clear_request(KVM_REQ_GET_NESTED_STATE_PAGES, vcpu);
>  
>  	vmx->nested.vmxon = false;
> +	vmx->nested.vmxon_ptr = -1ull;

Looks like the "-1ull" comes from current_vmptr and friends, but using INVALID_GPA
is more appropriate.  It's the same value, but less arbitrary.  The other usage of
-1ull for guest physical addresses should really be cleaned up, too.

  parent reply	other threads:[~2021-09-09 16:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-09 12:48 [PATCH] KVM: nVMX: Reset vmxon_ptr upon VMXOFF emulation Yu Zhang
2021-09-09  5:19 ` Vitaly Kuznetsov
2021-09-09  7:22   ` Yu Zhang
2021-09-09 16:20 ` Sean Christopherson [this message]
2021-09-09 16:46   ` Yu Zhang

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=YTo0U0ae3shRbUYC@google.com \
    --to=seanjc@google.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.com \
    --cc=yu.c.zhang@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.