All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <sean.j.christopherson@intel.com>
To: Krish Sadhukhan <krish.sadhukhan@oracle.com>
Cc: kvm@vger.kernel.org, rkrcmar@redhat.com, pbonzini@redhat.com,
	jmattson@google.com
Subject: Re: [PATCH 0/5] KVM: nVMX: Skip vmentry checks that are necessary only if VMCS12 is dirty
Date: Mon, 8 Jul 2019 11:17:59 -0700	[thread overview]
Message-ID: <20190708181759.GB20791@linux.intel.com> (raw)
In-Reply-To: <20190707071147.11651-1-krish.sadhukhan@oracle.com>

On Sun, Jul 07, 2019 at 03:11:42AM -0400, Krish Sadhukhan wrote:
> The following functions,
> 
> 	nested_vmx_check_controls
> 	nested_vmx_check_host_state
> 	nested_vmx_check_guest_state
> 
> do a number of vmentry checks for VMCS12. However, not all of these checks need
> to be executed on every vmentry. This patchset makes some of these vmentry
> checks optional based on the state of VMCS12 in that if VMCS12 is dirty, only
> then the checks will be executed. This will reduce performance impact on
> vmentry of nested guests.

All of these patches break vmx_set_nested_state(), which sets dirty_vmcs12
only after the aforementioned consistency checks pass.

The new nomenclature for the dirty paths is "rare", not "full".

In general, I dislike directly associating the consistency checks with
dirty_vmcs12.

  - It's difficult to assess the correctness of the resulting code, e.g.
    changing CPU_BASED_VM_EXEC_CONTROL doesn't set dirty_vmcs12, which
    calls into question any and all SECONDARY_VM_EXEC_CONTROL checks since
    an L1 could toggle CPU_BASED_ACTIVATE_SECONDARY_CONTROLS.

  - We lose the existing organization of the consistency checks, e.g.
    similar checks get arbitrarily split into separate flows based on
    the rarity of the field changing.

  - The performance gains are likely minimal since the majority of checks
    can't be skipped due to the coarseness of dirty_vmcs12.

Rather than a quick and dirty (pun intended) change to use dirty_vmcs12,
I think we should have some amount of dedicated infrastructure for
optimizing consistency checks from the get go, e.g. perhaps something
similar to how eVMCS categorizes fields.  The initial usage could be very
coarse grained, e.g. based purely on dirty_vmcs12, but having the
infrastructure would make it easier to reason about the correctness of
the code.  Future patches could then refine the triggerring of checks to
achieve better optimization, e.g. skipping the vast majority of checks
when L1 is simply toggling CPU_BASED_VIRTUAL_INTR_PENDING.

  parent reply	other threads:[~2019-07-08 18:18 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-07  7:11 [PATCH 0/5] KVM: nVMX: Skip vmentry checks that are necessary only if VMCS12 is dirty Krish Sadhukhan
2019-07-07  7:11 ` [PATCH 1/5] KVM: nVMX: Skip VM-Execution Control " Krish Sadhukhan
2019-07-07  7:11 ` [PATCH 2/5] KVM: nVMX: Skip VM-Exit " Krish Sadhukhan
2019-07-10 14:28   ` Paolo Bonzini
2019-07-10 19:18     ` Krish Sadhukhan
2019-07-10 20:11       ` Sean Christopherson
2019-07-07  7:11 ` [PATCH 3/5] KVM: nVMX: Skip VM-Entry Control " Krish Sadhukhan
2019-07-10 16:28   ` Paolo Bonzini
2019-07-07  7:11 ` [PATCH 4/5] KVM: nVMX: Skip Host State Area vmentry " Krish Sadhukhan
2019-07-10 16:26   ` Paolo Bonzini
2019-07-07  7:11 ` [PATCH 5/5] KVM: nVMX: Skip Guest " Krish Sadhukhan
2019-07-10 16:33   ` Paolo Bonzini
2019-07-10 19:34     ` Krish Sadhukhan
2019-07-08 18:17 ` Sean Christopherson [this message]
2019-07-09 22:50   ` [PATCH 0/5] KVM: nVMX: Skip " Krish Sadhukhan
2019-07-10 14:35   ` Paolo Bonzini
2019-07-10 16:15     ` Sean Christopherson
2019-07-10 16:33       ` 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=20190708181759.GB20791@linux.intel.com \
    --to=sean.j.christopherson@intel.com \
    --cc=jmattson@google.com \
    --cc=krish.sadhukhan@oracle.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.