[libvirt] [PATCH 0/4] qemu: Enable configuration of HPT resizing for pSeries guests

Applies on top of https://www.redhat.com/archives/libvir-list/2017-November/msg00176.html Andrea Bolognani (4): qemu: Enable configuration of HPT resizing for pSeries guests tests: Add tests for configuration of HPT resizing docs: Document configuration of HPT resizing news: Update for configuration of HPT resizing docs/formatdomain.html.in | 13 +++++- docs/news.xml | 10 +++++ docs/schemas/domaincommon.rng | 15 +++++++ src/conf/domain_conf.c | 46 +++++++++++++++++++++- src/conf/domain_conf.h | 12 ++++++ src/libvirt_private.syms | 1 + src/qemu/qemu_capabilities.c | 8 ++++ src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 20 ++++++++++ src/qemu/qemu_domain.c | 8 ++++ tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml | 1 + ...qemuxml2argv-pseries-hpt-resizing-disabled.args | 20 ++++++++++ .../qemuxml2argv-pseries-hpt-resizing-disabled.xml | 19 +++++++++ .../qemuxml2argv-pseries-hpt-resizing-enabled.args | 20 ++++++++++ .../qemuxml2argv-pseries-hpt-resizing-enabled.xml | 19 +++++++++ ...l2argv-pseries-hpt-resizing-invalid-machine.xml | 18 +++++++++ ...qemuxml2argv-pseries-hpt-resizing-required.args | 20 ++++++++++ .../qemuxml2argv-pseries-hpt-resizing-required.xml | 19 +++++++++ tests/qemuxml2argvtest.c | 20 ++++++++++ ...emuxml2xmlout-pseries-hpt-resizing-disabled.xml | 28 +++++++++++++ ...qemuxml2xmlout-pseries-hpt-resizing-enabled.xml | 28 +++++++++++++ ...emuxml2xmlout-pseries-hpt-resizing-required.xml | 28 +++++++++++++ tests/qemuxml2xmltest.c | 13 ++++++ 23 files changed, 385 insertions(+), 2 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-disabled.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-disabled.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-enabled.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-enabled.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-invalid-machine.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-required.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-required.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-hpt-resizing-disabled.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-hpt-resizing-enabled.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-hpt-resizing-required.xml -- 2.13.6

