All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kechen Lu <kechenl@nvidia.com>
To: <kvm@vger.kernel.org>, <pbonzini@redhat.com>, <seanjc@google.com>
Cc: <wanpengli@tencent.com>, <vkuznets@redhat.com>, <mst@redhat.com>,
	<somduttar@nvidia.com>, <kechenl@nvidia.com>,
	<linux-kernel@vger.kernel.org>
Subject: [RFC PATCH v2 0/3] KVM: x86: add per-vCPU exits disable capability
Date: Tue, 21 Dec 2021 01:04:46 -0800	[thread overview]
Message-ID: <20211221090449.15337-1-kechenl@nvidia.com> (raw)

Summary
===========
Introduce support of vCPU-scoped ioctl with KVM_CAP_X86_DISABLE_EXITS
cap for disabling exits to enable finer-grained VM exits disabling
on per vCPU scales instead of whole guest. This patch series enabled
the vCPU-scoped exits control on HLT VM-exits.

Motivation
============
In use cases like Windows guest running heavy CPU-bound
workloads, disabling HLT VM-exits could mitigate host sched ctx switch
overhead. Simply HLT disabling on all vCPUs could bring
performance benefits, but if no pCPUs reserved for host threads, could
happened to the forced preemption as host does not know the time to do
the schedule for other host threads want to run. With this patch, we
could only disable part of vCPUs HLT exits for one guest, this still
keeps performance benefits, and also shows resiliency to host stressing
workload running at the same time.

Performance and Testing
=========================
In the host stressing workload experiment with Windows guest heavy
CPU-bound workloads, it shows good resiliency and having the ~3%
performance improvement. E.g. Passmark running in a Windows guest
with this patch disabling HLT exits on only half of vCPUs still
showing 2.4% higher main score v/s baseline.

Tested everything on AMD machines.


v1->v2 (Sean Christopherson) :
- Add explicit restriction for VM-scoped exits disabling to be called
  before vCPUs creation (patch 1)
- Use vCPU ioctl instead of 64bit vCPU bitmask (patch 3), and make exits
  disable flags check purely for vCPU instead of VM (patch 2)


Best Regards,
Kechen

Kechen Lu (3):
  KVM: x86: only allow exits disable before vCPUs created
  KVM: x86: move ()_in_guest checking to vCPU scope
  KVM: x86: add vCPU ioctl for HLT exits disable capability

 Documentation/virt/kvm/api.rst     |  4 +++-
 arch/x86/include/asm/kvm-x86-ops.h |  1 +
 arch/x86/include/asm/kvm_host.h    |  7 +++++++
 arch/x86/kvm/cpuid.c               |  2 +-
 arch/x86/kvm/lapic.c               |  2 +-
 arch/x86/kvm/svm/svm.c             | 20 +++++++++++++++-----
 arch/x86/kvm/vmx/vmx.c             | 26 ++++++++++++++++++--------
 arch/x86/kvm/x86.c                 | 24 +++++++++++++++++++++++-
 arch/x86/kvm/x86.h                 | 16 ++++++++--------
 9 files changed, 77 insertions(+), 25 deletions(-)

-- 
2.30.2


             reply	other threads:[~2021-12-21  9:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-21  9:04 Kechen Lu [this message]
2021-12-21  9:04 ` [RFC PATCH v2 1/3] KVM: x86: only allow exits disable before vCPUs created Kechen Lu
2022-01-10 18:50   ` Sean Christopherson
2022-01-11  6:38     ` Kechen Lu
2021-12-21  9:04 ` [RFC PATCH v2 2/3] KVM: x86: move ()_in_guest checking to vCPU scope Kechen Lu
2022-01-10 19:35   ` Sean Christopherson
2022-01-11  6:37     ` Kechen Lu
2021-12-21  9:04 ` [RFC PATCH v2 3/3] KVM: x86: add vCPU ioctl for HLT exits disable capability Kechen Lu
2022-01-10 20:56   ` Sean Christopherson
2022-01-10 21:00     ` Sean Christopherson
2022-01-11  6:36       ` Kechen Lu
2022-01-11  6:35     ` Kechen Lu
2022-01-10 21:18 ` [RFC PATCH v2 0/3] KVM: x86: add per-vCPU " Michael S. Tsirkin
2022-01-11  6:34   ` Kechen Lu

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=20211221090449.15337-1-kechenl@nvidia.com \
    --to=kechenl@nvidia.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=somduttar@nvidia.com \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.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.