From: Eduardo Habkost <ehabkost@redhat.com>
To: qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Igor Mammedov <imammedo@redhat.com>,
Alexander Graf <agraf@suse.de>
Subject: [Qemu-devel] [PATCH 7/7] target/i386: Enable kvm_pv_unhalt by default
Date: Fri, 6 Oct 2017 18:52:44 -0300 [thread overview]
Message-ID: <20171006215244.27104-8-ehabkost@redhat.com> (raw)
In-Reply-To: <20171006215244.27104-1-ehabkost@redhat.com>
Original description of a patch by Alexander Graf that did
something similar:
Commit f010bc643a (target-i386: add feature kvm_pv_unhalt) introduced the
kvm_pv_unhalt feature but didn't enable it by default.
Without kvm_pv_unhalt we see a measurable degradation in scheduling
performance, so enabling it by default does make sense IMHO. This patch
just flips it to default to on by default.
[With kvm_pv_unhalt disabled]
$ perf bench sched messaging -l 10000
Total time: 8.573 [sec]
[With kvm_pv_unhalt enabled]
$ perf bench sched messaging -l 10000
Total time: 4.416 [sec]
This patch does the same as that patch, but using a
kvm_auto_enable_pv_unhalt flag to keep compatibility on older
machine-types.
kvm_pv_unhalt support was added to Linux on v3.12 (Linux commit
6aef266c6e17b798a1740cf70cd34f90664740b3), so update the system
requirements section in qemu-doc.texi accordingly.
Suggested-by: Alexander Graf <agraf@suse.de>
Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
include/hw/i386/pc.h | 4 ++++
target/i386/cpu.h | 3 +++
target/i386/cpu.c | 7 +++++++
qemu-doc.texi | 2 +-
4 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index d2742dd0bc..19b42de224 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -375,6 +375,10 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
.driver = TYPE_X86_CPU,\
.property = "x-hv-max-vps",\
.value = "0x40",\
+ },{\
+ .driver = TYPE_X86_CPU,\
+ .property = "x-kvm-auto-enable-pv-unhalt",\
+ .value = "off",\
},
#define PC_COMPAT_2_9 \
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index 7e5bf86921..db1eecff00 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -1276,6 +1276,9 @@ struct X86CPU {
/* KVM automatically enables kvm-pv-eoi if not explicitly disabled by user */
bool kvm_auto_enable_pv_eoi;
+ /* KVM automatically enables kvm-pv-unhalt if not explicitly disabled */
+ bool kvm_auto_enable_pv_unhalt;
+
/* Number of physical address bits supported */
uint32_t phys_bits;
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 2160738a37..7461c2a25e 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -3515,6 +3515,11 @@ static void x86_cpu_expand_features(X86CPU *cpu, Error **errp)
x86_cpu_expand_feature(cpu, FEAT_KVM, (1 << KVM_FEATURE_PV_EOI),
(1 << KVM_FEATURE_PV_EOI));
}
+
+ if (cpu->kvm_auto_enable_pv_unhalt) {
+ x86_cpu_expand_feature(cpu, FEAT_KVM, (1 << KVM_FEATURE_PV_UNHALT),
+ (1 << KVM_FEATURE_PV_UNHALT));
+ }
}
/*TODO: Now cpu->max_features doesn't overwrite features
@@ -4164,6 +4169,8 @@ static Property x86_cpu_properties[] = {
X86CPU, kvm_auto_enable_x2apic, true),
DEFINE_PROP_BOOL("x-kvm-auto-enable-pv-eoi",
X86CPU, kvm_auto_enable_pv_eoi, true),
+ DEFINE_PROP_BOOL("x-kvm-auto-enable-pv-unhalt",
+ X86CPU, kvm_auto_enable_pv_unhalt, true),
DEFINE_PROP_BOOL("vmware-cpuid-freq", X86CPU, vmware_cpuid_freq, true),
DEFINE_PROP_BOOL("tcg-cpuid", X86CPU, expose_tcg, true),
diff --git a/qemu-doc.texi b/qemu-doc.texi
index be45b6b6f6..73c831383a 100644
--- a/qemu-doc.texi
+++ b/qemu-doc.texi
@@ -2355,7 +2355,7 @@ Run the emulation in single step mode.
@section KVM kernel module
On x86_64 hosts, the default set of CPU features enabled by the KVM accelerator
-require the host to be running Linux v3.6 or newer.
+require the host to be running Linux v3.12 or newer.
@include qemu-tech.texi
--
2.13.6
next prev parent reply other threads:[~2017-10-06 21:53 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-06 21:52 [Qemu-devel] [PATCH 0/7] x86: Rework KVM-defaults compat code, enable kvm_pv_unhalt by default Eduardo Habkost
2017-10-06 21:52 ` [Qemu-devel] [PATCH 1/7] qemu-doc: Document minimum kernel version for KVM in x86_64 Eduardo Habkost
2017-10-09 13:40 ` Paolo Bonzini
2017-10-10 15:33 ` Eduardo Habkost
2017-10-06 21:52 ` [Qemu-devel] [PATCH 2/7] target/i386: x86_cpu_expand_feature() helper Eduardo Habkost
2017-10-06 21:52 ` [Qemu-devel] [PATCH 3/7] target/i386: Use global variables to control KVM defaults Eduardo Habkost
2017-10-06 21:52 ` [Qemu-devel] [PATCH 4/7] kvm: Define KVM_FEAT_* even if CONFIG_KVM is not defined Eduardo Habkost
2017-10-06 21:52 ` [Qemu-devel] [PATCH 5/7] target/i386: Handle kvm_auto_* compat in x86_cpu_expand_features() Eduardo Habkost
2017-10-06 21:52 ` [Qemu-devel] [PATCH 6/7] pc: Use compat_props to control KVM defaults compatibility Eduardo Habkost
2017-10-06 21:52 ` Eduardo Habkost [this message]
2017-10-09 14:40 ` [Qemu-devel] [PATCH 7/7] target/i386: Enable kvm_pv_unhalt by default Paolo Bonzini
2017-10-09 14:43 ` Alexander Graf
2017-10-09 13:39 ` [Qemu-devel] [PATCH 0/7] x86: Rework KVM-defaults compat code, enable " Paolo Bonzini
2017-10-09 15:15 ` Waiman Long
2017-10-09 15:47 ` Paolo Bonzini
2017-10-10 15:50 ` Eduardo Habkost
2017-10-10 18:07 ` Waiman Long
2017-10-10 19:41 ` Eduardo Habkost
2017-10-11 20:19 ` Waiman Long
2017-10-13 19:01 ` Eduardo Habkost
2017-10-13 20:58 ` Waiman Long
2017-10-13 23:56 ` Eduardo Habkost
2017-11-07 11:21 ` [Qemu-devel] [libvirt] " Paolo Bonzini
2017-11-08 20:07 ` Eduardo Habkost
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=20171006215244.27104-8-ehabkost@redhat.com \
--to=ehabkost@redhat.com \
--cc=agraf@suse.de \
--cc=imammedo@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).