All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH] KVM: x86: allow KVM_REQ_GET_NESTED_STATE_PAGES outside guest mode for VMX
Date: Mon, 25 Jan 2021 11:53:38 -0800	[thread overview]
Message-ID: <YA8hwsL8SWzWEA0h@google.com> (raw)
In-Reply-To: <0b90c11b-0dce-60f3-c98d-3441b418e771@redhat.com>

On Mon, Jan 25, 2021, Paolo Bonzini wrote:
> On 25/01/21 20:16, Sean Christopherson wrote:
> > >   }
> > > +static bool vmx_get_nested_state_pages(struct kvm_vcpu *vcpu)
> > > +{
> > > +	if (!nested_get_evmcs_page(vcpu))
> > > +		return false;
> > > +
> > > +	if (is_guest_mode(vcpu) && !nested_get_vmcs12_pages(vcpu))
> > > +		return false;
> > nested_get_evmcs_page() will get called twice in the common case of
> > is_guest_mode() == true.  I can't tell if that will ever be fatal, but it's
> > definitely weird.  Maybe this?
> > 
> > 	if (!is_guest_mode(vcpu))
> > 		return nested_get_evmcs_page(vcpu);
> > 
> > 	return nested_get_vmcs12_pages(vcpu);
> > 
> 
> I wouldn't say there is a common case;

Eh, I would argue that it is more common to do KVM_REQ_GET_NESTED_STATE_PAGES
with is_guest_mode() than it is with !is_guest_mode(), as the latter is valid if
and only if eVMCS is in use.  But, I think we're only vying for internet points. :-)

> however the idea was to remove the call to nested_get_evmcs_page from
> nested_get_vmcs12_pages, since that one is only needed after
> KVM_GET_NESTED_STATE and not during VMLAUNCH/VMRESUME.

I'm confused, this patch explicitly adds a call to nested_get_evmcs_page() in
nested_get_vmcs12_pages().

  reply	other threads:[~2021-01-25 20:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-25 17:20 [PATCH] KVM: x86: allow KVM_REQ_GET_NESTED_STATE_PAGES outside guest mode for VMX Paolo Bonzini
2021-01-25 19:16 ` Sean Christopherson
2021-01-25 19:35   ` Paolo Bonzini
2021-01-25 19:53     ` Sean Christopherson [this message]
2021-01-25 21:59       ` 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=YA8hwsL8SWzWEA0h@google.com \
    --to=seanjc@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=stable@vger.kernel.org \
    /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.