Most of the time it's okay to leave this up to negotiation between the guest and the host, but in some situations it can be useful to manually decide the behavior, especially to enforce its availability. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1308743 Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- docs/schemas/domaincommon.rng | 15 ++++++++ src/conf/domain_conf.c | 46 +++++++++++++++++++++++- src/conf/domain_conf.h | 12 +++++++ src/libvirt_private.syms | 1 + src/qemu/qemu_capabilities.c | 8 +++++ src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 20 +++++++++++ src/qemu/qemu_domain.c | 8 +++++ tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml | 1 + 9 files changed, 111 insertions(+), 1 deletion(-) diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 9cec1a063..82fdfd5f7 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -4736,6 +4736,9 @@ <optional> <ref name="ioapic"/> </optional> + <optional> + <ref name="hpt"/> + </optional> </interleave> </element> </optional> @@ -4924,6 +4927,18 @@ </element> </define> + <define name="hpt"> + <element name="hpt"> + <attribute name="resizing"> + <choice> + <value>enabled</value> + <value>disabled</value> + <value>required</value> + </choice> + </attribute> + </element> + </define> + <define name="address"> <element name="address"> <choice> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 400e90032..0c0819fe5 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -148,7 +148,9 @@ VIR_ENUM_IMPL(virDomainFeature, VIR_DOMAIN_FEATURE_LAST, "vmport", "gic", "smm", - "ioapic") + "ioapic", + "hpt", +); VIR_ENUM_IMPL(virDomainCapabilitiesPolicy, VIR_DOMAIN_CAPABILITIES_POLICY_LAST, "default", @@ -882,6 +884,13 @@ VIR_ENUM_IMPL(virDomainIOAPIC, "qemu", "kvm") +VIR_ENUM_IMPL(virDomainHPTResizing, + VIR_DOMAIN_HPT_RESIZING_LAST, + "enabled", + "disabled", + "required", +); + /* Internal mapping: subset of block job types that can be present in * <mirror> XML (remaining types are not two-phase). */ VIR_ENUM_DECL(virDomainBlockJob) @@ -18776,6 +18785,22 @@ virDomainDefParseXML(xmlDocPtr xml, } break; + case VIR_DOMAIN_FEATURE_HPT: + tmp = virXMLPropString(nodes[i], "resizing"); + if (tmp) { + int value = virDomainHPTResizingTypeFromString(tmp); + if (value < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unknown HPT resizing setting: %s"), + tmp); + goto error; + } + def->hpt_resizing = value; + def->features[val] = VIR_TRISTATE_SWITCH_ON; + VIR_FREE(tmp); + } + break; + /* coverity[dead_error_begin] */ case VIR_DOMAIN_FEATURE_LAST: break; @@ -20966,6 +20991,18 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr src, return false; } + /* HPT resizing */ + if (src->features[VIR_DOMAIN_FEATURE_HPT] == VIR_TRISTATE_SWITCH_ON) { + if (src->hpt_resizing != dst->hpt_resizing) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("HPT resizing configuration differs: " + "source: '%s', destination: '%s'"), + virDomainHPTResizingTypeToString(src->hpt_resizing), + virDomainHPTResizingTypeToString(dst->hpt_resizing)); + return false; + } + } + return true; } @@ -26215,6 +26252,13 @@ virDomainDefFormatInternal(virDomainDefPtr def, } break; + case VIR_DOMAIN_FEATURE_HPT: + if (def->features[i] == VIR_TRISTATE_SWITCH_ON) { + virBufferAsprintf(buf, "<hpt resizing='%s'/>\n", + virDomainHPTResizingTypeToString(def->hpt_resizing)); + } + break; + /* coverity[dead_error_begin] */ case VIR_DOMAIN_FEATURE_LAST: break; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index be38792c6..c661bc0c2 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1723,6 +1723,7 @@ typedef enum { VIR_DOMAIN_FEATURE_GIC, VIR_DOMAIN_FEATURE_SMM, VIR_DOMAIN_FEATURE_IOAPIC, + VIR_DOMAIN_FEATURE_HPT, VIR_DOMAIN_FEATURE_LAST } virDomainFeature; @@ -1851,6 +1852,16 @@ typedef enum { VIR_ENUM_DECL(virDomainIOAPIC); +typedef enum { + VIR_DOMAIN_HPT_RESIZING_ENABLED = 0, + VIR_DOMAIN_HPT_RESIZING_DISABLED, + VIR_DOMAIN_HPT_RESIZING_REQUIRED, + + VIR_DOMAIN_HPT_RESIZING_LAST +} virDomainHPTResizing; + +VIR_ENUM_DECL(virDomainHPTResizing); + /* Operating system configuration data & machine / arch */ typedef struct _virDomainOSEnv virDomainOSEnv; typedef virDomainOSEnv *virDomainOSEnvPtr; @@ -2323,6 +2334,7 @@ struct _virDomainDef { virGICVersion gic_version; char *hyperv_vendor_id; virDomainIOAPIC ioapic; + virDomainHPTResizing hpt_resizing; /* These options are of type virTristateSwitch: ON = keep, OFF = drop */ int caps_features[VIR_DOMAIN_CAPS_FEATURE_LAST]; diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 36cd5b55b..aa3b94720 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -386,6 +386,7 @@ virDomainHostdevModeTypeToString; virDomainHostdevRemove; virDomainHostdevSubsysPCIBackendTypeToString; virDomainHostdevSubsysTypeToString; +virDomainHPTResizingTypeToString; virDomainHubTypeFromString; virDomainHubTypeToString; virDomainHypervTypeFromString; diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 7cb091056..1badadbc2 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -443,6 +443,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, /* 270 */ "vxhs", "virtio-blk.num-queues", + "machine.pseries.resize-hpt", ); @@ -4776,6 +4777,13 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps, if (qemuCaps->version >= 2006000) virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_KERNEL_IRQCHIP_SPLIT); + /* HPT resizing is supported since QEMU 2.10 on ppc64; unfortunately + * there's no sane way to probe for it */ + if (qemuCaps->version >= 2010000 && + ARCH_IS_PPC64(qemuCaps->arch)) { + virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT); + } + if (virQEMUCapsProbeQMPCommands(qemuCaps, mon) < 0) goto cleanup; diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index cacc2b77e..f0e2e9016 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -429,6 +429,7 @@ typedef enum { /* 270 */ QEMU_CAPS_VXHS, /* -drive file.driver=vxhs via query-qmp-schema */ QEMU_CAPS_VIRTIO_BLK_NUM_QUEUES, /* virtio-blk-*.num-queues */ + QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT, /* -machine pseries,resize-hpt */ QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 8708b79ed..e8868a34a 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7526,6 +7526,26 @@ qemuBuildMachineCommandLine(virCommandPtr cmd, } } + if (def->features[VIR_DOMAIN_FEATURE_HPT] == VIR_TRISTATE_SWITCH_ON) { + const char *str; + + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("HTP resizing is not supported by this " + "QEMU binary")); + goto cleanup; + } + + str = virDomainHPTResizingTypeToString(def->hpt_resizing); + if (!str) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Invalid setting for HPT resizing")); + goto cleanup; + } + + virBufferAsprintf(&buf, ",resize-hpt=%s", str); + } + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BOOTINDEX) && virQEMUCapsGet(qemuCaps, QEMU_CAPS_LOADPARM)) qemuAppendLoadparmMachineParm(&buf, def); diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index b248a3ddc..60e6da327 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3142,6 +3142,14 @@ qemuDomainDefVerifyFeatures(const virDomainDef *def) return -1; } + if (def->features[VIR_DOMAIN_FEATURE_HPT] == VIR_TRISTATE_SWITCH_ON && + !qemuDomainIsPSeries(def)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", + _("HPT tuning is only supported for pSeries guests")); + return -1; + } + return 0; } diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml index 0dfa20726..b0ee3f152 100644 --- a/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml @@ -177,6 +177,7 @@ <flag name='virtio-gpu.max_outputs'/> <flag name='vxhs'/> <flag name='virtio-blk.num-queues'/> + <flag name='machine.pseries.resize-hpt'/> <version>2010000</version> <kvmVersion>0</kvmVersion> <package> (v2.10.0)</package> -- 2.13.6

