[libvirt] [PATCH 0/6] qemu: Implement nested HV support for pSeries guests

Andrea Bolognani (6): qemu: Drop duplicated code from qemuDomainDefValidateFeatures() tests: Add capabilities data for QEMU 3.1.0 on ppc64 qemu: Introduce QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV conf: Parse and format nested-hv feature qemu: Format nested-hv feature on the command line news: Document nested-hv feature docs/formatdomain.html.in | 12 + docs/news.xml | 10 + docs/schemas/domaincommon.rng | 5 + src/conf/domain_conf.c | 4 + src/conf/domain_conf.h | 1 + src/qemu/qemu_capabilities.c | 2 + src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 20 + src/qemu/qemu_domain.c | 15 +- .../caps_3.1.0.ppc64.replies | 23503 ++++++++++++++++ .../qemucapabilitiesdata/caps_3.1.0.ppc64.xml | 1076 + tests/qemucapabilitiestest.c | 1 + .../qemucaps2xmloutdata/caps_3.1.0.ppc64.xml | 26 + tests/qemucaps2xmltest.c | 1 + tests/qemuxml2argvdata/pseries-features.args | 2 +- tests/qemuxml2argvdata/pseries-features.xml | 1 + tests/qemuxml2argvtest.c | 1 + tests/qemuxml2xmloutdata/pseries-features.xml | 1 + tests/qemuxml2xmltest.c | 1 + 19 files changed, 24669 insertions(+), 14 deletions(-) create mode 100644 tests/qemucapabilitiesdata/caps_3.1.0.ppc64.replies create mode 100644 tests/qemucapabilitiesdata/caps_3.1.0.ppc64.xml create mode 100644 tests/qemucaps2xmloutdata/caps_3.1.0.ppc64.xml -- 2.19.1

