All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Liran Alon <liran.alon@oracle.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>
Subject: Re: [PATCH] x86/kvm/nVMCS: fix VMCLEAR when Enlightened VMCS is in use
Date: Tue, 25 Jun 2019 10:51:56 +0200	[thread overview]
Message-ID: <87lfxqdp3n.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <CEFF2A14-611A-417C-BC0A-8814862F26C6@oracle.com>

Liran Alon <liran.alon@oracle.com> writes:

>> On 24 Jun 2019, at 16:30, Vitaly Kuznetsov <vkuznets@redhat.com> wrote:
>> 
>> 
>> +bool nested_enlightened_vmentry(struct kvm_vcpu *vcpu, u64 *evmptr)
>
> I prefer to rename evmptr to evmcs_ptr. I think it’s more readable and sufficiently short.
> In addition, I think you should return either -1ull or assist_page.current_nested_vmcs.
> i.e. Don’t return evmcs_ptr by pointer but instead as a return-value
> and get rid of the bool.

Actually no, sorry, I'm having second thoughts here: in handle_vmclear()
we don't care about the value of evmcs_ptr, we only want to check that
enlightened vmentry bit is enabled in assist page. If we switch to
checking evmcs_ptr against '-1', for example, we will make '-1' a magic
value which is not in the TLFS. Windows may decide to use it for
something else - and we will get a hard-to-debug bug again.

If you still dislike nested_enlightened_vmentry() having the side effect
of fetching evmcs_ptr I can get rid of it by splitting the function into
two, however, it will be less efficient for
nested_vmx_handle_enlightened_vmptrld(). Or we can just leave things as
they are there and use the newly introduced function in handle_vmclear()
only.

-- 
Vitaly

  parent reply	other threads:[~2019-06-25  8:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-24 13:30 [PATCH] x86/kvm/nVMCS: fix VMCLEAR when Enlightened VMCS is in use Vitaly Kuznetsov
2019-06-24 13:41 ` Liran Alon
2019-06-24 14:16   ` Vitaly Kuznetsov
2019-06-24 14:45     ` Liran Alon
2019-06-26  9:39       ` Vitaly Kuznetsov
2019-06-26 12:10     ` Paolo Bonzini
2019-06-25  8:51   ` Vitaly Kuznetsov [this message]
2019-06-25 11:01     ` Liran Alon
2019-06-25 11:15       ` Vitaly Kuznetsov
2019-06-25 11:18         ` Liran Alon

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=87lfxqdp3n.fsf@vitty.brq.redhat.com \
    --to=vkuznets@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liran.alon@oracle.com \
    --cc=pbonzini@redhat.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 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.