mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
qemu: support kvm-pv-ipi off
QEMU version 3.1 introduced PV_SEND_IPI CPUID feature bit under commit 7f710c32bb8 (target-i386: adds PV_SEND_IPI CPUID feature bit). This patch adds a new KVM feature 'pv-ipi' to disable this feature (enabled by default). Newer CPU platform (Ex, AMD Zen2) supports hardware accelation for IPI in guest, to use this feature to get better performance in some scenarios. Detailed about the discussion: https://lkml.org/lkml/2021/10/20/423 To disable kvm-pv-ipi and have libvirt add "-cpu host,kvm-pv-ipi=off" to the QEMU command line, the following XML code needs to be added to the guest's domain description: <features> <kvm> <pv-ipi state='off'/> </kvm> </features> Signed-off-by: zhenwei pi <pizhenwei@bytedance.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
d7547dbcf3
commit
b2757b697e
@ -1842,6 +1842,7 @@ Hypervisors may allow certain CPU / machine features to be toggled on/off.
|
|||||||
<hidden state='on'/>
|
<hidden state='on'/>
|
||||||
<hint-dedicated state='on'/>
|
<hint-dedicated state='on'/>
|
||||||
<poll-control state='on'/>
|
<poll-control state='on'/>
|
||||||
|
<pv-ipi state='off'/>
|
||||||
</kvm>
|
</kvm>
|
||||||
<xen>
|
<xen>
|
||||||
<e820_host state='on'/>
|
<e820_host state='on'/>
|
||||||
@ -1930,6 +1931,7 @@ are:
|
|||||||
hidden Hide the KVM hypervisor from standard MSR based discovery on, off :since:`1.2.8 (QEMU 2.1.0)`
|
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)`
|
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)`
|
poll-control Decrease IO completion latency by introducing a grace period of busy waiting on, off :since:`6.10.0 (QEMU 4.2)`
|
||||||
|
pv-ipi Paravirtualized send IPIs on, off :since:`7.10.0 (QEMU 3.1)`
|
||||||
============== ============================================================================ ======= ============================
|
============== ============================================================================ ======= ============================
|
||||||
|
|
||||||
``xen``
|
``xen``
|
||||||
|
@ -7177,6 +7177,11 @@
|
|||||||
<ref name="featurestate"/>
|
<ref name="featurestate"/>
|
||||||
</element>
|
</element>
|
||||||
</optional>
|
</optional>
|
||||||
|
<optional>
|
||||||
|
<element name="pv-ipi">
|
||||||
|
<ref name="featurestate"/>
|
||||||
|
</element>
|
||||||
|
</optional>
|
||||||
</interleave>
|
</interleave>
|
||||||
</element>
|
</element>
|
||||||
</define>
|
</define>
|
||||||
|
@ -204,6 +204,7 @@ VIR_ENUM_IMPL(virDomainKVM,
|
|||||||
"hidden",
|
"hidden",
|
||||||
"hint-dedicated",
|
"hint-dedicated",
|
||||||
"poll-control",
|
"poll-control",
|
||||||
|
"pv-ipi",
|
||||||
);
|
);
|
||||||
|
|
||||||
VIR_ENUM_IMPL(virDomainXen,
|
VIR_ENUM_IMPL(virDomainXen,
|
||||||
@ -21789,6 +21790,7 @@ virDomainDefFeaturesCheckABIStability(virDomainDef *src,
|
|||||||
case VIR_DOMAIN_KVM_HIDDEN:
|
case VIR_DOMAIN_KVM_HIDDEN:
|
||||||
case VIR_DOMAIN_KVM_DEDICATED:
|
case VIR_DOMAIN_KVM_DEDICATED:
|
||||||
case VIR_DOMAIN_KVM_POLLCONTROL:
|
case VIR_DOMAIN_KVM_POLLCONTROL:
|
||||||
|
case VIR_DOMAIN_KVM_PVIPI:
|
||||||
if (src->kvm_features[i] != dst->kvm_features[i]) {
|
if (src->kvm_features[i] != dst->kvm_features[i]) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("State of KVM feature '%s' differs: "
|
_("State of KVM feature '%s' differs: "
|
||||||
@ -27821,6 +27823,7 @@ virDomainDefFormatFeatures(virBuffer *buf,
|
|||||||
case VIR_DOMAIN_KVM_HIDDEN:
|
case VIR_DOMAIN_KVM_HIDDEN:
|
||||||
case VIR_DOMAIN_KVM_DEDICATED:
|
case VIR_DOMAIN_KVM_DEDICATED:
|
||||||
case VIR_DOMAIN_KVM_POLLCONTROL:
|
case VIR_DOMAIN_KVM_POLLCONTROL:
|
||||||
|
case VIR_DOMAIN_KVM_PVIPI:
|
||||||
if (def->kvm_features[j])
|
if (def->kvm_features[j])
|
||||||
virBufferAsprintf(&childBuf, "<%s state='%s'/>\n",
|
virBufferAsprintf(&childBuf, "<%s state='%s'/>\n",
|
||||||
virDomainKVMTypeToString(j),
|
virDomainKVMTypeToString(j),
|
||||||
|
@ -2073,6 +2073,7 @@ typedef enum {
|
|||||||
VIR_DOMAIN_KVM_HIDDEN = 0,
|
VIR_DOMAIN_KVM_HIDDEN = 0,
|
||||||
VIR_DOMAIN_KVM_DEDICATED,
|
VIR_DOMAIN_KVM_DEDICATED,
|
||||||
VIR_DOMAIN_KVM_POLLCONTROL,
|
VIR_DOMAIN_KVM_POLLCONTROL,
|
||||||
|
VIR_DOMAIN_KVM_PVIPI,
|
||||||
|
|
||||||
VIR_DOMAIN_KVM_LAST
|
VIR_DOMAIN_KVM_LAST
|
||||||
} virDomainKVM;
|
} virDomainKVM;
|
||||||
|
@ -6848,6 +6848,11 @@ qemuBuildCpuCommandLine(virCommand *cmd,
|
|||||||
virBufferAddLit(&buf, ",kvm-poll-control=on");
|
virBufferAddLit(&buf, ",kvm-poll-control=on");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case VIR_DOMAIN_KVM_PVIPI:
|
||||||
|
if (def->kvm_features[i] == VIR_TRISTATE_SWITCH_OFF)
|
||||||
|
virBufferAddLit(&buf, ",kvm-pv-ipi=off");
|
||||||
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_KVM_LAST:
|
case VIR_DOMAIN_KVM_LAST:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user