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
Subject: Re: [PATCH 12/13] KVM: nVMX: Don't mark vmcs12 as dirty when L1 writes pin controls
Date: Thu, 6 Jun 2019 12:05:37 -0700 [thread overview]
Message-ID: <20190606190537.GL23169@linux.intel.com> (raw)
In-Reply-To: <496e9a1f-620e-d09c-c9d3-c490e289ec2e@redhat.com>
On Thu, Jun 06, 2019 at 07:24:38PM +0200, Paolo Bonzini wrote:
> On 07/05/19 21:18, Sean Christopherson wrote:
> > Pin controls doesn't affect dirty logic, e.g. the preemption timer value
> > is loaded from vmcs12 even if vmcs12 is "clean", i.e. there is no need
> > to mark vmcs12 dirty when L1 writes pin controls.
> >
> > KVM currently toggles the VMX_PREEMPTION_TIMER control flag when it
> > disables or enables the timer. The VMWRITE to toggle the flag can be
> > responsible for a large percentage of vmcs12 dirtying when running KVM
> > as L1 (depending on the behavior of L2).
> >
> > Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
>
> I think either we wait for patch 13 to get in the wild so that
> VMX_PREEMPTION_TIMER writes do not become so frequent, or we can do
> something like
I'd prefer to get something in now. I assume a fair number of users will
be running current/older versions of KVM as L1 for years to come.
I have no objection to shadowing pin controls. I opted for the cheesy
approach because I couldn't provide numbers that actually showed a
performance improvement by shadowing.
> --------- 8< ------------
> From: Paolo Bonzini <pbonzini@redhat.com>
> Subject: [PATCH] KVM: nVMX: shadow pin based execution controls
>
> The VMX_PREEMPTION_TIMER flag may be toggled frequently, though not
> *very* frequently. Since it does not affect KVM's dirty logic, e.g.
> the preemption timer value is loaded from vmcs12 even if vmcs12 is
> "clean", there is no need to mark vmcs12 dirty when L1 writes pin
> controls, and shadowing the field achieves that.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>
> diff --git a/arch/x86/kvm/vmx/vmcs_shadow_fields.h
> b/arch/x86/kvm/vmx/vmcs_shadow_fields.h
> index 4cea018ba285..eb1ecd16fd22 100644
> --- a/arch/x86/kvm/vmx/vmcs_shadow_fields.h
> +++ b/arch/x86/kvm/vmx/vmcs_shadow_fields.h
> @@ -47,6 +47,7 @@
> SHADOW_FIELD_RO(GUEST_CS_AR_BYTES, guest_cs_ar_bytes)
> SHADOW_FIELD_RO(GUEST_SS_AR_BYTES, guest_ss_ar_bytes)
> SHADOW_FIELD_RW(CPU_BASED_VM_EXEC_CONTROL, cpu_based_vm_exec_control)
> +SHADOW_FIELD_RW(PIN_BASED_VM_EXEC_CONTROL, pin_based_vm_exec_control)
> SHADOW_FIELD_RW(EXCEPTION_BITMAP, exception_bitmap)
> SHADOW_FIELD_RW(VM_ENTRY_EXCEPTION_ERROR_CODE,
> vm_entry_exception_error_code)
> SHADOW_FIELD_RW(VM_ENTRY_INTR_INFO_FIELD, vm_entry_intr_info_field)
next prev parent reply other threads:[~2019-06-06 19:05 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-07 19:17 [PATCH 00/13] KVM: VMX: Reduce VMWRITEs to VMCS controls Sean Christopherson
2019-05-07 19:17 ` [PATCH 01/13] KVM: nVMX: Use adjusted pin controls for vmcs02 Sean Christopherson
2019-06-06 16:55 ` Paolo Bonzini
2019-05-07 19:17 ` [PATCH 02/13] KVM: VMX: Add builder macros for shadowing controls Sean Christopherson
2019-05-07 19:17 ` [PATCH 03/13] KVM: VMX: Shadow VMCS pin controls Sean Christopherson
2019-05-07 19:17 ` [PATCH 04/13] KVM: VMX: Shadow VMCS primary execution controls Sean Christopherson
2019-05-07 19:17 ` [PATCH 05/13] KVM: VMX: Shadow VMCS secondary " Sean Christopherson
2019-06-06 16:59 ` Paolo Bonzini
2019-05-07 19:17 ` [PATCH 06/13] KVM: nVMX: Shadow VMCS controls on a per-VMCS basis Sean Christopherson
2019-05-07 19:17 ` [PATCH 07/13] KVM: nVMX: Don't reset VMCS controls shadow on VMCS switch Sean Christopherson
2019-05-07 19:18 ` [PATCH 08/13] KVM: VMX: Explicitly initialize controls shadow at VMCS allocation Sean Christopherson
2019-05-07 19:18 ` [PATCH 09/13] KVM: nVMX: Preserve last USE_MSR_BITMAPS when preparing vmcs02 Sean Christopherson
2019-06-06 17:12 ` Paolo Bonzini
2019-05-07 19:18 ` [PATCH 10/13] KVM: nVMX: Preset *DT exiting in vmcs02 when emulating UMIP Sean Christopherson
2019-06-06 17:15 ` Paolo Bonzini
2019-05-07 19:18 ` [PATCH 11/13] KVM: VMX: Drop hv_timer_armed from 'struct loaded_vmcs' Sean Christopherson
2019-05-07 19:18 ` [PATCH 12/13] KVM: nVMX: Don't mark vmcs12 as dirty when L1 writes pin controls Sean Christopherson
2019-06-06 17:16 ` Paolo Bonzini
2019-06-06 17:24 ` Paolo Bonzini
2019-06-06 19:05 ` Sean Christopherson [this message]
2019-05-07 19:18 ` [PATCH 13/13] KVM: VMX: Leave preemption timer running when it's disabled Sean Christopherson
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=20190606190537.GL23169@linux.intel.com \
--to=sean.j.christopherson@intel.com \
--cc=kvm@vger.kernel.org \
--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.