public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <sean.j.christopherson@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Radim Krčmář" <rkrcmar@redhat.com>,
	kvm@vger.kernel.org, "Nadav Amit" <nadav.amit@gmail.com>,
	"Liran Alon" <liran.alon@oracle.com>,
	"Vitaly Kuznetsov" <vkuznets@redhat.com>
Subject: Re: [PATCH 06/15] KVM: nVMX: Don't "put" vCPU or host state when switching VMCS
Date: Fri, 7 Jun 2019 10:08:32 -0700	[thread overview]
Message-ID: <20190607170832.GF9083@linux.intel.com> (raw)
In-Reply-To: <10df352d-d90b-8594-cc1c-5a5f8df689f7@redhat.com>

On Fri, Jun 07, 2019 at 07:00:06PM +0200, Paolo Bonzini wrote:
> On 06/06/19 20:57, Sean Christopherson wrote:
> > What about taking the vmcs pointers, and using old/new instead of
> > prev/cur?  Calling it prev is wonky since it's pulled from the current
> > value of loaded_cpu_state, especially since cur is the same type.
> > That oddity is also why I grabbed prev before setting loaded_vmcs,
> > it just felt wrong even though they really are two separate things.
> > 
> > static void vmx_sync_vmcs_host_state(struct vcpu_vmx *vmx,
> > 				     struct loaded_vmcs *old,
> > 				     struct loaded_vmcs *new)
> 
> I had it like that in the beginning actually.  But the idea of this
> function is that because we're switching vmcs's, the host register
> fields have to be moved to the VMCS that will be used next.  I don't see
> how it would be used with old and new being anything other than
> vmx->loaded_cpu_state and vmx->loaded_vmcs and, because we're switching
> VMCS, those are the "previously" active VMCS and the "currently" active
> VMCS.
> 
> What would also make sense, is to change loaded_cpu_state to a bool (it
> must always be equal to loaded_vmcs anyway) and make the prototype
> something like this:
> 
> static void vmx_sync_vmcs_host_state(struct vcpu_vmx *vmx,
> 				     struct loaded_vmcs *prev)
> 
> 
> I'll send a patch.

Works for me.  The only reason I made loaded_cpu_state was so that
vmx_prepare_switch_to_host() could WARN on it diverging from loaded_vmcs.
Seeing as how that WARN has never fired, I'm comfortable making it a bool.

  reply	other threads:[~2019-06-07 17:08 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-07 16:06 [PATCH 00/15] KVM: nVMX: Optimize nested VM-Entry Sean Christopherson
2019-05-07 16:06 ` [PATCH 01/15] KVM: nVMX: Don't dump VMCS if virtual APIC page can't be mapped Sean Christopherson
2019-05-07 20:09   ` Paolo Bonzini
2019-05-07 16:06 ` [PATCH 02/15] KVM: VMX: Always signal #GP on WRMSR to MSR_IA32_CR_PAT with bad value Sean Christopherson
2019-05-07 16:06 ` [PATCH 03/15] KVM: nVMX: Always sync GUEST_BNDCFGS when it comes from vmcs01 Sean Christopherson
2019-05-07 16:06 ` [PATCH 04/15] KVM: nVMX: Write ENCLS-exiting bitmap once per vmcs02 Sean Christopherson
2019-05-07 16:06 ` [PATCH 05/15] KVM: nVMX: Don't rewrite GUEST_PML_INDEX during nested VM-Entry Sean Christopherson
2019-06-06 15:49   ` Paolo Bonzini
2019-05-07 16:06 ` [PATCH 06/15] KVM: nVMX: Don't "put" vCPU or host state when switching VMCS Sean Christopherson
2019-06-06 16:24   ` Paolo Bonzini
2019-06-06 18:57     ` Sean Christopherson
2019-06-07 17:00       ` Paolo Bonzini
2019-06-07 17:08         ` Sean Christopherson [this message]
2019-05-07 16:06 ` [PATCH 07/15] KVM: nVMX: Don't reread VMCS-agnostic " Sean Christopherson
2019-05-07 21:01   ` Paolo Bonzini
2019-05-07 16:06 ` [PATCH 08/15] KVM: nVMX: Don't speculatively write virtual-APIC page address Sean Christopherson
2019-05-07 16:06 ` [PATCH 09/15] KVM: nVMX: Don't speculatively write APIC-access " Sean Christopherson
2019-05-07 16:06 ` [PATCH 10/15] KVM: nVMX: Update vmcs12 for MSR_IA32_CR_PAT when it's written Sean Christopherson
2019-05-07 16:06 ` [PATCH 11/15] KVM: nVMX: Update vmcs12 for SYSENTER MSRs when they're written Sean Christopherson
2019-06-06 16:35   ` Paolo Bonzini
2019-05-07 16:06 ` [PATCH 12/15] KVM: nVMX: Update vmcs12 for MSR_IA32_DEBUGCTLMSR when it's written Sean Christopherson
2019-05-07 16:06 ` [PATCH 13/15] KVM: nVMX: Update vmcs02 GUEST_IA32_DEBUGCTL only when vmcs12 is dirty Sean Christopherson
2019-06-06 16:39   ` Paolo Bonzini
2019-05-07 16:06 ` [PATCH 14/15] KVM: nVMX: Don't update GUEST_BNDCFGS if it's clean in HV eVMCS Sean Christopherson
2019-05-07 16:06 ` [PATCH 15/15] KVM: nVMX: Copy PDPTRs to/from vmcs12 only when necessary Sean Christopherson
2019-06-06 16:53   ` Paolo Bonzini
2019-06-06 16:54 ` [PATCH 00/15] KVM: nVMX: Optimize nested VM-Entry 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=20190607170832.GF9083@linux.intel.com \
    --to=sean.j.christopherson@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=liran.alon@oracle.com \
    --cc=nadav.amit@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    --cc=vkuznets@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