From nobody Fri May 17 08:25:01 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1704369336457954.4981916850669; Thu, 4 Jan 2024 03:55:36 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 5B43B176B; Thu, 4 Jan 2024 06:55:35 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 78FA71815; Thu, 4 Jan 2024 06:52:43 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 440FA176B; Thu, 4 Jan 2024 06:52:33 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 24FB61768 for ; Thu, 4 Jan 2024 06:52:32 -0500 (EST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-75-G7Flt3gKPgGNTuU3nwVS7g-1; Thu, 04 Jan 2024 06:52:30 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EE578185A780 for ; Thu, 4 Jan 2024 11:52:29 +0000 (UTC) Received: from localhost.localdomain (unknown [10.45.226.119]) by smtp.corp.redhat.com (Postfix) with ESMTP id 994632166B31 for ; Thu, 4 Jan 2024 11:52:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: G7Flt3gKPgGNTuU3nwVS7g-1 From: Michal Privoznik To: devel@lists.libvirt.org Subject: [PATCH 1/4] conf: Introduce dynamicMemslots attribute for virtio-mem Date: Thu, 4 Jan 2024 12:52:23 +0100 Message-ID: <38e5697fedf49079a99320bcd8fb2e5d18262ec6.1704369029.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: GJFOCLWIJS64UQSDYSOCJDCWUPSOTECQ X-Message-ID-Hash: GJFOCLWIJS64UQSDYSOCJDCWUPSOTECQ X-MailFrom: mprivozn@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8"; x-default="true" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1704369338272100001 Introduced in v8.2.0-rc0~74^2~2, QEMU now allows setting .dynamic-memslots attribute for virtio-mem-pci devices. When turned on, it allows memory exposed to guest to be split into multiple memslots and thus smaller memory footprint (see the original commit for detailed explanation). Therefore, introduce new attribute which will control that QEMU knob. Signed-off-by: Michal Privoznik --- docs/formatdomain.rst | 6 ++++++ src/conf/domain_conf.c | 18 +++++++++++++++++- src/conf/domain_conf.h | 1 + src/conf/schemas/domaincommon.rng | 5 +++++ .../memory-hotplug-virtio-mem.xml | 2 +- 5 files changed, 30 insertions(+), 2 deletions(-) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index 96e03a3807..57974de9f4 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -8395,6 +8395,12 @@ Example: usage of the memory devices The ``node`` subelement configures the guest NUMA node to attach the me= mory to. The element shall be used only if the guest has NUMA nodes configur= ed. =20 + For ``virtio-mem`` optional attribute ``dynamicMemslots`` can be specif= ied + (accepted values "yes"/"no") which allows hypervisor to spread memory i= nto + multiple memory slots (allocate them dynamically based on the amount of + memory exposed to the guest), resulting in smaller memory footprint. + :since:`Since 10.0.0 and QEMU 8.2.0` + The following optional elements may be used: =20 ``label`` diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 82672b30a0..c53e72210c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -13499,6 +13499,10 @@ virDomainMemoryTargetDefParseXML(xmlNodePtr node, &def->target.virtio_mem.requestedsize, fa= lse, false) < 0) return -1; =20 + if (virXMLPropTristateBool(node, "dynamicMemslots", VIR_XML_PROP_N= ONE, + &def->target.virtio_mem.dynamicMemslots= ) < 0) + return -1; + addrNode =3D virXPathNode("./address", ctxt); addr =3D &def->target.virtio_mem.address; break; @@ -21174,6 +21178,12 @@ virDomainMemoryDefCheckABIStability(virDomainMemor= yDef *src, src->target.virtio_mem.address); return false; } + + if (src->target.virtio_mem.dynamicMemslots !=3D dst->target.virtio= _mem.dynamicMemslots) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Target memory device 'dynamicMemslots' prope= rty doesn't match source memory device")); + return false; + } break; =20 case VIR_DOMAIN_MEMORY_MODEL_DIMM: @@ -25375,6 +25385,7 @@ virDomainMemoryTargetDefFormat(virBuffer *buf, unsigned int flags) { g_auto(virBuffer) childBuf =3D VIR_BUFFER_INIT_CHILD(buf); + g_auto(virBuffer) attrBuf =3D VIR_BUFFER_INITIALIZER; =20 virBufferAsprintf(&childBuf, "%llu\n", def->= size); if (def->targetNode >=3D 0) @@ -25414,6 +25425,11 @@ virDomainMemoryTargetDefFormat(virBuffer *buf, if (def->target.virtio_mem.address) virBufferAsprintf(&childBuf, "
\n", def->target.virtio_mem.address); + + if (def->target.virtio_mem.dynamicMemslots) { + virBufferAsprintf(&attrBuf, " dynamicMemslots=3D'%s'", + virTristateBoolTypeToString(def->target.virt= io_mem.dynamicMemslots)); + } break; =20 case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC: @@ -25423,7 +25439,7 @@ virDomainMemoryTargetDefFormat(virBuffer *buf, break; } =20 - virXMLFormatElement(buf, "target", NULL, &childBuf); + virXMLFormatElement(buf, "target", &attrBuf, &childBuf); } =20 static int diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 14901b37ba..6e45b7fb6e 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2674,6 +2674,7 @@ struct _virDomainMemoryDef { unsigned long long currentsize; /* kibibytes, valid for an act= ive domain only and parsed */ unsigned long long address; /* address where memory is mapped = */ + virTristateBool dynamicMemslots; } virtio_mem; struct { } sgx_epc; diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincom= mon.rng index f318c06797..08c408e138 100644 --- a/src/conf/schemas/domaincommon.rng +++ b/src/conf/schemas/domaincommon.rng @@ -7260,6 +7260,11 @@ =20 + + + + + diff --git a/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.xml b/tests/q= emuxml2argvdata/memory-hotplug-virtio-mem.xml index c578209d8a..359ece7a77 100644 --- a/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.xml +++ b/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.xml @@ -60,7 +60,7 @@ 1-3 2048 - + 2097152 0 2048 --=20 2.41.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Fri May 17 08:25:01 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1704369423385807.300216796071; Thu, 4 Jan 2024 03:57:03 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 4B34E1790; Thu, 4 Jan 2024 06:57:02 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 768F41872; Thu, 4 Jan 2024 06:52:53 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 6A531176B; Thu, 4 Jan 2024 06:52:33 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id AC828176C for ; Thu, 4 Jan 2024 06:52:32 -0500 (EST) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-248-jQPGK4rZPn6FP-bk-REA8Q-1; Thu, 04 Jan 2024 06:52:30 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 847FC1C05154 for ; Thu, 4 Jan 2024 11:52:30 +0000 (UTC) Received: from localhost.localdomain (unknown [10.45.226.119]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2EAF82166B31 for ; Thu, 4 Jan 2024 11:52:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: jQPGK4rZPn6FP-bk-REA8Q-1 From: Michal Privoznik To: devel@lists.libvirt.org Subject: [PATCH 2/4] qemu_capabilities: Add QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI_DYNAMIC_MEMSLOTS capability Date: Thu, 4 Jan 2024 12:52:24 +0100 Message-ID: <1d6e1e0b52511e66fc090a999ca4aaa731fe6a3f.1704369029.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: MMFXMRJBTIRNBJXVVAMAIE2TCYHQ7I3W X-Message-ID-Hash: MMFXMRJBTIRNBJXVVAMAIE2TCYHQ7I3W X-MailFrom: mprivozn@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8"; x-default="true" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1704369423983100001 Starting from v8.2.0-rc0~74^2~2 QEMU has .dynamic-memslots attribute for virtio-mem-pci device. Introduce a capability which reflects that. Signed-off-by: Michal Privoznik --- src/qemu/qemu_capabilities.c | 2 ++ src/qemu/qemu_capabilities.h | 1 + tests/qemucapabilitiesdata/caps_8.2.0_x86_64.xml | 1 + 3 files changed, 4 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 83119e871a..37b989b251 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -698,6 +698,7 @@ VIR_ENUM_IMPL(virQEMUCaps, /* 450 */ "run-with.async-teardown", /* QEMU_CAPS_RUN_WITH_ASYNC_TEARD= OWN */ "virtio-blk-vhost-vdpa", /* QEMU_CAPS_DEVICE_VIRTIO_BLK_VHOS= T_VDPA */ + "virtio-mem-pci.dynamic-memslots", /* QEMU_CAPS_DEVICE_VIRTI= O_MEM_PCI_DYNAMIC_MEMSLOTS */ ); =20 =20 @@ -1516,6 +1517,7 @@ static struct virQEMUCapsDevicePropsFlags virQEMUCaps= DevicePropsVhostUserFS[] =3D =20 static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsVirtioMemP= CI[] =3D { { "prealloc", QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI_PREALLOC, NULL }, + { "dynamic-memslots", QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI_DYNAMIC_MEMSLOTS= , NULL }, }; =20 static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsVirtioIOMM= U[] =3D { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 3c4f7f625b..97022eab91 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -677,6 +677,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for = syntax-check */ /* 450 */ QEMU_CAPS_RUN_WITH_ASYNC_TEARDOWN, /* asynchronous teardown -run-with = async-teardown=3Don|off */ QEMU_CAPS_DEVICE_VIRTIO_BLK_VHOST_VDPA, /* virtio-blk-vhost-vdpa block= driver */ + QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI_DYNAMIC_MEMSLOTS, /* -device virtio-me= m-pci.dynamic-memslots=3D */ =20 QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/tests/qemucapabilitiesdata/caps_8.2.0_x86_64.xml b/tests/qemuc= apabilitiesdata/caps_8.2.0_x86_64.xml index ee52952702..f976a8d2df 100644 --- a/tests/qemucapabilitiesdata/caps_8.2.0_x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_8.2.0_x86_64.xml @@ -199,6 +199,7 @@ + 8002000 43100246 v8.2.0 --=20 2.41.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Fri May 17 08:25:01 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 17043695241962.0567096912543548; Thu, 4 Jan 2024 03:58:44 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 303AC17CD; Thu, 4 Jan 2024 06:58:43 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 70D73181A; Thu, 4 Jan 2024 06:53:02 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id D7FD5175D; Thu, 4 Jan 2024 06:52:33 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 515121763 for ; Thu, 4 Jan 2024 06:52:33 -0500 (EST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-83-hHWfsTZENxGKjmcJ5Q_lcg-1; Thu, 04 Jan 2024 06:52:31 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1A29E85A58A for ; Thu, 4 Jan 2024 11:52:31 +0000 (UTC) Received: from localhost.localdomain (unknown [10.45.226.119]) by smtp.corp.redhat.com (Postfix) with ESMTP id B83AE2166B31 for ; Thu, 4 Jan 2024 11:52:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: hHWfsTZENxGKjmcJ5Q_lcg-1 From: Michal Privoznik To: devel@lists.libvirt.org Subject: [PATCH 3/4] qemu_validate: Check capability for virtio-mem dynamicMemslots Date: Thu, 4 Jan 2024 12:52:25 +0100 Message-ID: <629b7ab207dc063023966c03ac99217c85f800ff.1704369029.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: 2D3WGBRSCGI2RZVSBCYGFLGDOWX7QUZA X-Message-ID-Hash: 2D3WGBRSCGI2RZVSBCYGFLGDOWX7QUZA X-MailFrom: mprivozn@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8"; x-default="true" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1704369526578100001 The QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI_DYNAMIC_MEMSLOTS reflects whether QEMU is capable of .dynamic-memslots for virtio-mem. Use it when validating domain configuration. Signed-off-by: Michal Privoznik --- src/qemu/qemu_validate.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 9e50c2f45b..3b0dfec2b4 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -4971,6 +4971,13 @@ qemuValidateDomainDeviceDefMemory(virDomainMemoryDef= *mem, _("virtio-mem isn't supported by this QEMU bina= ry")); return -1; } + + if (mem->target.virtio_mem.dynamicMemslots =3D=3D VIR_TRISTATE_BOO= L_YES && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI_DYNA= MIC_MEMSLOTS)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("virtio-mem does not support dynamicMemslots"= )); + return -1; + } break; =20 case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC: --=20 2.41.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Fri May 17 08:25:01 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1704369602139196.70936144320024; Thu, 4 Jan 2024 04:00:02 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 107881782; Thu, 4 Jan 2024 07:00:01 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 667E71813; Thu, 4 Jan 2024 06:53:14 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 0B31517D8; Thu, 4 Jan 2024 06:53:01 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 4350717CA for ; Thu, 4 Jan 2024 06:52:39 -0500 (EST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-5-K8ykySBoPe6Ubb83dO3-RA-1; Thu, 04 Jan 2024 06:52:31 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A3DF28350E3 for ; Thu, 4 Jan 2024 11:52:31 +0000 (UTC) Received: from localhost.localdomain (unknown [10.45.226.119]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4E4DA2166B31 for ; Thu, 4 Jan 2024 11:52:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: K8ykySBoPe6Ubb83dO3-RA-1 From: Michal Privoznik To: devel@lists.libvirt.org Subject: [PATCH 4/4] qemu_command: Generate cmd line for virtio-mem dynamicMemslots Date: Thu, 4 Jan 2024 12:52:26 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: TZOTPWGMKLBFDMPHNL5MSPCGZIM5SWI6 X-Message-ID-Hash: TZOTPWGMKLBFDMPHNL5MSPCGZIM5SWI6 X-MailFrom: mprivozn@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8"; x-default="true" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1704369602754100001 This is straightforward, pretty much. The only odd thing is: .dynamic-memslots=3Dtrue requires .unplugged-inaccessible=3D"on". While the latter is currently the default, it's not guaranteed to stay that way. Play it safe and explicitly set both. Resolves: https://issues.redhat.com/browse/RHEL-15316 Signed-off-by: Michal Privoznik --- src/qemu/qemu_command.c | 12 ++++++++++++ .../memory-hotplug-virtio-mem.x86_64-latest.args | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index bc285c0b6f..5c79fa0836 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3608,6 +3608,8 @@ qemuBuildMemoryDeviceProps(virQEMUDriverConfig *cfg, unsigned long long requestedsize =3D 0; unsigned long long address =3D 0; bool prealloc =3D false; + bool dynamicMemslots =3D false; + const char *unpluggedInacessible =3D NULL; =20 if (!mem->info.alias) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -3649,6 +3651,14 @@ qemuBuildMemoryDeviceProps(virQEMUDriverConfig *cfg, blocksize =3D mem->target.virtio_mem.blocksize; requestedsize =3D mem->target.virtio_mem.requestedsize; address =3D mem->target.virtio_mem.address; + dynamicMemslots =3D mem->target.virtio_mem.dynamicMemslots; + if (dynamicMemslots) { + /* Currently, .dynamic-memslots=3Dtrue requires + * .unplugged-inaccessible=3D"on" (see QEMU commit + * v8.2.0-rc0~74^2~2). And while the latter is the default + * (currently), let's not rely on that. */ + unpluggedInacessible =3D "on"; + } break; =20 case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC: @@ -3671,6 +3681,8 @@ qemuBuildMemoryDeviceProps(virQEMUDriverConfig *cfg, "s:memdev", memdev, "B:prealloc", prealloc, "P:memaddr", address, + "B:dynamic-memslots", dynamicMemslots, + "S:unplugged-inaccessible", unpluggedInacess= ible, "s:id", mem->info.alias, NULL) < 0) return NULL; diff --git a/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.x86_64-latest= .args b/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.x86_64-latest.args index 607ce9b0e8..ae23504c32 100644 --- a/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.x86_64-latest.args +++ b/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.x86_64-latest.args @@ -32,7 +32,7 @@ XDG_CONFIG_HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGue= st1/.config \ -object '{"qom-type":"memory-backend-ram","id":"memvirtiomem0","reserve":f= alse,"size":1073741824}' \ -device '{"driver":"virtio-mem-pci","node":0,"block-size":2097152,"request= ed-size":536870912,"memdev":"memvirtiomem0","id":"virtiomem0","bus":"pci.0"= ,"addr":"0x2"}' \ -object '{"qom-type":"memory-backend-file","id":"memvirtiomem1","mem-path"= :"/dev/hugepages2M/libvirt/qemu/-1-QEMUGuest1","reserve":false,"size":21474= 83648,"host-nodes":[1,2,3],"policy":"bind"}' \ --device '{"driver":"virtio-mem-pci","node":0,"block-size":2097152,"request= ed-size":1073741824,"memdev":"memvirtiomem1","prealloc":true,"memaddr":5637= 144576,"id":"virtiomem1","bus":"pci.1","addr":"0x1"}' \ +-device '{"driver":"virtio-mem-pci","node":0,"block-size":2097152,"request= ed-size":1073741824,"memdev":"memvirtiomem1","prealloc":true,"memaddr":5637= 144576,"dynamic-memslots":true,"unplugged-inaccessible":"on","id":"virtiome= m1","bus":"pci.1","addr":"0x1"}' \ -blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","no= de-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw= ","file":"libvirt-1-storage"}' \ -device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-form= at","id":"ide0-0-0","bootindex":1}' \ --=20 2.41.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org