From nobody Thu May 2 08:43:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1516722339965141.52897507607395; Tue, 23 Jan 2018 07:45:39 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 36EBE4661; Tue, 23 Jan 2018 15:45:38 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0046C18F18; Tue, 23 Jan 2018 15:45:37 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id B92C918033DB; Tue, 23 Jan 2018 15:45:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w0NFjaGL023508 for ; Tue, 23 Jan 2018 10:45:36 -0500 Received: by smtp.corp.redhat.com (Postfix) id EC85C17B70; Tue, 23 Jan 2018 15:45:36 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.43.2.98]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7320817B68 for ; Tue, 23 Jan 2018 15:45:32 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 23 Jan 2018 16:45:00 +0100 Message-Id: <20180123154504.9541-2-abologna@redhat.com> In-Reply-To: <20180123154504.9541-1-abologna@redhat.com> References: <20180123154504.9541-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/5] docs: Refactor schema for 'resizing' attribute X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 23 Jan 2018 15:45:38 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We're going to use the same attribute for two elements, so it makes sense to give it its own stand-alone definition. Signed-off-by: Andrea Bolognani --- docs/schemas/domaincommon.rng | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index f22c932f6..75838b581 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -4952,13 +4952,7 @@ =20 - - - enabled - disabled - required - - + =20 @@ -5740,6 +5734,16 @@ =20 + + + + enabled + disabled + required + + + + --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 08:43:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1516722548486665.5258771522792; Tue, 23 Jan 2018 07:49:08 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 537F8C070E30; Tue, 23 Jan 2018 15:49:07 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2034DBA75; Tue, 23 Jan 2018 15:49:07 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id DB9F03FC75; Tue, 23 Jan 2018 15:49:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w0NFjgXp023521 for ; Tue, 23 Jan 2018 10:45:42 -0500 Received: by smtp.corp.redhat.com (Postfix) id 905B8176C0; Tue, 23 Jan 2018 15:45:42 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.43.2.98]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DF138176C9 for ; Tue, 23 Jan 2018 15:45:37 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 23 Jan 2018 16:45:01 +0100 Message-Id: <20180123154504.9541-3-abologna@redhat.com> In-Reply-To: <20180123154504.9541-1-abologna@redhat.com> References: <20180123154504.9541-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/5] conf: Add pSeries features X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 23 Jan 2018 15:49:07 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We're going to introduce a number of optional, pSeries-specific features, so we want to have a dedicated sub-element to avoid cluttering the element. Along with the generic framework, we also introduce the first actual feature: HPT (Hash Page Table) tuning. This will replace the existing feature later on, but right now they simply co-exist without interfering with each other. Signed-off-by: Andrea Bolognani --- docs/formatdomain.html.in | 20 +++++++++ docs/schemas/domaincommon.rng | 16 +++++++ src/conf/domain_conf.c | 102 ++++++++++++++++++++++++++++++++++++++= ++++ src/conf/domain_conf.h | 11 +++++ src/libvirt_private.syms | 2 + src/qemu/qemu_command.c | 93 ++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_domain.c | 7 +++ 7 files changed, 251 insertions(+) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index d272cc1ba..b2584fbb0 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -1768,6 +1768,9 @@ <kvm> <hidden state=3D'on'/> </kvm> + <pseries> + <hpt resizing=3D'required'/> + </pseries> <pvspinlock state=3D'on'/> <gic version=3D'2'/> <ioapic driver=3D'qemu'/> @@ -1904,6 +1907,23 @@ +
pseries
+
Various features to change the behavior of pSeries guests. + + + + + + + + + + + + + +
FeatureDescriptionValueSince
hptConfigure HPT (Hash Page Table)resizing: enabled, disabled, required4.1.0 (QEMU 2.10)
+
pmu
Depending on the state attribute (values on, off, default on) enable or disable the diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 75838b581..fead6e7cc 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -4703,6 +4703,9 @@ + + + @@ -5526,6 +5529,19 @@ =20 + + + + + + + + + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index a1c25060f..577a804df 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -152,6 +152,7 @@ VIR_ENUM_IMPL(virDomainFeature, VIR_DOMAIN_FEATURE_LAST, "ioapic", "hpt", "vmcoreinfo", + "pseries", ); =20 VIR_ENUM_IMPL(virDomainCapabilitiesPolicy, VIR_DOMAIN_CAPABILITIES_POLICY_= LAST, @@ -173,6 +174,11 @@ VIR_ENUM_IMPL(virDomainHyperv, VIR_DOMAIN_HYPERV_LAST, VIR_ENUM_IMPL(virDomainKVM, VIR_DOMAIN_KVM_LAST, "hidden") =20 +VIR_ENUM_IMPL(virDomainPSeries, + VIR_DOMAIN_PSERIES_LAST, + "hpt", +); + VIR_ENUM_IMPL(virDomainCapsFeature, VIR_DOMAIN_CAPS_FEATURE_LAST, "audit_control", "audit_write", @@ -18879,6 +18885,7 @@ virDomainDefParseXML(xmlDocPtr xml, case VIR_DOMAIN_FEATURE_HYPERV: case VIR_DOMAIN_FEATURE_VMCOREINFO: case VIR_DOMAIN_FEATURE_KVM: + case VIR_DOMAIN_FEATURE_PSERIES: def->features[val] =3D VIR_TRISTATE_SWITCH_ON; break; =20 @@ -19114,6 +19121,54 @@ virDomainDefParseXML(xmlDocPtr xml, VIR_FREE(nodes); } =20 + if (def->features[VIR_DOMAIN_FEATURE_PSERIES] =3D=3D VIR_TRISTATE_SWIT= CH_ON) { + int feature; + int value; + + if ((n =3D virXPathNodeSet("./features/pseries/*", ctxt, &nodes)) = < 0) + goto error; + + for (i =3D 0; i < n; i++) { + feature =3D virDomainPSeriesTypeFromString((const char *) node= s[i]->name); + + if (feature < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unknown '%s' pSeries feature"), + nodes[i]->name); + goto error; + } + + switch ((virDomainPSeries) feature) { + case VIR_DOMAIN_PSERIES_HPT: + if (!(tmp =3D virXMLPropString(nodes[i], "resizing"))) { + virReportError(VIR_ERR_XML_ERROR, + _("Missing '%s' attribute for " + "'%s' pSeries feature"), + "resizing", nodes[i]->name); + goto error; + } + + if ((value =3D virDomainHPTResizingTypeFromString(tmp)) < = 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Invalid value '%s' for '%s' " + "attribute of '%s' pSeries feature"), + tmp, "resizing", nodes[i]->name); + goto error; + } + + def->pseries_features[feature] =3D VIR_TRISTATE_SWITCH_ON; + def->pseries_hpt_resizing =3D value; + + VIR_FREE(tmp); + break; + + case VIR_DOMAIN_PSERIES_LAST: + break; + } + } + VIR_FREE(nodes); + } + if ((n =3D virXPathNodeSet("./features/capabilities/*", ctxt, &nodes))= < 0) goto error; =20 @@ -21140,6 +21195,29 @@ virDomainDefFeaturesCheckABIStability(virDomainDef= Ptr src, } } =20 + /* pSeries features */ + if (src->features[VIR_DOMAIN_FEATURE_PSERIES] =3D=3D VIR_TRISTATE_SWIT= CH_ON) { + for (i =3D 0; i < VIR_DOMAIN_PSERIES_LAST; i++) { + switch ((virDomainPSeries) i) { + case VIR_DOMAIN_PSERIES_HPT: + if (src->pseries_features[i] !=3D dst->pseries_features[i]= || + src->pseries_hpt_resizing !=3D dst->pseries_hpt_resizi= ng) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("State of '%s' pSeries feature differ= s: " + "source: '%s', destination: '%s'"), + virDomainPSeriesTypeToString(i), + virDomainHPTResizingTypeToString(src->p= series_hpt_resizing), + virDomainHPTResizingTypeToString(dst->p= series_hpt_resizing)); + return false; + } + break; + + case VIR_DOMAIN_PSERIES_LAST: + break; + } + } + } + /* ioapic */ if (src->ioapic !=3D dst->ioapic) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -26487,6 +26565,30 @@ virDomainDefFormatInternal(virDomainDefPtr def, virBufferAddLit(buf, "\n"); break; =20 + case VIR_DOMAIN_FEATURE_PSERIES: + if (def->features[i] !=3D VIR_TRISTATE_SWITCH_ON) + break; + + virBufferAddLit(buf, "\n"); + virBufferAdjustIndent(buf, 2); + for (j =3D 0; j < VIR_DOMAIN_PSERIES_LAST; j++) { + switch ((virDomainPSeries) j) { + case VIR_DOMAIN_PSERIES_HPT: + if (def->pseries_features[j] !=3D VIR_TRISTATE_SWI= TCH_ON) + break; + + virBufferAsprintf(buf, "\n", + virDomainHPTResizingTypeToString= (def->pseries_hpt_resizing)); + break; + + case VIR_DOMAIN_PSERIES_LAST: + break; + } + } + virBufferAdjustIndent(buf, -2); + virBufferAddLit(buf, "\n"); + break; + case VIR_DOMAIN_FEATURE_CAPABILITIES: if (def->features[i] =3D=3D VIR_DOMAIN_CAPABILITIES_POLICY= _DEFAULT && !virDomainDefHasCapabilitiesFeatures(def)) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 6f7f96b3d..e4ae2a26c 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1740,6 +1740,7 @@ typedef enum { VIR_DOMAIN_FEATURE_IOAPIC, VIR_DOMAIN_FEATURE_HPT, VIR_DOMAIN_FEATURE_VMCOREINFO, + VIR_DOMAIN_FEATURE_PSERIES, =20 VIR_DOMAIN_FEATURE_LAST } virDomainFeature; @@ -1766,6 +1767,14 @@ typedef enum { VIR_DOMAIN_KVM_LAST } virDomainKVM; =20 +typedef enum { + VIR_DOMAIN_PSERIES_HPT =3D 0, + + VIR_DOMAIN_PSERIES_LAST +} virDomainPSeries; + +VIR_ENUM_DECL(virDomainPSeries); + typedef enum { VIR_DOMAIN_CAPABILITIES_POLICY_DEFAULT =3D 0, VIR_DOMAIN_CAPABILITIES_POLICY_ALLOW, @@ -2346,11 +2355,13 @@ struct _virDomainDef { int apic_eoi; int hyperv_features[VIR_DOMAIN_HYPERV_LAST]; int kvm_features[VIR_DOMAIN_KVM_LAST]; + int pseries_features[VIR_DOMAIN_PSERIES_LAST]; unsigned int hyperv_spinlocks; virGICVersion gic_version; char *hyperv_vendor_id; virDomainIOAPIC ioapic; virDomainHPTResizing hpt_resizing; + virDomainHPTResizing pseries_hpt_resizing; =20 /* These options are of type virTristateSwitch: ON =3D keep, OFF =3D d= rop */ int caps_features[VIR_DOMAIN_CAPS_FEATURE_LAST]; diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index bc8cc1fba..ae9eecb5d 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -484,6 +484,8 @@ virDomainPausedReasonTypeFromString; virDomainPausedReasonTypeToString; virDomainPMSuspendedReasonTypeFromString; virDomainPMSuspendedReasonTypeToString; +virDomainPSeriesTypeFromString; +virDomainPSeriesTypeToString; virDomainRedirdevBusTypeFromString; virDomainRedirdevBusTypeToString; virDomainRedirdevDefFind; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index b8aede32d..a053b597c 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7360,6 +7360,79 @@ qemuBuildNameCommandLine(virCommandPtr cmd, return 0; } =20 +static int +virDomainPSeriesToQEMUCaps(int feature) +{ + switch ((virDomainPSeries) feature) { + case VIR_DOMAIN_PSERIES_HPT: + return QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT; + case VIR_DOMAIN_PSERIES_LAST: + break; + } + + return -1; +} + +static const char* +virDomainPSeriesToMachineOption(int feature) +{ + switch ((virDomainPSeries) feature) { + case VIR_DOMAIN_PSERIES_HPT: + return "resize-hpt"; + case VIR_DOMAIN_PSERIES_LAST: + break; + } + + return NULL; +} + +static int +qemuBuildMachineCommandLinePSeriesFeature(virBufferPtr buf, + virDomainPSeries feature, + const char *value, + virQEMUCapsPtr qemuCaps) +{ + const char *name =3D virDomainPSeriesTypeToString(feature); + const char *option =3D virDomainPSeriesToMachineOption(feature); + int cap; + int ret =3D -1; + + if (!option) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unknown QEMU option for '%s' pSeries feature"), + name); + goto cleanup; + } + + if (!value) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Invalid value for '%s' pSeries feature"), + name); + goto cleanup; + } + + if ((cap =3D virDomainPSeriesToQEMUCaps(feature)) < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unknown QEMU capability for '%s' pSeries feature= "), + name); + goto cleanup; + } + + if (!virQEMUCapsGet(qemuCaps, cap)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("'%s' pSeries feature not supported by this QEMU = binary"), + name); + goto cleanup; + } + + virBufferAsprintf(buf, ",%s=3D%s", option, value); + + ret =3D 0; + + cleanup: + return ret; +} + static int qemuBuildMachineCommandLine(virCommandPtr cmd, virQEMUDriverConfigPtr cfg, @@ -7592,6 +7665,26 @@ qemuBuildMachineCommandLine(virCommandPtr cmd, virBufferAsprintf(&buf, ",resize-hpt=3D%s", str); } =20 + if (def->features[VIR_DOMAIN_FEATURE_PSERIES] =3D=3D VIR_TRISTATE_= SWITCH_ON) { + const char *value; + + for (i =3D 0; i < VIR_DOMAIN_PSERIES_LAST; i++) { + switch ((virDomainPSeries) i) { + case VIR_DOMAIN_PSERIES_HPT: + if (def->pseries_features[i] !=3D VIR_TRISTATE_SWITCH_= ON) + break; + + value =3D virDomainHPTResizingTypeToString(def->pserie= s_hpt_resizing); + if (qemuBuildMachineCommandLinePSeriesFeature(&buf, i,= value, qemuCaps) < 0) + goto cleanup; + break; + + case VIR_DOMAIN_PSERIES_LAST: + goto cleanup; + } + } + } + if (cpu && cpu->model && cpu->mode =3D=3D VIR_CPU_MODE_HOST_MODEL && qemuDomainIsPSeries(def) && diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 6b4bd3cca..edef3838e 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3125,6 +3125,13 @@ qemuDomainDefVerifyFeatures(const virDomainDef *def) return -1; } =20 + if (def->features[VIR_DOMAIN_FEATURE_PSERIES] =3D=3D VIR_TRISTATE_SWIT= CH_ON && + !qemuDomainIsPSeries(def)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("pSeries features are only supported for pSeries = guests")); + return -1; + } + if (def->features[VIR_DOMAIN_FEATURE_HPT] =3D=3D VIR_TRISTATE_SWITCH_O= N && !qemuDomainIsPSeries(def)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 08:43:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1516722552885689.6662855850049; Tue, 23 Jan 2018 07:49:12 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D641276532; Tue, 23 Jan 2018 15:49:10 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A7CC11727B; Tue, 23 Jan 2018 15:49:10 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6EEBC3FB1A; Tue, 23 Jan 2018 15:49:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w0NFjtl9023541 for ; Tue, 23 Jan 2018 10:45:55 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7AF0717B70; Tue, 23 Jan 2018 15:45:55 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.43.2.98]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CDBBB65607 for ; Tue, 23 Jan 2018 15:45:42 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 23 Jan 2018 16:45:02 +0100 Message-Id: <20180123154504.9541-4-abologna@redhat.com> In-Reply-To: <20180123154504.9541-1-abologna@redhat.com> References: <20180123154504.9541-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/5] conf: Remove obsolete feature X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 23 Jan 2018 15:49:11 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Now that the feature has been implemented, we can get rid of the original feature and thus ensure all pSeries features are grouped together in the same sub-element. Compatibility code is provided so that existing guests can be parsed and migrated successfully despite the change. Signed-off-by: Andrea Bolognani --- docs/formatdomain.html.in | 12 --- src/conf/domain_conf.c | 105 ++++++++++++++----= ---- src/conf/domain_conf.h | 2 - src/qemu/qemu_command.c | 20 ----- src/qemu/qemu_domain.c | 8 -- tests/qemuxml2xmloutdata/pseries-hpt-resizing.xml | 4 +- 6 files changed, 71 insertions(+), 80 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index b2584fbb0..1e2fccaeb 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -1774,7 +1774,6 @@ <pvspinlock state=3D'on'/> <gic version=3D'2'/> <ioapic driver=3D'qemu'/> - <hpt resizing=3D'required'/> </features> ... =20 @@ -1960,17 +1959,6 @@ which is also known as a split I/O APIC mode. Since 3.4.0 (QEMU/KVM only)
-
hpt
-
Configure the HPT (Hash Page Table) of a pSeries guest. Possible - values for the resizing attribute are - enabled, which causes HPT resizing to be enabled if - both the guest and the host support it; disabled, w= hich - causes HPT resizing to be disabled regardless of guest and host - support; and required, 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 use= d. - Since 3.10.0 (QEMU/KVM only) -
vmcoreinfo
Enable QEMU vmcoreinfo device to let the guest kernel save debug details. Since 3.10.0 (QEMU only) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 577a804df..763228ca7 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -150,7 +150,6 @@ VIR_ENUM_IMPL(virDomainFeature, VIR_DOMAIN_FEATURE_LAST, "gic", "smm", "ioapic", - "hpt", "vmcoreinfo", "pseries", ); @@ -18857,6 +18856,36 @@ virDomainDefParseXML(xmlDocPtr xml, goto error; =20 for (i =3D 0; i < n; i++) { + + /* Compatibility code. + * + * Between 3.10.0 and 4.1.0, we had instead of + * , and we need to be able to parse exist= ing + * guest configurations; this takes care of it. Note that the comp= at + * code, like the original implementation and unlike the new one, + * must handle gracefully the 'resizing' attribute being absent */ + if (STREQ((const char *) nodes[i]->name, "hpt")) { + tmp =3D virXMLPropString(nodes[i], "resizing"); + if (tmp) { + int value =3D virDomainHPTResizingTypeFromString(tmp); + if (value < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Invalid value '%s' for '%s' " + "attribute of '%s' pSeries feature"), + tmp, "resizing", nodes[i]->name); + goto error; + } + + def->features[VIR_DOMAIN_FEATURE_PSERIES] =3D VIR_TRISTATE= _SWITCH_ON; + def->pseries_features[VIR_DOMAIN_PSERIES_HPT] =3D VIR_TRIS= TATE_SWITCH_ON; + def->pseries_hpt_resizing =3D value; + + VIR_FREE(tmp); + } + i++; + continue; + } + int val =3D virDomainFeatureTypeFromString((const char *)nodes[i]-= >name); if (val < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -18951,22 +18980,6 @@ virDomainDefParseXML(xmlDocPtr xml, } break; =20 - case VIR_DOMAIN_FEATURE_HPT: - tmp =3D virXMLPropString(nodes[i], "resizing"); - if (tmp) { - int value =3D virDomainHPTResizingTypeFromString(tmp); - if (value < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unknown HPT resizing setting: %s"), - tmp); - goto error; - } - def->hpt_resizing =3D value; - def->features[val] =3D VIR_TRISTATE_SWITCH_ON; - VIR_FREE(tmp); - } - break; - /* coverity[dead_error_begin] */ case VIR_DOMAIN_FEATURE_LAST: break; @@ -21228,18 +21241,6 @@ virDomainDefFeaturesCheckABIStability(virDomainDef= Ptr src, return false; } =20 - /* HPT resizing */ - if (src->features[VIR_DOMAIN_FEATURE_HPT] =3D=3D VIR_TRISTATE_SWITCH_O= N) { - if (src->hpt_resizing !=3D dst->hpt_resizing) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("HPT resizing configuration differs: " - "source: '%s', destination: '%s'"), - virDomainHPTResizingTypeToString(src->hpt_resiz= ing), - virDomainHPTResizingTypeToString(dst->hpt_resiz= ing)); - return false; - } - } - return true; } =20 @@ -26565,10 +26566,44 @@ virDomainDefFormatInternal(virDomainDefPtr def, virBufferAddLit(buf, "\n"); break; =20 - case VIR_DOMAIN_FEATURE_PSERIES: + case VIR_DOMAIN_FEATURE_PSERIES: { + bool needsPSeriesElement =3D false; + if (def->features[i] !=3D VIR_TRISTATE_SWITCH_ON) break; =20 + /* Figure out whether we need the element. + * For compatibility reasons (see below) we might need to + * skip it even though some pSeries features are enabled: + * namely, if the HPT feature is enabled and we're formatt= ing + * a migratable XML */ + for (j =3D 0; j < VIR_DOMAIN_PSERIES_LAST; j++) { + if (def->pseries_features[j] =3D=3D VIR_TRISTATE_SWITC= H_ABSENT) + continue; + if ((virDomainPSeries) j =3D=3D VIR_DOMAIN_PSERIES_HPT= && + flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE) { + continue; + } + needsPSeriesElement =3D true; + break; + } + + /* Compatibility code. + * Between 3.10.0 and 4.1.0, we had instead + * of , and we need to be able to + * migrate existing guests back and forth between old libv= irt + * and new libvirt; this takes care of it, by using the old + * element when formatting a migratable XML */ + if (def->pseries_features[VIR_DOMAIN_PSERIES_HPT] =3D=3D V= IR_TRISTATE_SWITCH_ON && + flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE) { + virBufferAsprintf(buf, "\n", + virDomainHPTResizingTypeToString(def= ->pseries_hpt_resizing)); + } + + /* Stop here unless we need the element */ + if (!needsPSeriesElement) + break; + virBufferAddLit(buf, "\n"); virBufferAdjustIndent(buf, 2); for (j =3D 0; j < VIR_DOMAIN_PSERIES_LAST; j++) { @@ -26576,6 +26611,8 @@ virDomainDefFormatInternal(virDomainDefPtr def, case VIR_DOMAIN_PSERIES_HPT: if (def->pseries_features[j] !=3D VIR_TRISTATE_SWI= TCH_ON) break; + if (flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE) + break; =20 virBufferAsprintf(buf, "\n", virDomainHPTResizingTypeToString= (def->pseries_hpt_resizing)); @@ -26588,6 +26625,7 @@ virDomainDefFormatInternal(virDomainDefPtr def, virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); break; + } =20 case VIR_DOMAIN_FEATURE_CAPABILITIES: if (def->features[i] =3D=3D VIR_DOMAIN_CAPABILITIES_POLICY= _DEFAULT && @@ -26625,13 +26663,6 @@ virDomainDefFormatInternal(virDomainDefPtr def, } break; =20 - case VIR_DOMAIN_FEATURE_HPT: - if (def->features[i] =3D=3D VIR_TRISTATE_SWITCH_ON) { - virBufferAsprintf(buf, "\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 e4ae2a26c..91db2220a 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1738,7 +1738,6 @@ typedef enum { VIR_DOMAIN_FEATURE_GIC, VIR_DOMAIN_FEATURE_SMM, VIR_DOMAIN_FEATURE_IOAPIC, - VIR_DOMAIN_FEATURE_HPT, VIR_DOMAIN_FEATURE_VMCOREINFO, VIR_DOMAIN_FEATURE_PSERIES, =20 @@ -2360,7 +2359,6 @@ struct _virDomainDef { virGICVersion gic_version; char *hyperv_vendor_id; virDomainIOAPIC ioapic; - virDomainHPTResizing hpt_resizing; virDomainHPTResizing pseries_hpt_resizing; =20 /* These options are of type virTristateSwitch: ON =3D keep, OFF =3D d= rop */ diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index a053b597c..26122b048 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7645,26 +7645,6 @@ qemuBuildMachineCommandLine(virCommandPtr cmd, } } =20 - if (def->features[VIR_DOMAIN_FEATURE_HPT] =3D=3D VIR_TRISTATE_SWIT= CH_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 =3D virDomainHPTResizingTypeToString(def->hpt_resizing); - if (!str) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Invalid setting for HPT resizing")); - goto cleanup; - } - - virBufferAsprintf(&buf, ",resize-hpt=3D%s", str); - } - if (def->features[VIR_DOMAIN_FEATURE_PSERIES] =3D=3D VIR_TRISTATE_= SWITCH_ON) { const char *value; =20 diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index edef3838e..c604f0657 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3132,14 +3132,6 @@ qemuDomainDefVerifyFeatures(const virDomainDef *def) return -1; } =20 - if (def->features[VIR_DOMAIN_FEATURE_HPT] =3D=3D VIR_TRISTATE_SWITCH_O= N && - !qemuDomainIsPSeries(def)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", - _("HPT tuning is only supported for pSeries guests"= )); - return -1; - } - return 0; } =20 diff --git a/tests/qemuxml2xmloutdata/pseries-hpt-resizing.xml b/tests/qemu= xml2xmloutdata/pseries-hpt-resizing.xml index 5dd0dbd0b..b6a89ffe2 100644 --- a/tests/qemuxml2xmloutdata/pseries-hpt-resizing.xml +++ b/tests/qemuxml2xmloutdata/pseries-hpt-resizing.xml @@ -9,7 +9,9 @@ - + + + destroy --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 08:43:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1516722555045766.6411263288636; Tue, 23 Jan 2018 07:49:15 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C9BE555866; Tue, 23 Jan 2018 15:49:13 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9ED131964B; Tue, 23 Jan 2018 15:49:13 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 4726C18033E0; Tue, 23 Jan 2018 15:49:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w0NFk0bg023554 for ; Tue, 23 Jan 2018 10:46:00 -0500 Received: by smtp.corp.redhat.com (Postfix) id 10CCE17B99; Tue, 23 Jan 2018 15:46:00 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.43.2.98]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8C25E6560D for ; Tue, 23 Jan 2018 15:45:55 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 23 Jan 2018 16:45:03 +0100 Message-Id: <20180123154504.9541-5-abologna@redhat.com> In-Reply-To: <20180123154504.9541-1-abologna@redhat.com> References: <20180123154504.9541-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/5] tests: Clean up HPT tests X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 23 Jan 2018 15:49:14 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Give them better names and remove some redundancy. Signed-off-by: Andrea Bolognani --- I would probably just squash this into the previous patch, but I figured others would prefer it as a separate one. ...es-hpt-resizing.args =3D> pseries-features-hpt.args} | 1 - .../pseries-features-hpt.xml} | 0 ...chine.xml =3D> pseries-features-invalid-machine.xml} | 6 ++++-- tests/qemuxml2argvdata/pseries-hpt-resizing.xml | 19 ---------------= ---- tests/qemuxml2argvtest.c | 9 +++------ tests/qemuxml2xmloutdata/pseries-features-hpt.xml | 1 + tests/qemuxml2xmltest.c | 3 +-- 7 files changed, 9 insertions(+), 30 deletions(-) rename tests/qemuxml2argvdata/{pseries-hpt-resizing.args =3D> pseries-feat= ures-hpt.args} (96%) rename tests/{qemuxml2xmloutdata/pseries-hpt-resizing.xml =3D> qemuxml2arg= vdata/pseries-features-hpt.xml} (100%) rename tests/qemuxml2argvdata/{pseries-hpt-resizing-invalid-machine.xml = =3D> pseries-features-invalid-machine.xml} (76%) delete mode 100644 tests/qemuxml2argvdata/pseries-hpt-resizing.xml create mode 120000 tests/qemuxml2xmloutdata/pseries-features-hpt.xml diff --git a/tests/qemuxml2argvdata/pseries-hpt-resizing.args b/tests/qemux= ml2argvdata/pseries-features-hpt.args similarity index 96% rename from tests/qemuxml2argvdata/pseries-hpt-resizing.args rename to tests/qemuxml2argvdata/pseries-features-hpt.args index 994789a5e..8cdb32965 100644 --- a/tests/qemuxml2argvdata/pseries-hpt-resizing.args +++ b/tests/qemuxml2argvdata/pseries-features-hpt.args @@ -12,7 +12,6 @@ QEMU_AUDIO_DRV=3Dnone \ -smp 1,sockets=3D1,cores=3D1,threads=3D1 \ -uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \ -nographic \ --nodefconfig \ -nodefaults \ -chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-guest/monitor.s= ock,\ server,nowait \ diff --git a/tests/qemuxml2xmloutdata/pseries-hpt-resizing.xml b/tests/qemu= xml2argvdata/pseries-features-hpt.xml similarity index 100% rename from tests/qemuxml2xmloutdata/pseries-hpt-resizing.xml rename to tests/qemuxml2argvdata/pseries-features-hpt.xml diff --git a/tests/qemuxml2argvdata/pseries-hpt-resizing-invalid-machine.xm= l b/tests/qemuxml2argvdata/pseries-features-invalid-machine.xml similarity index 76% rename from tests/qemuxml2argvdata/pseries-hpt-resizing-invalid-machine.xml rename to tests/qemuxml2argvdata/pseries-features-invalid-machine.xml index 757fcc70e..bc5501b6c 100644 --- a/tests/qemuxml2argvdata/pseries-hpt-resizing-invalid-machine.xml +++ b/tests/qemuxml2argvdata/pseries-features-invalid-machine.xml @@ -7,8 +7,10 @@ hvm - - + + + + /usr/bin/qemu-system-x86_64 diff --git a/tests/qemuxml2argvdata/pseries-hpt-resizing.xml b/tests/qemuxm= l2argvdata/pseries-hpt-resizing.xml deleted file mode 100644 index f9dc9cac9..000000000 --- a/tests/qemuxml2argvdata/pseries-hpt-resizing.xml +++ /dev/null @@ -1,19 +0,0 @@ - - guest - 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 - 524288 - 1 - - hvm - - - - - - - /usr/bin/qemu-system-ppc64 - - - - diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index c8739909d..cc9280db0 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1891,15 +1891,12 @@ mymain(void) QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE_VFIO_PCI); =20 - DO_TEST("pseries-hpt-resizing", - QEMU_CAPS_NODEFCONFIG, + DO_TEST("pseries-features-hpt", QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT); - DO_TEST_FAILURE("pseries-hpt-resizing", - QEMU_CAPS_NODEFCONFIG, + DO_TEST_FAILURE("pseries-features-hpt", QEMU_CAPS_MACHINE_OPT); - DO_TEST_PARSE_ERROR("pseries-hpt-resizing-invalid-machine", - QEMU_CAPS_NODEFCONFIG, + DO_TEST_PARSE_ERROR("pseries-features-invalid-machine", QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT); =20 diff --git a/tests/qemuxml2xmloutdata/pseries-features-hpt.xml b/tests/qemu= xml2xmloutdata/pseries-features-hpt.xml new file mode 120000 index 000000000..bcaf2e6fe --- /dev/null +++ b/tests/qemuxml2xmloutdata/pseries-features-hpt.xml @@ -0,0 +1 @@ +../qemuxml2argvdata/pseries-features-hpt.xml \ No newline at end of file diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 78519f509..ba4e853f9 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -763,8 +763,7 @@ mymain(void) QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE_VFIO_PCI); =20 - DO_TEST("pseries-hpt-resizing", - QEMU_CAPS_NODEFCONFIG, + DO_TEST("pseries-features-hpt", QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT); =20 --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 08:43:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 151672257106918.202759414100797; Tue, 23 Jan 2018 07:49:31 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A7C5D40255; Tue, 23 Jan 2018 15:49:29 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BE89517517; Tue, 23 Jan 2018 15:49:26 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7053B18033E1; Tue, 23 Jan 2018 15:49:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w0NFk5t3023568 for ; Tue, 23 Jan 2018 10:46:05 -0500 Received: by smtp.corp.redhat.com (Postfix) id 327C017B86; Tue, 23 Jan 2018 15:46:05 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.43.2.98]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AB31B6560B for ; Tue, 23 Jan 2018 15:46:00 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 23 Jan 2018 16:45:04 +0100 Message-Id: <20180123154504.9541-6-abologna@redhat.com> In-Reply-To: <20180123154504.9541-1-abologna@redhat.com> References: <20180123154504.9541-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [RFC PATCH 5/5] conf: Add HTM pSeries feature X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 23 Jan 2018 15:49:30 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Introduce a way to enable and disable the availability of HTM (Hardware Transactional Memory) for pSeries guests. Signed-off-by: Andrea Bolognani --- The availability of the corresponding QEMU toggle is currently crudely inferred from the version number, but there's ongoing discussion on how to introspect it properly through QMP, hence the RFC status of this patch. docs/formatdomain.html.in | 7 ++++ docs/schemas/domaincommon.rng | 5 +++ src/conf/domain_conf.c | 44 +++++++++++++++++++= ++++ src/conf/domain_conf.h | 1 + src/qemu/qemu_capabilities.c | 9 +++++ src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 13 +++++++ tests/qemuxml2argvdata/pseries-features-htm.args | 19 ++++++++++ tests/qemuxml2argvdata/pseries-features-htm.xml | 30 ++++++++++++++++ tests/qemuxml2argvtest.c | 3 ++ tests/qemuxml2xmloutdata/pseries-features-htm.xml | 1 + tests/qemuxml2xmltest.c | 3 ++ 12 files changed, 136 insertions(+) create mode 100644 tests/qemuxml2argvdata/pseries-features-htm.args create mode 100644 tests/qemuxml2argvdata/pseries-features-htm.xml create mode 120000 tests/qemuxml2xmloutdata/pseries-features-htm.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 1e2fccaeb..22b0739ac 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -1770,6 +1770,7 @@ </kvm> <pseries> <hpt resizing=3D'required'/> + <htm state=3D'off'/> </pseries> <pvspinlock state=3D'on'/> <gic version=3D'2'/> @@ -1921,6 +1922,12 @@ resizing: enabled, disabled, required 4.1.0 (QEMU 2.10) + + htm + Configure HTM (Hardware Transactional Memory) + state: on, off + 4.1.0 (QEMU 2.12) +
pmu
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index fead6e7cc..b49318aa3 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -5538,6 +5538,11 @@ + + + + +
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 763228ca7..34ef08e21 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -176,6 +176,7 @@ VIR_ENUM_IMPL(virDomainKVM, VIR_DOMAIN_KVM_LAST, VIR_ENUM_IMPL(virDomainPSeries, VIR_DOMAIN_PSERIES_LAST, "hpt", + "htm", ); =20 VIR_ENUM_IMPL(virDomainCapsFeature, VIR_DOMAIN_CAPS_FEATURE_LAST, @@ -19175,6 +19176,28 @@ virDomainDefParseXML(xmlDocPtr xml, VIR_FREE(tmp); break; =20 + case VIR_DOMAIN_PSERIES_HTM: + if (!(tmp =3D virXMLPropString(nodes[i], "state"))) { + virReportError(VIR_ERR_XML_ERROR, + _("Missing 'state' attribute for " + "'%s' pSeries feature"), + nodes[i]->name); + goto error; + } + + if ((value =3D virTristateSwitchTypeFromString(tmp)) < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Invalid value '%s' for 'state' " + "attribute of '%s' pSeries feature"), + nodes[i]->name, tmp); + goto error; + } + + def->pseries_features[feature] =3D value; + + VIR_FREE(tmp); + break; + case VIR_DOMAIN_PSERIES_LAST: break; } @@ -21225,6 +21248,18 @@ virDomainDefFeaturesCheckABIStability(virDomainDef= Ptr src, } break; =20 + case VIR_DOMAIN_PSERIES_HTM: + if (src->pseries_features[i] !=3D dst->pseries_features[i]= ) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("State of '%s' pSeries feature differ= s: " + "source: '%s', destination: '%s'"), + virDomainPSeriesTypeToString(i), + virTristateSwitchTypeToString(src->pser= ies_features[i]), + virTristateSwitchTypeToString(dst->pser= ies_features[i])); + return false; + } + break; + case VIR_DOMAIN_PSERIES_LAST: break; } @@ -26618,6 +26653,15 @@ virDomainDefFormatInternal(virDomainDefPtr def, virDomainHPTResizingTypeToString= (def->pseries_hpt_resizing)); break; =20 + case VIR_DOMAIN_PSERIES_HTM: + if (def->pseries_features[j] =3D=3D VIR_TRISTATE_S= WITCH_ABSENT) + break; + + virBufferAsprintf(buf, "<%s state=3D'%s'/>\n", + virDomainPSeriesTypeToString(j), + virTristateSwitchTypeToString(de= f->pseries_features[j])); + break; + case VIR_DOMAIN_PSERIES_LAST: break; } diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 91db2220a..3c1a61c8e 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1768,6 +1768,7 @@ typedef enum { =20 typedef enum { VIR_DOMAIN_PSERIES_HPT =3D 0, + VIR_DOMAIN_PSERIES_HTM, =20 VIR_DOMAIN_PSERIES_LAST } virDomainPSeries; diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 5e03447ba..5897b6c66 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -458,6 +458,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, /* 280 */ "pl011", "machine.pseries.max-cpu-compat", + "machine.pseries.cap-htm", ); =20 =20 @@ -4894,6 +4895,14 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps, virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_MAX_CPU_COMPAT); } =20 + /* No way to query cap-htm availability... Yet. See + * http://lists.nongnu.org/archive/html/qemu-devel/2018-01/msg04674.ht= ml + * for an attempt at making this introspectable through QMP */ + if (qemuCaps->version >=3D 2012000 && + ARCH_IS_PPC64(qemuCaps->arch)) { + virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_CAP_HTM); + } + if (virQEMUCapsProbeQMPCommands(qemuCaps, mon) < 0) goto cleanup; =20 diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 3dfc77f87..5401a3118 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -443,6 +443,7 @@ typedef enum { /* 280 */ QEMU_CAPS_DEVICE_PL011, /* -device pl011 (not user-instantiable) */ QEMU_CAPS_MACHINE_PSERIES_MAX_CPU_COMPAT, /* -machine pseries,max-cpu-= compat=3D */ + QEMU_CAPS_MACHINE_PSERIES_CAP_HTM, /* -machine pseries,cap-htm=3D */ =20 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 26122b048..bb8567629 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7366,6 +7366,8 @@ virDomainPSeriesToQEMUCaps(int feature) switch ((virDomainPSeries) feature) { case VIR_DOMAIN_PSERIES_HPT: return QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT; + case VIR_DOMAIN_PSERIES_HTM: + return QEMU_CAPS_MACHINE_PSERIES_CAP_HTM; case VIR_DOMAIN_PSERIES_LAST: break; } @@ -7379,6 +7381,8 @@ virDomainPSeriesToMachineOption(int feature) switch ((virDomainPSeries) feature) { case VIR_DOMAIN_PSERIES_HPT: return "resize-hpt"; + case VIR_DOMAIN_PSERIES_HTM: + return "cap-htm"; case VIR_DOMAIN_PSERIES_LAST: break; } @@ -7659,6 +7663,15 @@ qemuBuildMachineCommandLine(virCommandPtr cmd, goto cleanup; break; =20 + case VIR_DOMAIN_PSERIES_HTM: + if (def->pseries_features[i] =3D=3D VIR_TRISTATE_SWITC= H_ABSENT) + break; + + value =3D virTristateSwitchTypeToString(def->pseries_f= eatures[i]); + if (qemuBuildMachineCommandLinePSeriesFeature(&buf, i,= value, qemuCaps) < 0) + goto cleanup; + break; + case VIR_DOMAIN_PSERIES_LAST: goto cleanup; } diff --git a/tests/qemuxml2argvdata/pseries-features-htm.args b/tests/qemux= ml2argvdata/pseries-features-htm.args new file mode 100644 index 000000000..64fd28ed2 --- /dev/null +++ b/tests/qemuxml2argvdata/pseries-features-htm.args @@ -0,0 +1,19 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-ppc64 \ +-name guest \ +-S \ +-machine pseries,accel=3Dtcg,cap-htm=3Don \ +-m 512 \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \ +-nographic \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-guest/monitor.s= ock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dreadline \ +-boot c diff --git a/tests/qemuxml2argvdata/pseries-features-htm.xml b/tests/qemuxm= l2argvdata/pseries-features-htm.xml new file mode 100644 index 000000000..9e92aa91e --- /dev/null +++ b/tests/qemuxml2argvdata/pseries-features-htm.xml @@ -0,0 +1,30 @@ + + guest + 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 + 524288 + 524288 + 1 + + hvm + + + + + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-ppc64 + + + + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index cc9280db0..03d159e69 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1899,6 +1899,9 @@ mymain(void) DO_TEST_PARSE_ERROR("pseries-features-invalid-machine", QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT); + DO_TEST("pseries-features-htm", + QEMU_CAPS_MACHINE_OPT, + QEMU_CAPS_MACHINE_PSERIES_CAP_HTM); =20 DO_TEST("pseries-serial-native", QEMU_CAPS_NODEFCONFIG, diff --git a/tests/qemuxml2xmloutdata/pseries-features-htm.xml b/tests/qemu= xml2xmloutdata/pseries-features-htm.xml new file mode 120000 index 000000000..42cf0f7d7 --- /dev/null +++ b/tests/qemuxml2xmloutdata/pseries-features-htm.xml @@ -0,0 +1 @@ +../qemuxml2argvdata/pseries-features-htm.xml \ No newline at end of file diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index ba4e853f9..e97f17740 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -766,6 +766,9 @@ mymain(void) DO_TEST("pseries-features-hpt", QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT); + DO_TEST("pseries-features-htm", + QEMU_CAPS_MACHINE_OPT, + QEMU_CAPS_MACHINE_PSERIES_CAP_HTM); =20 DO_TEST("pseries-serial-native", QEMU_CAPS_NODEFCONFIG, --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list