[Devel] [PATCH RHEL7 COMMIT] ms/kvm: make halt_poll_ns per-vCPU
Konstantin Khorenko
khorenko at virtuozzo.com
Tue Apr 19 03:22:48 PDT 2016
The commit is pushed to "branch-rh7-3.10.0-327.10.1.vz7.12.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.10.1.vz7.12.11
------>
commit 434ec77f2d650b9a22157d922ee700d7e7375a0f
Author: Wanpeng Li <wanpeng.li at hotmail.com>
Date: Tue Apr 19 14:22:48 2016 +0400
ms/kvm: make halt_poll_ns per-vCPU
Patchset description:
KVM: introduce dynamic halt_poll_ns
These series makes halt_poll_ns to be a per-cpu value, and add simple
dynamics for auto-calculating it online.
It is needed to fix performance problems:
https://jira.sw.ru/browse/PSBM-43100
Actually, setting kvm parameter halt_poll_ns to appropriate value is
enough, but for different nodes optimal halt_poll_ns will differ, so
we need auto-calculating halt_poll_ns. Also, dynamic approach saves cpu
cycles for cases when poll is not needed.
All patches are ported from kernel upstream, originals:
19020f8 KVM: make halt_poll_ns per-vCPU
aca6ff2 KVM: dynamic halt-polling
2cbd782 KVM: trace kvm_halt_poll_ns grow/shrink
edb9272 KVM: fix polling for guest halt continued even if disable it
62bea5b KVM: add halt_attempted_poll to VCPU stats
920552b KVM: disable halt_poll_ns as default for s390x
6b6de68 KVM: halt_polling: improve grow/shrink settings
313f636 kvm: cap halt polling at exactly halt_poll_ns
Conflicts were trivial. The most complicated is absence of some
arch's in vz7 kernel, which are maintained in upstream.
Christian Borntraeger (1):
KVM: halt_polling: improve grow/shrink settings
David Hildenbrand (1):
KVM: disable halt_poll_ns as default for s390x
David Matlack (1):
kvm: cap halt polling at exactly halt_poll_ns
Paolo Bonzini (1):
KVM: add halt_attempted_poll to VCPU stats
Wanpeng Li (4):
KVM: make halt_poll_ns per-vCPU
KVM: dynamic halt-polling
KVM: trace kvm_halt_poll_ns grow/shrink
KVM: fix polling for guest halt continued even if disable it
===========================
This patch description:
Change halt_poll_ns into per-VCPU variable, seeded from module parameter,
to allow greater flexibility.
Signed-off-by: Wanpeng Li <wanpeng.li at hotmail.com>
Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
(cherry picked from commit 19020f8ab83de9dc5a9c8af1f321a526f38bbc40)
Conflicts:
virt/kvm/kvm_main.c
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov at virtuozzo.com>
---
include/linux/kvm_host.h | 1 +
virt/kvm/kvm_main.c | 6 ++++--
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 46ff70c..cd6d1b9 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -247,6 +247,7 @@ struct kvm_vcpu {
int sigset_active;
sigset_t sigset;
struct kvm_vcpu_stat stat;
+ unsigned int halt_poll_ns;
#ifdef CONFIG_HAS_IOMEM
int mmio_needed;
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index fa2124c..a320bf1 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -217,6 +217,7 @@ int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id)
vcpu->kvm = kvm;
vcpu->vcpu_id = id;
vcpu->pid = NULL;
+ vcpu->halt_poll_ns = 0;
init_waitqueue_head(&vcpu->wq);
kvm_async_pf_vcpu_init(vcpu);
@@ -1957,8 +1958,9 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu)
bool waited = false;
start = cur = ktime_get();
- if (halt_poll_ns) {
- ktime_t stop = ktime_add_ns(ktime_get(), halt_poll_ns);
+ if (vcpu->halt_poll_ns) {
+ ktime_t stop = ktime_add_ns(ktime_get(), vcpu->halt_poll_ns);
+
do {
/*
* This sets KVM_REQ_UNHALT if an interrupt
More information about the Devel
mailing list