From nobody Wed May 15 01:46:36 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1647961536; cv=none; d=zohomail.com; s=zohoarc; b=ZIWyuiueGJ+vrC4Wo4UTlQWijnx4K/nNXj4cwvdMXpxnaL7YSTXkT33C4lmHNknDPn0eS7oD1QGuIOGk1pzeejPMiIZa84I8yQMGmLgVbsAm20QcYX+Ktd98VBPaM0Yg8MCCGYpK0DeO4swP8NrysPeYTmxHz3pjHODaM6tBseE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1647961536; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=S+HPRU8L+gkuGSYeoIdSFZP0Ff8OxYrGI11AFKRWF2o=; b=Gv9Blau58SSGBPR2cSlaM5HbJ7EQ8irOTtuSvT7e0NU8gkvqwx8DHAKPqQknGIvjYSVGGAC7PHEDh5dOl0PUxTvKmbeIQm6oJd0B3jk8H+3tsUhAg79bZiKWPtwWpkXP40x8eO1mWTWl53t0gRPm0L5abCGCM1mvPbVGVQ3BFmE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1647961536395516.9314295955725; Tue, 22 Mar 2022 08:05:36 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-451-2vzSHCc8Ma6SYisijmyu9w-1; Tue, 22 Mar 2022 11:05:35 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D969B1066694; Tue, 22 Mar 2022 15:05:24 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7D9102026D60; Tue, 22 Mar 2022 15:05:21 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 405251949762; Tue, 22 Mar 2022 15:05:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 657211947BBC for ; Tue, 22 Mar 2022 15:05:20 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 58D43401052; Tue, 22 Mar 2022 15:05:20 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0082740146E for ; Tue, 22 Mar 2022 15:05:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647961537; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=S+HPRU8L+gkuGSYeoIdSFZP0Ff8OxYrGI11AFKRWF2o=; b=SWlrTpmmkKfUz6QCIu6IDeQlbpdbRlS0HD6ulXfFwnDFeb2BdKqtnGI+KVOLCUmRwctaii aSwOAhdQIKPC0fbg5RELE/F2wmHb26gAnKL5a8X8SrmhIgjChNAAe4hDkHVw6hTBBzA9Ej +9gT1oa/l/5nJHtxhnQdNr/4rMv7klY= X-MC-Unique: 2vzSHCc8Ma6SYisijmyu9w-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/4] conf: Introduce memory allocation threads Date: Tue, 22 Mar 2022 16:05:14 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: fail (Signature date is -1 seconds in the future.) X-ZM-MESSAGEID: 1647961548801100001 Content-Type: text/plain; charset="utf-8" Since its commit v5.0.0-rc0~75^2~1^2~3 QEMU is capable of specifying number of threads used to allocate memory. While it defaults to the number of vCPUs, users might want to use a different value (especially for humongous guests with gigantic pages). In general, on QEMU cmd line level it is possible to use different number of threads per each memory-backend-* object, in practical terms it's not useful. Therefore, use to set guest wide value and let all memory devices 'inherit' it, silently. IOW, don't introduce per device knob because that would only complicate things for a little or no benefit. Signed-off-by: Michal Privoznik --- docs/formatdomain.rst | 6 ++++-- docs/schemas/domaincommon.rng | 19 +++++++++++++------ src/conf/domain_conf.c | 15 ++++++++++++++- src/conf/domain_conf.h | 1 + tests/qemuxml2argvdata/memfd-memory-numa.xml | 2 +- 5 files changed, 33 insertions(+), 10 deletions(-) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index 9b1b69bb4d..8e25474db0 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -1004,7 +1004,7 @@ Memory Backing - + ... @@ -1054,7 +1054,9 @@ influence how virtual memory pages are backed by host= pages. "private". This can be overridden per numa node by ``memAccess``. ``allocation`` Using the ``mode`` attribute, specify when to allocate the memory by - supplying either "immediate" or "ondemand". + supplying either "immediate" or "ondemand". :since:`Since 8.2.0` this + attribute is optional among with ``threads`` attribute, that sets the n= umber + of threads that hypervisor uses to allocate memory. ``discard`` When set and supported by hypervisor the memory content is discarded ju= st before guest shuts down (or when DIMM module is unplugged). Please note= that diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 9c1b64a644..34bccee2f5 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -740,12 +740,19 @@ - - - immediate - ondemand - - + + + + immediate + ondemand + + + + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index e0dfc9e45f..2414a806d0 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -18914,6 +18914,13 @@ virDomainDefParseMemory(virDomainDef *def, VIR_FREE(tmp); } =20 + if (virXPathUInt("string(./memoryBacking/allocation/@threads)", + ctxt, &def->mem.allocation_threads) =3D=3D -2) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("Failed to parse memory allocation threads")); + return -1; + } + if (virXPathNode("./memoryBacking/hugepages", ctxt)) { /* hugepages will be used */ if ((n =3D virXPathNodeSet("./memoryBacking/hugepages/page", ctxt,= &nodes)) < 0) { @@ -27464,6 +27471,7 @@ virDomainMemorybackingFormat(virBuffer *buf, const virDomainMemtune *mem) { g_auto(virBuffer) childBuf =3D VIR_BUFFER_INIT_CHILD(buf); + g_auto(virBuffer) allocAttrBuf =3D VIR_BUFFER_INITIALIZER; =20 if (mem->nhugepages) virDomainHugepagesFormat(&childBuf, mem->hugepages, mem->nhugepage= s); @@ -27478,8 +27486,13 @@ virDomainMemorybackingFormat(virBuffer *buf, virBufferAsprintf(&childBuf, "\n", virDomainMemoryAccessTypeToString(mem->access)); if (mem->allocation) - virBufferAsprintf(&childBuf, "\n", + virBufferAsprintf(&allocAttrBuf, " mode=3D'%s'", virDomainMemoryAllocationTypeToString(mem->alloc= ation)); + if (mem->allocation_threads) + virBufferAsprintf(&allocAttrBuf, " threads=3D'%u'", mem->allocatio= n_threads); + + virXMLFormatElement(&childBuf, "allocation", &allocAttrBuf, NULL); + if (mem->discard) virBufferAddLit(&childBuf, "\n"); =20 diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index a4de46773c..48df6cc389 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2701,6 +2701,7 @@ struct _virDomainMemtune { int source; /* enum virDomainMemorySource */ int access; /* enum virDomainMemoryAccess */ int allocation; /* enum virDomainMemoryAllocation */ + unsigned int allocation_threads; =20 virTristateBool discard; }; diff --git a/tests/qemuxml2argvdata/memfd-memory-numa.xml b/tests/qemuxml2a= rgvdata/memfd-memory-numa.xml index 1ebcee8939..1ac87e3aef 100644 --- a/tests/qemuxml2argvdata/memfd-memory-numa.xml +++ b/tests/qemuxml2argvdata/memfd-memory-numa.xml @@ -10,7 +10,7 @@ - + 8 --=20 2.34.1 From nobody Wed May 15 01:46:36 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1647961539; cv=none; d=zohomail.com; s=zohoarc; b=SZhvTAlWOhWUhifLbmtagtSGx2dYdL6ZyvOcFu1VKK4QPRkJCV4G+uDQExlN7VUvJey1ss5xqDGlH+0tgCXK94UAEJDjUjoEzRlaLIqGWvUlZxUk5YsEsF03EBmeHgX4eq5vWrEh9gPCt/882gskYZ8+zAIo0GwZnhe3hT7LAi8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1647961539; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5nWO1BQcVhuX4Hioi7/g/ldHOnxk69alk+wQ5Sjbdks=; b=FstxudEQcyI0aA92fqjykpnf7atTuMfH3MNDG6GmRFI2AbLuto++X5CR7eS+LHduZZOlZbvI0z7l2u74phrUMpFYv/qEb3xSoXwcRov8VRoUKwuaoAoeqemHNp4t93230hepF3JJgw1ODvfSbzOfw1JHc66WyqEqRgPYtVlgiso= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 164796153925152.13775027513043; Tue, 22 Mar 2022 08:05:39 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-649-9kTY_DU2P-qQJZvBSmiJBQ-1; Tue, 22 Mar 2022 11:05:36 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 40679866DFF; Tue, 22 Mar 2022 15:05:26 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2471940CF905; Tue, 22 Mar 2022 15:05:26 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D6D6F193F6DD; Tue, 22 Mar 2022 15:05:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 2665B1947BBC for ; Tue, 22 Mar 2022 15:05:21 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 12F0A40146E; Tue, 22 Mar 2022 15:05:21 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id 92F61401052 for ; Tue, 22 Mar 2022 15:05:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647961539; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=5nWO1BQcVhuX4Hioi7/g/ldHOnxk69alk+wQ5Sjbdks=; b=fzdMKLjWc4zXery2Tl/V1nvZeb9Xy4rMSKoW1ZLB509/eL0mDQKVWbvrxlB9WLsoavMT/i P21cHRWbqrUzaUt+1F1z26ZiXs9Rftl89UBD052KnTQLDv9CmsFo8L4TfK1Jp92BlqKCur +8KXZdOXrsmACJgG3AU6YO7BBiSkCUQ= X-MC-Unique: 9kTY_DU2P-qQJZvBSmiJBQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/4] qemu_capabilities: Detect memory-backend-*.prealloc-threads property Date: Tue, 22 Mar 2022 16:05:15 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1647961550050100003 Content-Type: text/plain; charset="utf-8" The prealloc-threads is property of memory-backend class which is parent to the other three classes memory-backend-{ram,file,memfd}. Therefore the property is present for all, or none if QEMU is older than v5.0.0-rc0~75^2~1^2~3 which introduced the property. Anyway, the .reserve property is the same story, and we chose memory-backend-file to detect it, so stick with our earlier decision and use the same backend to detect this new property. Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- src/qemu/qemu_capabilities.c | 2 ++ src/qemu/qemu_capabilities.h | 1 + tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml | 1 + tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_5.1.0.sparc.xml | 1 + tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml | 1 + tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml | 1 + tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml | 1 + tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml | 1 + 22 files changed, 23 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 32980e7330..6b4ed08499 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -668,6 +668,7 @@ VIR_ENUM_IMPL(virQEMUCaps, =20 /* 425 */ "blockdev.nbd.tls-hostname", /* QEMU_CAPS_BLOCKDEV_NBD_TLS_H= OSTNAME */ + "memory-backend-file.prealloc-threads", /* QEMU_CAPS_MEMORY_= BACKEND_PREALLOC_THREADS */ ); =20 =20 @@ -1766,6 +1767,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsObjec= tPropsMemoryBackendFile[] =3D * released qemu versions. */ { "x-use-canonical-path-for-ramblock-id", QEMU_CAPS_X_USE_CANONICAL_PA= TH_FOR_RAMBLOCK_ID }, { "reserve", QEMU_CAPS_MEMORY_BACKEND_RESERVE }, + { "prealloc-threads", QEMU_CAPS_MEMORY_BACKEND_PREALLOC_THREADS }, }; =20 static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsMemoryBackendMe= mfd[] =3D { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 0a215a11d5..948029d60d 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -643,6 +643,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for = syntax-check */ =20 /* 425 */ QEMU_CAPS_BLOCKDEV_NBD_TLS_HOSTNAME, /* tls hostname can be overriden = for NBD clients */ + QEMU_CAPS_MEMORY_BACKEND_PREALLOC_THREADS, /* -object memory-backend-*= .prealloc-threads */ =20 QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml b/tests/qemu= capabilitiesdata/caps_5.0.0.aarch64.xml index 4c1a37104c..d188eab3fe 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml @@ -178,6 +178,7 @@ + 5000000 0 61700241 diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml b/tests/qemuca= pabilitiesdata/caps_5.0.0.ppc64.xml index 070d0f2982..12592f457a 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml @@ -186,6 +186,7 @@ + 5000000 0 42900241 diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml b/tests/qemu= capabilitiesdata/caps_5.0.0.riscv64.xml index 286049a8a6..75c3a9b4fc 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml @@ -170,6 +170,7 @@ + 5000000 0 0 diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_5.0.0.x86_64.xml index f563d672b4..5927c48ee4 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml @@ -219,6 +219,7 @@ + 5000000 0 43100241 diff --git a/tests/qemucapabilitiesdata/caps_5.1.0.sparc.xml b/tests/qemuca= pabilitiesdata/caps_5.1.0.sparc.xml index 58af90b29f..7de7c291f5 100644 --- a/tests/qemucapabilitiesdata/caps_5.1.0.sparc.xml +++ b/tests/qemucapabilitiesdata/caps_5.1.0.sparc.xml @@ -90,6 +90,7 @@ + 5001000 0 0 diff --git a/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_5.1.0.x86_64.xml index 2d0ef18147..e0291268b3 100644 --- a/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml @@ -222,6 +222,7 @@ + 5001000 0 43100242 diff --git a/tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml b/tests/qemu= capabilitiesdata/caps_5.2.0.aarch64.xml index 9f14d59efb..20a1a8154b 100644 --- a/tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml @@ -184,6 +184,7 @@ + 5002000 0 61700243 diff --git a/tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml b/tests/qemuca= pabilitiesdata/caps_5.2.0.ppc64.xml index e050514fc1..add2ded00a 100644 --- a/tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml @@ -190,6 +190,7 @@ + 5002000 0 42900243 diff --git a/tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml b/tests/qemu= capabilitiesdata/caps_5.2.0.riscv64.xml index 4b123d4ce9..237d043e5d 100644 --- a/tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml +++ b/tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml @@ -174,6 +174,7 @@ + 5002000 0 0 diff --git a/tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml b/tests/qemuca= pabilitiesdata/caps_5.2.0.s390x.xml index bc3c3c351a..57e40f8f86 100644 --- a/tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml @@ -141,6 +141,7 @@ + 5002000 0 39100243 diff --git a/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_5.2.0.x86_64.xml index 70ad14f548..7c65648c06 100644 --- a/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml @@ -226,6 +226,7 @@ + 5002000 0 43100243 diff --git a/tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml b/tests/qemu= capabilitiesdata/caps_6.0.0.aarch64.xml index 9d501f29af..7557e6ad71 100644 --- a/tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml @@ -192,6 +192,7 @@ + 6000000 0 61700242 diff --git a/tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml b/tests/qemuca= pabilitiesdata/caps_6.0.0.s390x.xml index 02b24f5d7e..00009be3dc 100644 --- a/tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml @@ -149,6 +149,7 @@ + 6000000 0 39100242 diff --git a/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_6.0.0.x86_64.xml index 8ea688f7a6..61d561dc69 100644 --- a/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml @@ -235,6 +235,7 @@ + 6000000 0 43100242 diff --git a/tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_6.1.0.x86_64.xml index ba1aecc37e..0b58210335 100644 --- a/tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml @@ -239,6 +239,7 @@ + 6001000 0 43100243 diff --git a/tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml b/tests/qemu= capabilitiesdata/caps_6.2.0.aarch64.xml index 17d563eb5b..d08b2c0213 100644 --- a/tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml @@ -203,6 +203,7 @@ + 6001050 0 61700244 diff --git a/tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml b/tests/qemuca= pabilitiesdata/caps_6.2.0.ppc64.xml index 9fe9c27d14..8c52964ec0 100644 --- a/tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml @@ -201,6 +201,7 @@ + 6002000 0 42900244 diff --git a/tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_6.2.0.x86_64.xml index d77907af55..cdf72b9ebf 100644 --- a/tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml @@ -241,6 +241,7 @@ + 6002000 0 43100244 diff --git a/tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml b/tests/qemuca= pabilitiesdata/caps_7.0.0.ppc64.xml index 5d7f283a73..8aba3329ad 100644 --- a/tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml @@ -202,6 +202,7 @@ + 6002050 0 42900243 diff --git a/tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_7.0.0.x86_64.xml index 0f34a341af..5227e3ee0b 100644 --- a/tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml @@ -244,6 +244,7 @@ + 6002050 0 43100243 --=20 2.34.1 From nobody Wed May 15 01:46:36 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1647961538; cv=none; d=zohomail.com; s=zohoarc; b=dSqhPaO76uI6w+pLvAI5CN51dwjmuvpZFM0BWSpC5VrtprrWQI6bENp1m49ahyGYaPyrQQp2cnM9pCmf2pDPD4mmJYsjDmBBJ6XcKHvlej22IAjNCX9xWycCbWHfMPSbRFxO1iB+7TMRkc/0zMJsu/bcHbE3JgtXCE53aMhP/no= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1647961538; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0OJMcYLwvI43p5o5u5ZTbshsXwzwqWw4vIItVFqn288=; b=FrJAUaNXre5QetH1u20IsYoRV1tZHHFVi+kh2p2d4wqdB+Gy9hgnFUf96GScllEj3otZPx2u5/tjg8rGba4q83zHUJHETcwcP7wZepSt3u/YFCZ445aPaDcIvEF+JJdOL2Hi0HhOQsXz2aVe6sDVsFPEQGDUgYbVrXM9WYS0X6c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1647961538780467.6590287911972; Tue, 22 Mar 2022 08:05:38 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-110-S-nhtkTRPV2_HDyT8_65Bw-1; Tue, 22 Mar 2022 11:05:35 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3FA7983397D; Tue, 22 Mar 2022 15:05:27 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2B43756F7C3; Tue, 22 Mar 2022 15:05:27 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 403021949762; Tue, 22 Mar 2022 15:05:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id B601B1940360 for ; Tue, 22 Mar 2022 15:05:21 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id A41D2401E80; Tue, 22 Mar 2022 15:05:21 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4C5A8401052 for ; Tue, 22 Mar 2022 15:05:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647961537; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=0OJMcYLwvI43p5o5u5ZTbshsXwzwqWw4vIItVFqn288=; b=M2jloDldJliPeDv56PYrZJPRm1js2bvvNKTzZCPNBRBHQAr8//dXOx/SojndUt5cvaGuAM ja9cQtn+6UXzdFYuG/GvjRzJNmghRTwSgHyYAh8/0rn9SN5a39QTOo9BFMmU+S9vOsoiGt 92ws1yAy7CVHV//UA+69nMd7+5Hq0/o= X-MC-Unique: S-nhtkTRPV2_HDyT8_65Bw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 3/4] qemu_validate: Validate prealloc threads against qemuCpas Date: Tue, 22 Mar 2022 16:05:16 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1647961539069100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Only fairly new QEMUs are capable of user provided number of preallocation threads. Validate this assumption. 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 f27e480696..e0708b8a76 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -739,6 +739,13 @@ qemuValidateDomainDefMemory(const virDomainDef *def, return -1; } =20 + if (mem->allocation_threads > 0 && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_MEMORY_BACKEND_PREALLOC_THREAD= S)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("preallocation threads are unsupported with this = QEMU")); + return -1; + } + if (mem->source =3D=3D VIR_DOMAIN_MEMORY_SOURCE_ANONYMOUS) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("hugepages are not allowed with anonymous " --=20 2.34.1 From nobody Wed May 15 01:46:36 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1647961563; cv=none; d=zohomail.com; s=zohoarc; b=Zfpc/tUIgG+1arS8wPzEXhX4bRYzuZXSe0AYJHH+3gpaQvAb7QzdimNel7LOSwTMPT3gWuiPC0gcGUggoPD1e0eHY15MVUXzoVXMUOrEQnC8mo2lYdeTEh59TbdoJQW50IYrmny2Xo7Ob+ERCgtm0pHYItIOvGpOuK2A0O8tHUU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1647961563; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=JqltoGJRX+2MSwmF0XTLKRFwD7gu13wJPhM6SKICSMA=; b=B2aBouvUGU650IN+llsTbZ4GPLbz2t0fsg0ZQp1TYfh1pRUFq0D/R2UI21NxUFKJXWeM0K0XZcdZX5e/wUB2a8QN3Kxh+qE6bqapVQs/iBmon/ElQRg+z+3i6n98n5oHNRQ81wxYiwsGW2jt8s1jRoP2O68sZXH11nDC9ttoKOE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 16479615638711018.585406471929; Tue, 22 Mar 2022 08:06:03 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-610-qxClyOBpMmCZ1Zxt_yy43Q-1; Tue, 22 Mar 2022 11:05:35 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 17E3110666A2; Tue, 22 Mar 2022 15:05:25 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id F2EABC27EB0; Tue, 22 Mar 2022 15:05:24 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 91E651940340; Tue, 22 Mar 2022 15:05:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 6FDF11947BBC for ; Tue, 22 Mar 2022 15:05:22 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 4375E401E80; Tue, 22 Mar 2022 15:05:22 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id E03DD401052 for ; Tue, 22 Mar 2022 15:05:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647961562; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=JqltoGJRX+2MSwmF0XTLKRFwD7gu13wJPhM6SKICSMA=; b=Ee6FAyJsHIXx/WIEG34GICRPH3p4+HuLgJhF4QOK6J8vvXYLQIRdJIvWiouZTGtZvtGJcv NvRk/68I+m8mQQTdkVbafaED1QHlxIk72czYEBXPcuoa1lpmlzsUzqLp8Qayssi8u2GnC3 404fJ3XfIdgXeMYiNBXkX5dtTwEl/lA= X-MC-Unique: qxClyOBpMmCZ1Zxt_yy43Q-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 4/4] qemu_command: Generate prealloc-threads property Date: Tue, 22 Mar 2022 16:05:17 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1647961565464100001 Content-Type: text/plain; charset="utf-8" Let's generate prealloc-threads property onto the cmd line if domain configuration requests so. Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- src/qemu/qemu_command.c | 5 ++++- tests/qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index c836799888..8246ab515a 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3806,7 +3806,10 @@ qemuBuildMemoryBackendProps(virJSONValue **backendPr= ops, return -1; } else { if (!priv->memPrealloc && - virJSONValueObjectAdd(&props, "B:prealloc", prealloc, NULL) < = 0) + virJSONValueObjectAdd(&props, + "B:prealloc", prealloc, + "p:prealloc-threads", def->mem.allocatio= n_threads, + NULL) < 0) return -1; } =20 diff --git a/tests/qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args b/= tests/qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args index 6f5a983d3a..68bbd73551 100644 --- a/tests/qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args +++ b/tests/qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args @@ -16,7 +16,7 @@ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-instance-00000092/.c= onfig \ -m size=3D14680064k,slots=3D16,maxmem=3D1099511627776k \ -overcommit mem-lock=3Doff \ -smp 8,sockets=3D1,dies=3D1,cores=3D8,threads=3D1 \ --object '{"qom-type":"memory-backend-memfd","id":"ram-node0","hugetlb":tru= e,"hugetlbsize":2097152,"share":true,"prealloc":true,"size":15032385536,"ho= st-nodes":[3],"policy":"preferred"}' \ +-object '{"qom-type":"memory-backend-memfd","id":"ram-node0","hugetlb":tru= e,"hugetlbsize":2097152,"share":true,"prealloc":true,"prealloc-threads":8,"= size":15032385536,"host-nodes":[3],"policy":"preferred"}' \ -numa node,nodeid=3D0,cpus=3D0-7,memdev=3Dram-node0 \ -uuid 126f2720-6f8e-45ab-a886-ec9277079a67 \ -display none \ @@ -29,7 +29,7 @@ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-instance-00000092/.c= onfig \ -no-acpi \ -boot strict=3Don \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0= x2"}' \ --object '{"qom-type":"memory-backend-file","id":"memnvdimm0","mem-path":"/= tmp/nvdimm","share":true,"prealloc":true,"size":536870912,"host-nodes":[3],= "policy":"preferred"}' \ +-object '{"qom-type":"memory-backend-file","id":"memnvdimm0","mem-path":"/= tmp/nvdimm","share":true,"prealloc":true,"prealloc-threads":8,"size":536870= 912,"host-nodes":[3],"policy":"preferred"}' \ -device '{"driver":"nvdimm","node":0,"memdev":"memnvdimm0","id":"nvdimm0",= "slot":0}' \ -audiodev '{"id":"audio1","driver":"none"}' \ -device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","add= r":"0x3"}' \ --=20 2.34.1 From nobody Wed May 15 01:46:36 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1648120625; cv=none; d=zohomail.com; s=zohoarc; b=A1ySCweykqUr3NUEg9EOBa0nUVZQU2NCySmRdXWKeh0oAHMGTExkgIjD3SLjL9SzMaVmkzHIlLA6N5w+y4JKixKHM5EiAKYBqVaRvg9CT6PnAvCCymKvG7DnB93F84y/6sjB7YfY12kDCi18jSr6Bo3QwzHHIHULVo5IOxnmiCQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1648120625; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=RLNOMxuzU4Yur+w5hhPA8dyM+3QoqI5tUXceQEPzSnQ=; b=gJda79cslu6N8E5/zKC3VRkxDE/TPjw4yCCSesRBbd+FNf71P5JidKUtupUDkZE8ah8HKl8HHctNYHfQLJKOIU4FNmhcJQVky/6M3Q5gw5Nw7T67JSaTR5/qag52oAUBB8mlWx1us/eGqGSMezSwuHkymlLq7/kNmgu+qtRK+es= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1648120625448286.95348803158583; Thu, 24 Mar 2022 04:17:05 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-107-E526bHvPMAKhX9u1NO9bKQ-1; Thu, 24 Mar 2022 07:16:08 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9379B3C11A1F; Thu, 24 Mar 2022 11:16:06 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7CA95403176; Thu, 24 Mar 2022 11:16:06 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 21120194034E; Thu, 24 Mar 2022 11:16:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 6B60D194034B for ; Thu, 24 Mar 2022 11:16:04 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 39D7A43F505; Thu, 24 Mar 2022 11:16:04 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.180]) by smtp.corp.redhat.com (Postfix) with ESMTP id D5FE7492CA6 for ; Thu, 24 Mar 2022 11:16:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1648120624; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=RLNOMxuzU4Yur+w5hhPA8dyM+3QoqI5tUXceQEPzSnQ=; b=KpMr57wFwj8ShSpEDo4usRAGL8CUOLEcgKbGRkVSeKKU4Juk3M6UpJmqdGWHPOztHnF/kL 4KK80tMW6fm6WOnta8BA8F/OhNBGGAR9DcnTusjbaghJxDAY5+UgcDO0DN5u1ZDvn3kCEn LFEymaehC1w++G4Q3o98bsBrDTmTT6s= X-MC-Unique: E526bHvPMAKhX9u1NO9bKQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v2] conf: Introduce memory allocation threads Date: Thu, 24 Mar 2022 12:16:01 +0100 Message-Id: <26c90a52560e013c0c8fcc3f676b8dbc04c6b58d.1648120011.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1648120627139100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Since its v5.0.0 release QEMU is capable of specifying number of threads used to allocate memory. It defaults to 1, which may be too low for humongous guests with gigantic pages. In general, on QEMU cmd line level it is possible to use different number of threads per each memory-backend-* object, in practical terms it's not useful. Therefore, use to set guest wide value and let all memory devices 'inherit' it, silently. IOW, don't introduce per device knob because that would only complicate things for a little or no benefit. Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- docs/formatdomain.rst | 8 +++++--- src/conf/domain_conf.c | 15 ++++++++++++++- src/conf/domain_conf.h | 1 + src/conf/schemas/domaincommon.rng | 19 +++++++++++++------ tests/qemuxml2argvdata/memfd-memory-numa.xml | 2 +- 5 files changed, 34 insertions(+), 11 deletions(-) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index d188de4858..e492532004 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -1004,7 +1004,7 @@ Memory Backing - + ... @@ -1053,8 +1053,10 @@ influence how virtual memory pages are backed by hos= t pages. Using the ``mode`` attribute, specify if the memory is to be "shared" or "private". This can be overridden per numa node by ``memAccess``. ``allocation`` - Using the ``mode`` attribute, specify when to allocate the memory by - supplying either "immediate" or "ondemand". + Using the optional ``mode`` attribute, specify when to allocate the mem= ory by + supplying either "immediate" or "ondemand". :since:`Since 8.2.0` it is + possible to set the number of threads that hypervisor uses to allocate + memory via ``threads`` attribute. ``discard`` When set and supported by hypervisor the memory content is discarded ju= st before guest shuts down (or when DIMM module is unplugged). Please note= that diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 153954a0b0..731139f80f 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -18915,6 +18915,13 @@ virDomainDefParseMemory(virDomainDef *def, VIR_FREE(tmp); } =20 + if (virXPathUInt("string(./memoryBacking/allocation/@threads)", + ctxt, &def->mem.allocation_threads) =3D=3D -2) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("Failed to parse memory allocation threads")); + return -1; + } + if (virXPathNode("./memoryBacking/hugepages", ctxt)) { /* hugepages will be used */ if ((n =3D virXPathNodeSet("./memoryBacking/hugepages/page", ctxt,= &nodes)) < 0) { @@ -27465,6 +27472,7 @@ virDomainMemorybackingFormat(virBuffer *buf, const virDomainMemtune *mem) { g_auto(virBuffer) childBuf =3D VIR_BUFFER_INIT_CHILD(buf); + g_auto(virBuffer) allocAttrBuf =3D VIR_BUFFER_INITIALIZER; =20 if (mem->nhugepages) virDomainHugepagesFormat(&childBuf, mem->hugepages, mem->nhugepage= s); @@ -27479,8 +27487,13 @@ virDomainMemorybackingFormat(virBuffer *buf, virBufferAsprintf(&childBuf, "\n", virDomainMemoryAccessTypeToString(mem->access)); if (mem->allocation) - virBufferAsprintf(&childBuf, "\n", + virBufferAsprintf(&allocAttrBuf, " mode=3D'%s'", virDomainMemoryAllocationTypeToString(mem->alloc= ation)); + if (mem->allocation_threads > 0) + virBufferAsprintf(&allocAttrBuf, " threads=3D'%u'", mem->allocatio= n_threads); + + virXMLFormatElement(&childBuf, "allocation", &allocAttrBuf, NULL); + if (mem->discard) virBufferAddLit(&childBuf, "\n"); =20 diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index b69abfa270..49c964e6e1 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2702,6 +2702,7 @@ struct _virDomainMemtune { int source; /* enum virDomainMemorySource */ int access; /* enum virDomainMemoryAccess */ int allocation; /* enum virDomainMemoryAllocation */ + unsigned int allocation_threads; =20 virTristateBool discard; }; diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincom= mon.rng index 9c1b64a644..34bccee2f5 100644 --- a/src/conf/schemas/domaincommon.rng +++ b/src/conf/schemas/domaincommon.rng @@ -740,12 +740,19 @@ - - - immediate - ondemand - - + + + + immediate + ondemand + + + + + + + + diff --git a/tests/qemuxml2argvdata/memfd-memory-numa.xml b/tests/qemuxml2a= rgvdata/memfd-memory-numa.xml index 1ebcee8939..1ac87e3aef 100644 --- a/tests/qemuxml2argvdata/memfd-memory-numa.xml +++ b/tests/qemuxml2argvdata/memfd-memory-numa.xml @@ -10,7 +10,7 @@ - + 8 --=20 2.34.1