Both VIR_DOMAIN_FEATURE_HPT and VIR_DOMAIN_FEATURE_HTM are handled in the exact same way, so we can remove some duplicated code without losing any functionality. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- There are plenty more opportunities for refactoring in the code that handles features, but I didn't want to fall into the usual yak-shaving trap so I'm going to work on those now and send the changes as a separate series. src/qemu/qemu_domain.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 2f65bbe34e..a8a235a897 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3889,6 +3889,7 @@ qemuDomainDefValidateFeatures(const virDomainDef *def, break; case VIR_DOMAIN_FEATURE_HPT: + case VIR_DOMAIN_FEATURE_HTM: if (def->features[i] != VIR_TRISTATE_SWITCH_ABSENT && !qemuDomainIsPSeries(def)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -3923,19 +3924,6 @@ qemuDomainDefValidateFeatures(const virDomainDef *def, } break; - case VIR_DOMAIN_FEATURE_HTM: - if (def->features[i] != VIR_TRISTATE_SWITCH_ABSENT && - !qemuDomainIsPSeries(def)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("The '%s' feature is not supported for " - "architecture '%s' or machine type '%s'"), - featureName, - virArchToString(def->os.arch), - def->os.machine); - return -1; - } - break; - case VIR_DOMAIN_FEATURE_ACPI: case VIR_DOMAIN_FEATURE_APIC: case VIR_DOMAIN_FEATURE_PAE: -- 2.19.1

Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- Snipped heavily; the full patch can be retrieved from https://github.com/andreabolognani/libvirt/tree/nested-hv .../caps_3.1.0.ppc64.replies | 23503 ++++++++++++++++ .../qemucapabilitiesdata/caps_3.1.0.ppc64.xml | 1075 + tests/qemucapabilitiestest.c | 1 + .../qemucaps2xmloutdata/caps_3.1.0.ppc64.xml | 26 + tests/qemucaps2xmltest.c | 1 + 5 files changed, 24606 insertions(+) create mode 100644 tests/qemucapabilitiesdata/caps_3.1.0.ppc64.replies create mode 100644 tests/qemucapabilitiesdata/caps_3.1.0.ppc64.xml create mode 100644 tests/qemucaps2xmloutdata/caps_3.1.0.ppc64.xml diff --git a/tests/qemucapabilitiesdata/caps_3.1.0.ppc64.replies b/tests/qemucapabilitiesdata/caps_3.1.0.ppc64.replies new file mode 100644 index 0000000000..5f57a3bb18 --- /dev/null +++ b/tests/qemucapabilitiesdata/caps_3.1.0.ppc64.replies @@ -0,0 +1,23503 @@ +{ + "execute": "qmp_capabilities", + "id": "libvirt-1" +} + +{ + "return": { + }, + "id": "libvirt-1" +} + +{ + "execute": "query-version", + "id": "libvirt-2" +} + +{ + "return": { + "qemu": { + "micro": 91, + "minor": 0, + "major": 3 + }, + "package": "v3.1.0-rc1-74-g3c035a41dc" + }, + "id": "libvirt-2" +} [...] diff --git a/tests/qemucapabilitiesdata/caps_3.1.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_3.1.0.ppc64.xml new file mode 100644 index 0000000000..e3e1b6b281 --- /dev/null +++ b/tests/qemucapabilitiesdata/caps_3.1.0.ppc64.xml @@ -0,0 +1,1075 @@ +<qemuCaps> [...] + <version>3000091</version> + <kvmVersion>0</kvmVersion> + <microcodeVersion>437731</microcodeVersion> + <package>v3.1.0-rc1-74-g3c035a41dc</package> + <arch>ppc64</arch> [...] diff --git a/tests/qemucapabilitiestest.c b/tests/qemucapabilitiestest.c index 8fe5a55e1d..ff7e9601a2 100644 --- a/tests/qemucapabilitiestest.c +++ b/tests/qemucapabilitiestest.c @@ -186,6 +186,7 @@ mymain(void) DO_TEST("ppc64", "caps_2.10.0"); DO_TEST("ppc64", "caps_2.12.0"); DO_TEST("ppc64", "caps_3.0.0"); + DO_TEST("ppc64", "caps_3.1.0"); DO_TEST("s390x", "caps_2.7.0"); DO_TEST("s390x", "caps_2.8.0"); DO_TEST("s390x", "caps_2.9.0"); diff --git a/tests/qemucaps2xmloutdata/caps_3.1.0.ppc64.xml b/tests/qemucaps2xmloutdata/caps_3.1.0.ppc64.xml new file mode 100644 index 0000000000..85623f3980 --- /dev/null +++ b/tests/qemucaps2xmloutdata/caps_3.1.0.ppc64.xml @@ -0,0 +1,26 @@ +<capabilities> + + <host> + <cpu> + <arch>ppc64</arch> + </cpu> + <power_management/> + <iommu support='no'/> + </host> + + <guest> + <os_type>hvm</os_type> + <arch name='ppc64'> + <wordsize>64</wordsize> + <emulator>/usr/bin/qemu-system-ppc64</emulator> + <domain type='qemu'/> + <domain type='kvm'/> + </arch> + <features> + <cpuselection/> + <deviceboot/> + <disksnapshot default='on' toggle='no'/> + </features> + </guest> + +</capabilities> diff --git a/tests/qemucaps2xmltest.c b/tests/qemucaps2xmltest.c index 883909a973..3688c4a3b4 100644 --- a/tests/qemucaps2xmltest.c +++ b/tests/qemucaps2xmltest.c @@ -208,6 +208,7 @@ mymain(void) DO_TEST("ppc64", "caps_2.10.0"); DO_TEST("ppc64", "caps_2.12.0"); DO_TEST("ppc64", "caps_3.0.0"); + DO_TEST("ppc64", "caps_3.1.0"); DO_TEST("s390x", "caps_2.7.0"); DO_TEST("s390x", "caps_2.8.0"); DO_TEST("s390x", "caps_2.9.0"); -- 2.19.1

Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- src/qemu/qemu_capabilities.c | 2 ++ src/qemu/qemu_capabilities.h | 1 + tests/qemucapabilitiesdata/caps_3.1.0.ppc64.xml | 1 + tests/qemuxml2argvtest.c | 1 + tests/qemuxml2xmltest.c | 1 + 5 files changed, 6 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index fde27010e4..20a1a0c201 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -515,6 +515,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, /* 320 */ "memory-backend-memfd.hugetlb", "iothread.poll-max-ns", + "machine.pseries.cap-nested-hv", ); @@ -1372,6 +1373,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsMemoryBackendMemfd[] static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsSPAPRMachine[] = { { "cap-hpt-max-page-size", QEMU_CAPS_MACHINE_PSERIES_CAP_HPT_MAX_PAGE_SIZE }, { "cap-htm", QEMU_CAPS_MACHINE_PSERIES_CAP_HTM }, + { "cap-nested-hv", QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV }, }; static virQEMUCapsObjectTypeProps virQEMUCapsObjectProps[] = { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index c2caaf6fe1..b1990b6bb8 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -499,6 +499,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */ /* 320 */ QEMU_CAPS_OBJECT_MEMORY_MEMFD_HUGETLB, /* -object memory-backend-memfd.hugetlb */ QEMU_CAPS_IOTHREAD_POLLING, /* -object iothread.poll-max-ns */ + QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV, /* -machine pseries.cap-nested-hv */ QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/tests/qemucapabilitiesdata/caps_3.1.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_3.1.0.ppc64.xml index e3e1b6b281..b06b17316a 100644 --- a/tests/qemucapabilitiesdata/caps_3.1.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_3.1.0.ppc64.xml @@ -165,6 +165,7 @@ <flag name='memory-backend-memfd'/> <flag name='memory-backend-memfd.hugetlb'/> <flag name='iothread.poll-max-ns'/> + <flag name='machine.pseries.cap-nested-hv'/> <version>3000091</version> <kvmVersion>0</kvmVersion> <microcodeVersion>437731</microcodeVersion> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 95429b3ae7..eae2b7edf7 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1981,6 +1981,7 @@ mymain(void) QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, QEMU_CAPS_MACHINE_PSERIES_CAP_HPT_MAX_PAGE_SIZE, QEMU_CAPS_MACHINE_PSERIES_CAP_HTM, + QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV, QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT); DO_TEST_FAILURE("pseries-features", QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE); diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 4d1a3610ef..2527497675 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -621,6 +621,7 @@ mymain(void) QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, QEMU_CAPS_MACHINE_PSERIES_CAP_HPT_MAX_PAGE_SIZE, QEMU_CAPS_MACHINE_PSERIES_CAP_HTM, + QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV, QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT); DO_TEST("pseries-serial-native", -- 2.19.1

Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- docs/formatdomain.html.in | 12 ++++++++++++ docs/schemas/domaincommon.rng | 5 +++++ src/conf/domain_conf.c | 4 ++++ src/conf/domain_conf.h | 1 + src/qemu/qemu_domain.c | 1 + tests/qemuxml2argvdata/pseries-features.xml | 1 + tests/qemuxml2xmloutdata/pseries-features.xml | 1 + 7 files changed, 25 insertions(+) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 2af4960981..84259c45e4 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -2295,6 +2295,18 @@ defined, the hypervisor default will be used. <span class="since">Since 4.6.0</span> (QEMU/KVM only) </dd> + <dt><code>nested-hv</code></dt> + <dd>Configure nested HV availability for pSeries guests. This needs to + be enabled from the host (L0) in order to be effective; having HV + support in the (L1) guest is very desiderable if it's planned to + run nested (L2) guests inside it, because it will result in those + nested guests having much better performance than they would when + using KVM PR or TCG. + Possible values for the <code>state</code> attribute are + <code>on</code> and <code>off</code>. If the attribute is not + defined, the hypervisor default will be used. + <span class="since">Since 4.10.0</span> (QEMU/KVM only) + </dd> </dl> <h3><a id="elementsTime">Time keeping</a></h3> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 5ee727eefa..d7a022a4ae 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -4976,6 +4976,11 @@ <ref name="featurestate"/> </element> </optional> + <optional> + <element name="nested-hv"> + <ref name="featurestate"/> + </element> + </optional> </interleave> </element> </optional> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 13874837c2..90f5618a04 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -153,6 +153,7 @@ VIR_ENUM_IMPL(virDomainFeature, VIR_DOMAIN_FEATURE_LAST, "hpt", "vmcoreinfo", "htm", + "nested-hv", ); VIR_ENUM_IMPL(virDomainCapabilitiesPolicy, VIR_DOMAIN_CAPABILITIES_POLICY_LAST, @@ -20155,6 +20156,7 @@ virDomainDefParseXML(xmlDocPtr xml, break; case VIR_DOMAIN_FEATURE_HTM: + case VIR_DOMAIN_FEATURE_NESTED_HV: if (!(tmp = virXMLPropString(nodes[i], "state"))) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("missing state attribute '%s' of feature '%s'"), @@ -22317,6 +22319,7 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr src, case VIR_DOMAIN_FEATURE_SMM: case VIR_DOMAIN_FEATURE_VMCOREINFO: case VIR_DOMAIN_FEATURE_HTM: + case VIR_DOMAIN_FEATURE_NESTED_HV: if (src->features[i] != dst->features[i]) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("State of feature '%s' differs: " @@ -28232,6 +28235,7 @@ virDomainDefFormatInternal(virDomainDefPtr def, case VIR_DOMAIN_FEATURE_PVSPINLOCK: case VIR_DOMAIN_FEATURE_VMPORT: case VIR_DOMAIN_FEATURE_HTM: + case VIR_DOMAIN_FEATURE_NESTED_HV: switch ((virTristateSwitch) def->features[i]) { case VIR_TRISTATE_SWITCH_LAST: case VIR_TRISTATE_SWITCH_ABSENT: diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 467785cd83..b84db2ab7c 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1777,6 +1777,7 @@ typedef enum { VIR_DOMAIN_FEATURE_HPT, VIR_DOMAIN_FEATURE_VMCOREINFO, VIR_DOMAIN_FEATURE_HTM, + VIR_DOMAIN_FEATURE_NESTED_HV, VIR_DOMAIN_FEATURE_LAST } virDomainFeature; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index a8a235a897..ee61caa823 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3890,6 +3890,7 @@ qemuDomainDefValidateFeatures(const virDomainDef *def, case VIR_DOMAIN_FEATURE_HPT: case VIR_DOMAIN_FEATURE_HTM: + case VIR_DOMAIN_FEATURE_NESTED_HV: if (def->features[i] != VIR_TRISTATE_SWITCH_ABSENT && !qemuDomainIsPSeries(def)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, diff --git a/tests/qemuxml2argvdata/pseries-features.xml b/tests/qemuxml2argvdata/pseries-features.xml index 5c842fe87b..6f7d32b065 100644 --- a/tests/qemuxml2argvdata/pseries-features.xml +++ b/tests/qemuxml2argvdata/pseries-features.xml @@ -11,6 +11,7 @@ <maxpagesize unit='GiB'>1</maxpagesize> </hpt> <htm state='on'/> + <nested-hv state='off'/> </features> <devices> <emulator>/usr/bin/qemu-system-ppc64</emulator> diff --git a/tests/qemuxml2xmloutdata/pseries-features.xml b/tests/qemuxml2xmloutdata/pseries-features.xml index 55a44c75a0..7e12bc9c03 100644 --- a/tests/qemuxml2xmloutdata/pseries-features.xml +++ b/tests/qemuxml2xmloutdata/pseries-features.xml @@ -13,6 +13,7 @@ <maxpagesize unit='KiB'>1048576</maxpagesize> </hpt> <htm state='on'/> + <nested-hv state='off'/> </features> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> -- 2.19.1

Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- src/qemu/qemu_command.c | 20 ++++++++++++++++++++ tests/qemuxml2argvdata/pseries-features.args | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 23a6661c10..315419c71b 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7468,6 +7468,26 @@ qemuBuildMachineCommandLine(virCommandPtr cmd, virBufferAsprintf(&buf, ",cap-htm=%s", str); } + if (def->features[VIR_DOMAIN_FEATURE_NESTED_HV] != VIR_TRISTATE_SWITCH_ABSENT) { + const char *str; + + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Nested HV configuration is not supported by " + "this QEMU binary")); + goto cleanup; + } + + str = virTristateSwitchTypeToString(def->features[VIR_DOMAIN_FEATURE_NESTED_HV]); + if (!str) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Invalid setting for nested HV state")); + goto cleanup; + } + + virBufferAsprintf(&buf, ",cap-nested-hv=%s", str); + } + if (cpu && cpu->model && cpu->mode == VIR_CPU_MODE_HOST_MODEL && qemuDomainIsPSeries(def) && diff --git a/tests/qemuxml2argvdata/pseries-features.args b/tests/qemuxml2argvdata/pseries-features.args index 5d4b5ce930..0acab91c2a 100644 --- a/tests/qemuxml2argvdata/pseries-features.args +++ b/tests/qemuxml2argvdata/pseries-features.args @@ -8,7 +8,7 @@ QEMU_AUDIO_DRV=none \ -name guest \ -S \ -machine pseries,accel=tcg,usb=off,dump-guest-core=off,resize-hpt=required,\ -cap-hpt-max-page-size=1048576k,cap-htm=on \ +cap-hpt-max-page-size=1048576k,cap-htm=on,cap-nested-hv=off \ -m 512 \ -smp 1,sockets=1,cores=1,threads=1 \ -uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \ -- 2.19.1

On 11/20/18 6:08 PM, Andrea Bolognani wrote:
Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- src/qemu/qemu_command.c | 20 ++++++++++++++++++++ tests/qemuxml2argvdata/pseries-features.args | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 23a6661c10..315419c71b 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7468,6 +7468,26 @@ qemuBuildMachineCommandLine(virCommandPtr cmd, virBufferAsprintf(&buf, ",cap-htm=%s", str); }
+ if (def->features[VIR_DOMAIN_FEATURE_NESTED_HV] != VIR_TRISTATE_SWITCH_ABSENT) { + const char *str; + + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Nested HV configuration is not supported by " + "this QEMU binary")); + goto cleanup; + } + + str = virTristateSwitchTypeToString(def->features[VIR_DOMAIN_FEATURE_NESTED_HV]); + if (!str) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Invalid setting for nested HV state")); + goto cleanup; + }
How can this be? The only possibility I see if def->features[VIR_DOMAIN_FEATURE_NESTED_HV] wasn't 1 or 2. But then we are in much bigger trouble anyway. I suggest removing it. We don't check for the retval anywhere else.
+ + virBufferAsprintf(&buf, ",cap-nested-hv=%s", str); + } + if (cpu && cpu->model && cpu->mode == VIR_CPU_MODE_HOST_MODEL && qemuDomainIsPSeries(def) && diff --git a/tests/qemuxml2argvdata/pseries-features.args b/tests/qemuxml2argvdata/pseries-features.args index 5d4b5ce930..0acab91c2a 100644 --- a/tests/qemuxml2argvdata/pseries-features.args +++ b/tests/qemuxml2argvdata/pseries-features.args @@ -8,7 +8,7 @@ QEMU_AUDIO_DRV=none \ -name guest \ -S \ -machine pseries,accel=tcg,usb=off,dump-guest-core=off,resize-hpt=required,\ -cap-hpt-max-page-size=1048576k,cap-htm=on \ +cap-hpt-max-page-size=1048576k,cap-htm=on,cap-nested-hv=off \ -m 512 \ -smp 1,sockets=1,cores=1,threads=1 \ -uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \
Michal

On Mon, 2018-11-26 at 16:21 +0100, Michal Privoznik wrote:
On 11/20/18 6:08 PM, Andrea Bolognani wrote: [...]
+ str = virTristateSwitchTypeToString(def->features[VIR_DOMAIN_FEATURE_NESTED_HV]); + if (!str) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Invalid setting for nested HV state")); + goto cleanup; + }
How can this be? The only possibility I see if def->features[VIR_DOMAIN_FEATURE_NESTED_HV] wasn't 1 or 2. But then we are in much bigger trouble anyway. I suggest removing it. We don't check for the retval anywhere else.
We check it at least for FEATURE_HTM and FEATURE_HPT; then again, it was me who introduced those features, so... O:-) I've left it as-is for the time being, but I can post a patch that gets rid of all such checks in one fell swoop if you'd like. And thanks for the review! -- Andrea Bolognani / Red Hat / Virtualization

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 4406aeb775..3569c6cd48 100644 --- a/docs/news.xml +++ b/docs/news.xml @@ -68,6 +68,16 @@ be viewed via the domain statistics. </description> </change> + <change> + <summary> + qemu: Add support for nested HV for pSeries guests + </summary> + <description> + Nested HV support makes it possible to run nested (L2) guests + with minimal performance penalty when compared to regular (L1) + guests on ppc64 hardware. + </description> + </change> </section> <section title="Improvements"> </section> -- 2.19.1

