linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Yu Zhang <yu.c.zhang@linux.intel.com>
Cc: seanjc@google.com, pbonzini@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: fix comments of handle_vmon()
Date: Wed, 08 Sep 2021 15:42:13 +0200	[thread overview]
Message-ID: <87ilzb4216.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <20210908130145.3uwmywgjaahyb6iw@linux.intel.com>

Yu Zhang <yu.c.zhang@linux.intel.com> writes:

> On Wed, Sep 08, 2021 at 11:55:59AM +0200, Vitaly Kuznetsov wrote:
>> Indeed,
>> 
>> Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
>> 
>> On a slightly related note: we don't seem to reset
>> 'vmx->nested.vmxon_ptr' upon VMXOFF emulation; this is not a problem per
>> se as we never access it when !vmx->nested.vmxon but I'd still suggest
>> we do something like
>> 
>> diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
>> index bc6327950657..8beb41d02d21 100644
>> --- a/arch/x86/kvm/vmx/nested.c
>> +++ b/arch/x86/kvm/vmx/nested.c
>> @@ -290,6 +290,7 @@ static void free_nested(struct kvm_vcpu *vcpu)
>>  
>>         vmx->nested.vmxon = false;
>>         vmx->nested.smm.vmxon = false;
>> +       vmx->nested.vmxon_ptr = -1ull;
>>         free_vpid(vmx->nested.vpid02);
>>         vmx->nested.posted_intr_nv = -1;
>>         vmx->nested.current_vmptr = -1ull;
>> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
>> index d7c5257eb5c0..2214e6bd4713 100644
>> --- a/arch/x86/kvm/vmx/vmx.c
>> +++ b/arch/x86/kvm/vmx/vmx.c
>> @@ -6884,6 +6884,7 @@ static int vmx_create_vcpu(struct kvm_vcpu *vcpu)
>>  
>>         vcpu_setup_sgx_lepubkeyhash(vcpu);
>>  
>> +       vmx->nested.vmxon_ptr = -1ull;
>>         vmx->nested.posted_intr_nv = -1;
>>         vmx->nested.current_vmptr = -1ull;
>>         vmx->nested.hv_evmcs_vmptr = EVMPTR_INVALID;
>> 
>> to avoid issues in the future.
>> 
> Thanks, Vitaly. And above suggestion sounds reasonable to me. :)
>
> I can add this in V2 later, if no one objects. 
>

Sure, this is rather a separate patch. Thanks!

-- 
Vitaly


  reply	other threads:[~2021-09-08 13:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-08 17:17 [PATCH] KVM: nVMX: fix comments of handle_vmon() Yu Zhang
2021-09-08  9:55 ` Vitaly Kuznetsov
2021-09-08 13:01   ` Yu Zhang
2021-09-08 13:42     ` Vitaly Kuznetsov [this message]
2021-09-09  5:13       ` Yu Zhang
2021-09-21 17:50 ` Paolo Bonzini

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=87ilzb4216.fsf@vitty.brq.redhat.com \
    --to=vkuznets@redhat.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=seanjc@google.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 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).