mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-01 17:35:17 +00:00
qemu: support kvm-poll-control performance hint
QEMU version 4.2 introduced a performance feature under commit d645e13287 ("kvm: i386: halt poll control MSR support"). This patch adds a new KVM feature 'poll-control' to set this performance hint for KVM guests. The feature is off by default. To enable this hint and have libvirt add "-cpu host,kvm-poll-control=on" to the QEMU command line, the following XML code needs to be added to the guest's domain description: <features> <kvm> <poll-control state='on'/> </kvm> </features> Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
7e67a136da
commit
3fc4412c6f
@ -1766,6 +1766,7 @@ Hypervisors may allow certain CPU / machine features to be toggled on/off.
|
||||
<kvm>
|
||||
<hidden state='on'/>
|
||||
<hint-dedicated state='on'/>
|
||||
<poll-control='on'/>
|
||||
</kvm>
|
||||
<xen>
|
||||
<e820_host state='on'/>
|
||||
@ -1848,12 +1849,13 @@ are:
|
||||
``kvm``
|
||||
Various features to change the behavior of the KVM hypervisor.
|
||||
|
||||
============== ====================================================================== ======= ============================
|
||||
Feature Description Value Since
|
||||
============== ====================================================================== ======= ============================
|
||||
hidden Hide the KVM hypervisor from standard MSR based discovery on, off :since:`1.2.8 (QEMU 2.1.0)`
|
||||
hint-dedicated Allows a guest to enable optimizations when running on dedicated vCPUs on, off :since:`5.7.0 (QEMU 2.12.0)`
|
||||
============== ====================================================================== ======= ============================
|
||||
============== ============================================================================ ======= ============================
|
||||
Feature Description Value Since
|
||||
============== ============================================================================ ======= ============================
|
||||
hidden Hide the KVM hypervisor from standard MSR based discovery on, off :since:`1.2.8 (QEMU 2.1.0)`
|
||||
hint-dedicated Allows a guest to enable optimizations when running on dedicated vCPUs on, off :since:`5.7.0 (QEMU 2.12.0)`
|
||||
poll-control Decrease IO completion latency by introducing a grace period of busy waiting on, off :since:`6.10.0 (QEMU 4.2)`
|
||||
============== ============================================================================ ======= ============================
|
||||
|
||||
``xen``
|
||||
Various features to change the behavior of the Xen hypervisor.
|
||||
|
@ -6512,6 +6512,11 @@
|
||||
<ref name="featurestate"/>
|
||||
</element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="poll-control">
|
||||
<ref name="featurestate"/>
|
||||
</element>
|
||||
</optional>
|
||||
</interleave>
|
||||
</element>
|
||||
</define>
|
||||
|
@ -208,6 +208,7 @@ VIR_ENUM_IMPL(virDomainKVM,
|
||||
VIR_DOMAIN_KVM_LAST,
|
||||
"hidden",
|
||||
"hint-dedicated",
|
||||
"poll-control",
|
||||
);
|
||||
|
||||
VIR_ENUM_IMPL(virDomainXen,
|
||||
@ -19823,6 +19824,7 @@ virDomainFeaturesDefParse(virDomainDefPtr def,
|
||||
switch ((virDomainKVM) feature) {
|
||||
case VIR_DOMAIN_KVM_HIDDEN:
|
||||
case VIR_DOMAIN_KVM_DEDICATED:
|
||||
case VIR_DOMAIN_KVM_POLLCONTROL:
|
||||
if (!(tmp = virXMLPropString(nodes[i], "state"))) {
|
||||
virReportError(VIR_ERR_XML_ERROR,
|
||||
_("missing 'state' attribute for "
|
||||
@ -23982,6 +23984,7 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr src,
|
||||
switch ((virDomainKVM) i) {
|
||||
case VIR_DOMAIN_KVM_HIDDEN:
|
||||
case VIR_DOMAIN_KVM_DEDICATED:
|
||||
case VIR_DOMAIN_KVM_POLLCONTROL:
|
||||
if (src->kvm_features[i] != dst->kvm_features[i]) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("State of KVM feature '%s' differs: "
|
||||
@ -29691,6 +29694,7 @@ virDomainDefFormatFeatures(virBufferPtr buf,
|
||||
switch ((virDomainKVM) j) {
|
||||
case VIR_DOMAIN_KVM_HIDDEN:
|
||||
case VIR_DOMAIN_KVM_DEDICATED:
|
||||
case VIR_DOMAIN_KVM_POLLCONTROL:
|
||||
if (def->kvm_features[j])
|
||||
virBufferAsprintf(&childBuf, "<%s state='%s'/>\n",
|
||||
virDomainKVMTypeToString(j),
|
||||
|
@ -1912,6 +1912,7 @@ typedef enum {
|
||||
typedef enum {
|
||||
VIR_DOMAIN_KVM_HIDDEN = 0,
|
||||
VIR_DOMAIN_KVM_DEDICATED,
|
||||
VIR_DOMAIN_KVM_POLLCONTROL,
|
||||
|
||||
VIR_DOMAIN_KVM_LAST
|
||||
} virDomainKVM;
|
||||
|
@ -6464,6 +6464,11 @@ qemuBuildCpuCommandLine(virCommandPtr cmd,
|
||||
virBufferAddLit(&buf, ",kvm-hint-dedicated=on");
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_KVM_POLLCONTROL:
|
||||
if (def->kvm_features[i] == VIR_TRISTATE_SWITCH_ON)
|
||||
virBufferAddLit(&buf, ",kvm-poll-control=on");
|
||||
break;
|
||||
|
||||
/* coverity[dead_error_begin] */
|
||||
case VIR_DOMAIN_KVM_LAST:
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user