From: Wanpeng Li <kernellwp@gmail.com>
To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Radim Krčmář" <rkrcmar@redhat.com>
Subject: [PATCH 0/3] KVM: LAPIC: Implement Exitless Timer
Date: Wed, 5 Jun 2019 18:09:08 +0800 [thread overview]
Message-ID: <1559729351-20244-1-git-send-email-wanpengli@tencent.com> (raw)
Dedicated instances are currently disturbed by unnecessary jitter due
to the emulated lapic timers fire on the same pCPUs which vCPUs resident.
There is no hardware virtual timer on Intel for guest like ARM. Both
programming timer in guest and the emulated timer fires incur vmexits.
This patchset tries to avoid vmexit which is incurred by the emulated
timer fires in dedicated instance scenario.
When nohz_full is enabled in dedicated instances scenario, the unpinned
timer will be moved to the nearest busy housekeepers after commit 444969223c8
("sched/nohz: Fix affine unpinned timers mess"). However, KVM always makes
lapic timer pinned to the pCPU which vCPU residents, the reason is explained
by commit 61abdbe0 (kvm: x86: make lapic hrtimer pinned). Actually, these
emulated timers can be offload to the housekeeping cpus since APICv
is really common in recent years. The guest timer interrupt is injected by
posted-interrupt which is delivered by housekeeping cpu once the emulated
timer fires.
This patchset introduces a new kvm module parameter, it is false by default.
The host admin can enable it after fine tuned, e.g. dedicated instances
scenario w/ nohz_full cover the pCPUs which vCPUs resident, several pCPUs
surplus for housekeeping, disable mwait/hlt/pause vmexits to occupy the
pCPUs, fortunately preemption timer is disabled after mwait is exposed
to guest which makes emulated timer offload can be possible.
3%~5% redis performance benefit can be observed on Skylake server.
Wanpeng Li (3):
KVM: LAPIC: Make lapic timer unpinned when timer is injected by posted-interrupt
KVM: LAPIC: lapic timer is injected by posted interrupt
KVM: LAPIC: Ignore timer migration when lapic timer is injected by
posted-interrupt
arch/x86/include/asm/kvm_host.h | 1 +
arch/x86/kvm/lapic.c | 45 +++++++++++++++++++++++++++++++++++------
arch/x86/kvm/svm.c | 5 +++++
arch/x86/kvm/vmx/vmx.c | 9 +++++++++
4 files changed, 54 insertions(+), 6 deletions(-)
--
2.7.4
next reply other threads:[~2019-06-05 10:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-05 10:09 Wanpeng Li [this message]
2019-06-05 10:09 ` [PATCH 1/3] KVM: LAPIC: Make lapic timer unpinned when timer is injected by posted-interrupt Wanpeng Li
2019-06-05 13:04 ` Paolo Bonzini
2019-06-06 5:44 ` Wanpeng Li
2019-06-05 10:09 ` [PATCH 2/3] KVM: LAPIC: lapic timer is injected by posted interrupt Wanpeng Li
2019-06-05 12:30 ` Paolo Bonzini
2019-06-06 5:33 ` Wanpeng Li
2019-06-05 10:09 ` [PATCH 3/3] KVM: LAPIC: Ignore timer migration when lapic timer is injected by posted-interrupt Wanpeng Li
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=1559729351-20244-1-git-send-email-wanpengli@tencent.com \
--to=kernellwp@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).