On 11/20/18 6:08 PM, Andrea Bolognani wrote:
Andrea Bolognani (6): qemu: Drop duplicated code from qemuDomainDefValidateFeatures() tests: Add capabilities data for QEMU 3.1.0 on ppc64 qemu: Introduce QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV conf: Parse and format nested-hv feature qemu: Format nested-hv feature on the command line news: Document nested-hv feature
docs/formatdomain.html.in | 12 + docs/news.xml | 10 + docs/schemas/domaincommon.rng | 5 + src/conf/domain_conf.c | 4 + src/conf/domain_conf.h | 1 + src/qemu/qemu_capabilities.c | 2 + src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 20 + src/qemu/qemu_domain.c | 15 +- .../caps_3.1.0.ppc64.replies | 23503 ++++++++++++++++ .../qemucapabilitiesdata/caps_3.1.0.ppc64.xml | 1076 + tests/qemucapabilitiestest.c | 1 + .../qemucaps2xmloutdata/caps_3.1.0.ppc64.xml | 26 + tests/qemucaps2xmltest.c | 1 + tests/qemuxml2argvdata/pseries-features.args | 2 +- tests/qemuxml2argvdata/pseries-features.xml | 1 + tests/qemuxml2argvtest.c | 1 + tests/qemuxml2xmloutdata/pseries-features.xml | 1 + tests/qemuxml2xmltest.c | 1 + 19 files changed, 24669 insertions(+), 14 deletions(-) create mode 100644 tests/qemucapabilitiesdata/caps_3.1.0.ppc64.replies create mode 100644 tests/qemucapabilitiesdata/caps_3.1.0.ppc64.xml create mode 100644 tests/qemucaps2xmloutdata/caps_3.1.0.ppc64.xml
ACK Michal
participants (2)
-
Andrea Bolognani
-
Michal Privoznik