On 11/06/2017 11:08 AM, Andrea Bolognani wrote:
Most of the time it's okay to leave this up to negotiation between the guest and the host, but in some situations it can be useful to manually decide the behavior, especially to enforce its availability.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1308743
Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- docs/schemas/domaincommon.rng | 15 ++++++++ src/conf/domain_conf.c | 46 +++++++++++++++++++++++- src/conf/domain_conf.h | 12 +++++++ src/libvirt_private.syms | 1 + src/qemu/qemu_capabilities.c | 8 +++++ src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 20 +++++++++++ src/qemu/qemu_domain.c | 8 +++++ tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml | 1 + 9 files changed, 111 insertions(+), 1 deletion(-)
[...]
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 7cb091056..1badadbc2 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -443,6 +443,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, /* 270 */ "vxhs", "virtio-blk.num-queues", + "machine.pseries.resize-hpt", );
@@ -4776,6 +4777,13 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps, if (qemuCaps->version >= 2006000) virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_KERNEL_IRQCHIP_SPLIT);
+ /* HPT resizing is supported since QEMU 2.10 on ppc64; unfortunately + * there's no sane way to probe for it */ + if (qemuCaps->version >= 2010000 && + ARCH_IS_PPC64(qemuCaps->arch)) {
This check differs slightly from qemuDomainDefVerifyFeatures
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT); + } + if (virQEMUCapsProbeQMPCommands(qemuCaps, mon) < 0) goto cleanup;
[...]
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 8708b79ed..e8868a34a 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7526,6 +7526,26 @@ qemuBuildMachineCommandLine(virCommandPtr cmd, } }
+ if (def->features[VIR_DOMAIN_FEATURE_HPT] == VIR_TRISTATE_SWITCH_ON) { + const char *str; + + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("HTP resizing is not supported by this " + "QEMU binary")); + goto cleanup; + } + + str = virDomainHPTResizingTypeToString(def->hpt_resizing); + if (!str) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Invalid setting for HPT resizing")); + goto cleanup; + } + + virBufferAsprintf(&buf, ",resize-hpt=%s", str);
This one only cares about the capability...
+ } + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BOOTINDEX) && virQEMUCapsGet(qemuCaps, QEMU_CAPS_LOADPARM)) qemuAppendLoadparmMachineParm(&buf, def); diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index b248a3ddc..60e6da327 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3142,6 +3142,14 @@ qemuDomainDefVerifyFeatures(const virDomainDef *def) return -1; }
+ if (def->features[VIR_DOMAIN_FEATURE_HPT] == VIR_TRISTATE_SWITCH_ON && + !qemuDomainIsPSeries(def)) {
But this one adds the def->machine.os check... I know it's post parse so it should thus cause failure before building the command line occurs, so the question is should capability use "&& qemuDomainIsPSeries"? Your call... Reviewed-by: John Ferlan <jferlan@redhat.com> John
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", + _("HPT tuning is only supported for pSeries guests")); + return -1; + } + return 0; }
[...]

On Mon, 2017-11-13 at 10:36 -0500, John Ferlan wrote:
@@ -4776,6 +4777,13 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps, if (qemuCaps->version >= 2006000) virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_KERNEL_IRQCHIP_SPLIT);
+ /* HPT resizing is supported since QEMU 2.10 on ppc64; unfortunately + * there's no sane way to probe for it */ + if (qemuCaps->version >= 2010000 && + ARCH_IS_PPC64(qemuCaps->arch)) {
This check differs slightly from qemuDomainDefVerifyFeatures
QEMU capabilities are per-binary, so even though the resize-hpt property is only supported by the pseries machine type we have to store it globally. Plus at this point we just have no idea what machine type the user is eventually going to choose. The capability name should make it clear that it's pseries only.
@@ -7526,6 +7526,26 @@ qemuBuildMachineCommandLine(virCommandPtr cmd, } }
+ if (def->features[VIR_DOMAIN_FEATURE_HPT] == VIR_TRISTATE_SWITCH_ON) { + const char *str; + + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("HTP resizing is not supported by this " + "QEMU binary")); + goto cleanup; + } + + str = virDomainHPTResizingTypeToString(def->hpt_resizing); + if (!str) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Invalid setting for HPT resizing")); + goto cleanup; + } + + virBufferAsprintf(&buf, ",resize-hpt=%s", str);
This one only cares about the capability...
Because by the time we get to build the QEMU command line we will have made sure the setting is only used along with a compatible machine type in qemuDomainDefVerifyFeatures() below, no need to duplicate the check and risk it getting out of sync eventually.
@@ -3142,6 +3142,14 @@ qemuDomainDefVerifyFeatures(const virDomainDef *def) return -1; }
+ if (def->features[VIR_DOMAIN_FEATURE_HPT] == VIR_TRISTATE_SWITCH_ON && + !qemuDomainIsPSeries(def)) {
But this one adds the def->machine.os check... I know it's post parse so it should thus cause failure before building the command line occurs, so the question is should capability use "&& qemuDomainIsPSeries"? Your call...
As explained above, it can't :) -- Andrea Bolognani / Red Hat / Virtualization

Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- ...qemuxml2argv-pseries-hpt-resizing-disabled.args | 20 ++++++++++++++++ .../qemuxml2argv-pseries-hpt-resizing-disabled.xml | 19 +++++++++++++++ .../qemuxml2argv-pseries-hpt-resizing-enabled.args | 20 ++++++++++++++++ .../qemuxml2argv-pseries-hpt-resizing-enabled.xml | 19 +++++++++++++++ ...l2argv-pseries-hpt-resizing-invalid-machine.xml | 18 ++++++++++++++ ...qemuxml2argv-pseries-hpt-resizing-required.args | 20 ++++++++++++++++ .../qemuxml2argv-pseries-hpt-resizing-required.xml | 19 +++++++++++++++ tests/qemuxml2argvtest.c | 20 ++++++++++++++++ ...emuxml2xmlout-pseries-hpt-resizing-disabled.xml | 28 ++++++++++++++++++++++ ...qemuxml2xmlout-pseries-hpt-resizing-enabled.xml | 28 ++++++++++++++++++++++ ...emuxml2xmlout-pseries-hpt-resizing-required.xml | 28 ++++++++++++++++++++++ tests/qemuxml2xmltest.c | 13 ++++++++++ 12 files changed, 252 insertions(+) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-disabled.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-disabled.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-enabled.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-enabled.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-invalid-machine.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-required.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-required.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-hpt-resizing-disabled.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-hpt-resizing-enabled.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-hpt-resizing-required.xml diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-disabled.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-disabled.args new file mode 100644 index 000000000..795d7cb60 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-disabled.args @@ -0,0 +1,20 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/home/test \ +USER=test \ +LOGNAME=test \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-ppc64 \ +-name guest \ +-S \ +-machine pseries,accel=tcg,resize-hpt=disabled \ +-m 512 \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \ +-nographic \ +-nodefconfig \ +-nodefaults \ +-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-guest/monitor.sock,\ +server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=readline \ +-boot c diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-disabled.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-disabled.xml new file mode 100644 index 000000000..4429f55ec --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-disabled.xml @@ -0,0 +1,19 @@ +<domain type='qemu'> + <name>guest</name> + <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid> + <memory unit='KiB'>524288</memory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='ppc64' machine='pseries'>hvm</type> + </os> + <features> + <!-- Explicitly disable HPT resizing instead of leaving its + status up to host-guest negotiation --> + <hpt resizing='disabled'/> + </features> + <devices> + <emulator>/usr/bin/qemu-system-ppc64</emulator> + <controller type='usb' model='none'/> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-enabled.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-enabled.args new file mode 100644 index 000000000..56b860cf0 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-enabled.args @@ -0,0 +1,20 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/home/test \ +USER=test \ +LOGNAME=test \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-ppc64 \ +-name guest \ +-S \ +-machine pseries,accel=tcg,resize-hpt=enabled \ +-m 512 \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \ +-nographic \ +-nodefconfig \ +-nodefaults \ +-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-guest/monitor.sock,\ +server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=readline \ +-boot c diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-enabled.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-enabled.xml new file mode 100644 index 000000000..2ac2ae4b2 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-enabled.xml @@ -0,0 +1,19 @@ +<domain type='qemu'> + <name>guest</name> + <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid> + <memory unit='KiB'>524288</memory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='ppc64' machine='pseries'>hvm</type> + </os> + <features> + <!-- Explicitly enable HPT resizing instead of leaving its + status up to host-guest negotiation --> + <hpt resizing='enabled'/> + </features> + <devices> + <emulator>/usr/bin/qemu-system-ppc64</emulator> + <controller type='usb' model='none'/> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-invalid-machine.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-invalid-machine.xml new file mode 100644 index 000000000..757fcc70e --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-invalid-machine.xml @@ -0,0 +1,18 @@ +<domain type='qemu'> + <name>guest</name> + <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid> + <memory unit='KiB'>524288</memory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + </os> + <features> + <!-- HPT resizing can't be enabled for non-pSeries guests --> + <hpt resizing='enabled'/> + </features> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='usb' model='none'/> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-required.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-required.args new file mode 100644 index 000000000..994789a5e --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-required.args @@ -0,0 +1,20 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/home/test \ +USER=test \ +LOGNAME=test \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-ppc64 \ +-name guest \ +-S \ +-machine pseries,accel=tcg,resize-hpt=required \ +-m 512 \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \ +-nographic \ +-nodefconfig \ +-nodefaults \ +-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-guest/monitor.sock,\ +server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=readline \ +-boot c diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-required.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-required.xml new file mode 100644 index 000000000..f9dc9cac9 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-required.xml @@ -0,0 +1,19 @@ +<domain type='qemu'> + <name>guest</name> + <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid> + <memory unit='KiB'>524288</memory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='ppc64' machine='pseries'>hvm</type> + </os> + <features> + <!-- Explicitly enable HPT resizing. The guest will not start + at all unless HPT resizing can be arranged --> + <hpt resizing='required'/> + </features> + <devices> + <emulator>/usr/bin/qemu-system-ppc64</emulator> + <controller type='usb' model='none'/> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 2e07b85aa..cb15b5229 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1848,6 +1848,26 @@ mymain(void) QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE_VFIO_PCI); + DO_TEST("pseries-hpt-resizing-enabled", + QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_MACHINE_OPT, + QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT); + DO_TEST("pseries-hpt-resizing-disabled", + QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_MACHINE_OPT, + QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT); + DO_TEST("pseries-hpt-resizing-required", + QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_MACHINE_OPT, + QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT); + DO_TEST_FAILURE("pseries-hpt-resizing-enabled", + QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_MACHINE_OPT); + DO_TEST_PARSE_ERROR("pseries-hpt-resizing-invalid-machine", + QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_MACHINE_OPT, + QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT); + DO_TEST("disk-ide-drive-split", QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_IDE_CD); diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-hpt-resizing-disabled.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-hpt-resizing-disabled.xml new file mode 100644 index 000000000..80cd73555 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-hpt-resizing-disabled.xml @@ -0,0 +1,28 @@ +<domain type='qemu'> + <name>guest</name> + <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid> + <memory unit='KiB'>524288</memory> + <currentMemory unit='KiB'>524288</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='ppc64' machine='pseries'>hvm</type> + <boot dev='hd'/> + </os> + <features> + <hpt resizing='disabled'/> + </features> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-ppc64</emulator> + <controller type='usb' index='0' model='none'/> + <controller type='pci' index='0' model='pci-root'> + <model name='spapr-pci-host-bridge'/> + <target index='0'/> + </controller> + <memballoon model='none'/> + <panic model='pseries'/> + </devices> +</domain> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-hpt-resizing-enabled.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-hpt-resizing-enabled.xml new file mode 100644 index 000000000..cb46fadcf --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-hpt-resizing-enabled.xml @@ -0,0 +1,28 @@ +<domain type='qemu'> + <name>guest</name> + <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid> + <memory unit='KiB'>524288</memory> + <currentMemory unit='KiB'>524288</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='ppc64' machine='pseries'>hvm</type> + <boot dev='hd'/> + </os> + <features> + <hpt resizing='enabled'/> + </features> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-ppc64</emulator> + <controller type='usb' index='0' model='none'/> + <controller type='pci' index='0' model='pci-root'> + <model name='spapr-pci-host-bridge'/> + <target index='0'/> + </controller> + <memballoon model='none'/> + <panic model='pseries'/> + </devices> +</domain> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-hpt-resizing-required.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-hpt-resizing-required.xml new file mode 100644 index 000000000..5dd0dbd0b --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-hpt-resizing-required.xml @@ -0,0 +1,28 @@ +<domain type='qemu'> + <name>guest</name> + <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid> + <memory unit='KiB'>524288</memory> + <currentMemory unit='KiB'>524288</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='ppc64' machine='pseries'>hvm</type> + <boot dev='hd'/> + </os> + <features> + <hpt resizing='required'/> + </features> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-ppc64</emulator> + <controller type='usb' index='0' model='none'/> + <controller type='pci' index='0' model='pci-root'> + <model name='spapr-pci-host-bridge'/> + <target index='0'/> + </controller> + <memballoon model='none'/> + <panic model='pseries'/> + </devices> +</domain> diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 5a282e5ff..0f8527aab 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -761,6 +761,19 @@ mymain(void) QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE_VFIO_PCI); + DO_TEST("pseries-hpt-resizing-enabled", + QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_MACHINE_OPT, + QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT); + DO_TEST("pseries-hpt-resizing-disabled", + QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_MACHINE_OPT, + QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT); + DO_TEST("pseries-hpt-resizing-required", + QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_MACHINE_OPT, + QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT); + DO_TEST("balloon-device-auto", NONE); DO_TEST("balloon-device-period", NONE); DO_TEST("channel-virtio-auto", NONE); -- 2.13.6

On 11/06/2017 11:08 AM, Andrea Bolognani wrote:
Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- ...qemuxml2argv-pseries-hpt-resizing-disabled.args | 20 ++++++++++++++++ .../qemuxml2argv-pseries-hpt-resizing-disabled.xml | 19 +++++++++++++++ .../qemuxml2argv-pseries-hpt-resizing-enabled.args | 20 ++++++++++++++++ .../qemuxml2argv-pseries-hpt-resizing-enabled.xml | 19 +++++++++++++++ ...l2argv-pseries-hpt-resizing-invalid-machine.xml | 18 ++++++++++++++ ...qemuxml2argv-pseries-hpt-resizing-required.args | 20 ++++++++++++++++ .../qemuxml2argv-pseries-hpt-resizing-required.xml | 19 +++++++++++++++ tests/qemuxml2argvtest.c | 20 ++++++++++++++++ ...emuxml2xmlout-pseries-hpt-resizing-disabled.xml | 28 ++++++++++++++++++++++ ...qemuxml2xmlout-pseries-hpt-resizing-enabled.xml | 28 ++++++++++++++++++++++ ...emuxml2xmlout-pseries-hpt-resizing-required.xml | 28 ++++++++++++++++++++++ tests/qemuxml2xmltest.c | 13 ++++++++++ 12 files changed, 252 insertions(+) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-disabled.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-disabled.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-enabled.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-enabled.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-invalid-machine.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-required.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-hpt-resizing-required.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-hpt-resizing-disabled.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-hpt-resizing-enabled.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-hpt-resizing-required.xml
Those against test bloat would point out only one of the three options is really necessary... IDRC, but I also see the trend that could be started as new things are added that have 10 different options. I'm fine with any one of the 3 to be used... Your call though. Since 'enabled' is used for the without CAPS test and 'resizing' for the wrong machine test, then perhaps 'disabled' should be the one carried through - just a thought as all 3 would then "prove" the ability to parse the 3 options. Reviewed-by: John Ferlan <jferlan@redhat.com> John

On Mon, 2017-11-13 at 10:36 -0500, John Ferlan wrote:
Those against test bloat would point out only one of the three options is really necessary... IDRC, but I also see the trend that could be started as new things are added that have 10 different options. I'm fine with any one of the 3 to be used... Your call though. Since 'enabled' is used for the without CAPS test and 'resizing' for the wrong machine test, then perhaps 'disabled' should be the one carried through - just a thought as all 3 would then "prove" the ability to parse the 3 options.
Good point. I've reduced it to just two input files: pseries-hpt-resizing, loaded once with the capability present and once with the capability absent, and pseries-hpt-resizing-invalid-machine, which behaves the same as before. I'm going to push the series shortly, thanks for your review! :) -- Andrea Bolognani / Red Hat / Virtualization

Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- docs/formatdomain.html.in | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 92e14a919..0ca693092 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -1709,7 +1709,7 @@ <pvspinlock state='on'/> <gic version='2'/> <ioapic driver='qemu'/> - + <hpt resizing='required'/> </features> ...</pre> @@ -1878,6 +1878,17 @@ which is also known as a split I/O APIC mode. <span class="since">Since 3.4.0</span> (QEMU/KVM only) </dd> + <dt><code>hpt</code></dt> + <dd>Configure the HPT (Hash Page Table) of a pSeries guest. Possible + values for the <code>resizing</code> attribute are + <code>enabled</code>, which causes HPT resizing to be enabled if + both the guest and the host support it; <code>disabled</code>, which + causes HPT resizing to be disabled regardless of guest and host + support; and <code>required</code>, which prevents the guest from + starting unless both the guest and the host support HPT resizing. If + the attribute is not defined, the hypervisor default will be used. + <span class="since">Since 3.10.0</span> (QEMU/KVM only) + </dd> </dl> <h3><a id="elementsTime">Time keeping</a></h3> -- 2.13.6

On 11/06/2017 11:08 AM, Andrea Bolognani wrote:
Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- docs/formatdomain.html.in | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
Reviewed-by: John Ferlan <jferlan@redhat.com> John

Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- docs/news.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/news.xml b/docs/news.xml index ef855d895..9fbc61f0c 100644 --- a/docs/news.xml +++ b/docs/news.xml @@ -35,6 +35,16 @@ <libvirt> <release version="v3.10.0" date="unreleased"> <section title="New features"> + <change> + <summary> + qemu: Add the ability to configure HPT resizing for pSeries guests + </summary> + <description> + The user can now decide whether HPT (Hash Page Table) resizing + should be enabled, disabled or required instead of leaving it up to + hypervisor defaults and negotiation between the guest and the host. + </description> + </change> </section> <section title="Improvements"> </section> -- 2.13.6

On 11/06/2017 11:08 AM, Andrea Bolognani wrote:
Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- docs/news.xml | 10 ++++++++++ 1 file changed, 10 insertions(+)
With the very obvious merge with current top... Reviewed-by: John Ferlan <jferlan@redhat.com> John
participants (2)
-
Andrea Bolognani
-
John Ferlan