From nobody Wed May 1 19:22:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.25 as permitted sender) client-ip=209.132.183.25; envelope-from=libvir-list-bounces@redhat.com; helo=mx4-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.25 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by mx.zohomail.com with SMTPS id 1486042276518126.36398404094325; Thu, 2 Feb 2017 05:31:16 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v12DRkes013273; Thu, 2 Feb 2017 08:27:46 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v12DRixu017116 for ; Thu, 2 Feb 2017 08:27:45 -0500 Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v12DRiFu004728 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Thu, 2 Feb 2017 08:27:44 -0500 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9D519C05AA40 for ; Thu, 2 Feb 2017 13:27:43 +0000 (UTC) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP; 02 Feb 2017 05:27:42 -0800 Received: from silpixa00384861.ir.intel.com ([10.237.222.130]) by orsmga003.jf.intel.com with ESMTP; 02 Feb 2017 05:27:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,324,1477983600"; d="scan'208";a="929369463" From: Jaroslav Safka To: libvir-list@redhat.com Date: Thu, 2 Feb 2017 13:27:30 +0000 Message-Id: <1486042053-3640-2-git-send-email-jaroslavx.safka@intel.com> In-Reply-To: <1486042053-3640-1-git-send-email-jaroslavx.safka@intel.com> References: <1486042053-3640-1-git-send-email-jaroslavx.safka@intel.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 200 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 02 Feb 2017 13:27:44 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 02 Feb 2017 13:27:44 +0000 (UTC) for IP:'134.134.136.65' DOMAIN:'mga03.intel.com' HELO:'mga03.intel.com' FROM:'jaroslavx.safka@intel.com' RCPT:'' X-RedHat-Spam-Score: -4.222 (BAYES_50, RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RP_MATCHES_RCVD, SPF_PASS) 134.134.136.65 mga03.intel.com 134.134.136.65 mga03.intel.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-loop: libvir-list@redhat.com Cc: sean.k.mooney@intel.com, Jaroslav Safka , michalx.ptacek@intel.com Subject: [libvirt] [PATCHv5 1/4] qemu, conf: Rename virNumaMemAccess to virDomainMemoryAccess 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Rename to avoid duplicate code. Because virDomainMemoryAccess will be used in memorybacking for setting default behaviour. NOTE: The enum cannot be moved to qemu/domain_conf because of headers dependency --- src/conf/numa_conf.c | 15 ++++++++------- src/conf/numa_conf.h | 14 +++++++------- src/qemu/qemu_command.c | 10 +++++----- src/qemu/qemu_process.c | 2 +- 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c index 9818d95..bfd3703 100644 --- a/src/conf/numa_conf.c +++ b/src/conf/numa_conf.c @@ -43,10 +43,11 @@ VIR_ENUM_IMPL(virDomainNumatunePlacement, "static", "auto"); =20 -VIR_ENUM_IMPL(virNumaMemAccess, VIR_NUMA_MEM_ACCESS_LAST, +VIR_ENUM_IMPL(virDomainMemoryAccess, VIR_DOMAIN_MEMORY_ACCESS_LAST, "default", "shared", - "private"); + "private") + =20 typedef struct _virDomainNumaNode virDomainNumaNode; typedef virDomainNumaNode *virDomainNumaNodePtr; @@ -64,7 +65,7 @@ struct _virDomainNuma { virBitmapPtr cpumask; /* bitmap of vCPUs corresponding to the no= de */ virBitmapPtr nodeset; /* host memory nodes where this guest node= resides */ virDomainNumatuneMemMode mode; /* memory mode selection */ - virNumaMemAccess memAccess; /* shared memory access configuration = */ + virDomainMemoryAccess memAccess; /* shared memory access configura= tion */ } *mem_nodes; /* guest node configuration */ size_t nmem_nodes; =20 @@ -777,7 +778,7 @@ virDomainNumaDefCPUParseXML(virDomainNumaPtr def, goto cleanup; =20 if ((tmp =3D virXMLPropString(nodes[i], "memAccess"))) { - if ((rc =3D virNumaMemAccessTypeFromString(tmp)) <=3D 0) { + if ((rc =3D virDomainMemoryAccessTypeFromString(tmp)) <=3D 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Invalid 'memAccess' attribute value '%s'= "), tmp); @@ -803,7 +804,7 @@ int virDomainNumaDefCPUFormat(virBufferPtr buf, virDomainNumaPtr def) { - virNumaMemAccess memAccess; + virDomainMemoryAccess memAccess; char *cpustr; size_t ncells =3D virDomainNumaGetNodeCount(def); size_t i; @@ -827,7 +828,7 @@ virDomainNumaDefCPUFormat(virBufferPtr buf, virBufferAddLit(buf, " unit=3D'KiB'"); if (memAccess) virBufferAsprintf(buf, " memAccess=3D'%s'", - virNumaMemAccessTypeToString(memAccess)); + virDomainMemoryAccessTypeToString(memAccess)= ); virBufferAddLit(buf, "/>\n"); VIR_FREE(cpustr); } @@ -936,7 +937,7 @@ virDomainNumaGetNodeCpumask(virDomainNumaPtr numa, } =20 =20 -virNumaMemAccess +virDomainMemoryAccess virDomainNumaGetNodeMemoryAccessMode(virDomainNumaPtr numa, size_t node) { diff --git a/src/conf/numa_conf.h b/src/conf/numa_conf.h index 90deacb..05529ba 100644 --- a/src/conf/numa_conf.h +++ b/src/conf/numa_conf.h @@ -46,14 +46,14 @@ VIR_ENUM_DECL(virDomainNumatunePlacement) VIR_ENUM_DECL(virDomainNumatuneMemMode) =20 typedef enum { - VIR_NUMA_MEM_ACCESS_DEFAULT, - VIR_NUMA_MEM_ACCESS_SHARED, - VIR_NUMA_MEM_ACCESS_PRIVATE, + VIR_DOMAIN_MEMORY_ACCESS_DEFAULT =3D 0, /* No memory access defined = */ + VIR_DOMAIN_MEMORY_ACCESS_SHARED, /* Memory access is set as shared = */ + VIR_DOMAIN_MEMORY_ACCESS_PRIVATE, /* Memory access is set as private= */ =20 - VIR_NUMA_MEM_ACCESS_LAST -} virNumaMemAccess; + VIR_DOMAIN_MEMORY_ACCESS_LAST, +} virDomainMemoryAccess; +VIR_ENUM_DECL(virDomainMemoryAccess) =20 -VIR_ENUM_DECL(virNumaMemAccess) =20 virDomainNumaPtr virDomainNumaNew(void); void virDomainNumaFree(virDomainNumaPtr numa); @@ -90,7 +90,7 @@ size_t virDomainNumaGetNodeCount(virDomainNumaPtr numa) virBitmapPtr virDomainNumaGetNodeCpumask(virDomainNumaPtr numa, size_t node) ATTRIBUTE_NONNULL(1); -virNumaMemAccess virDomainNumaGetNodeMemoryAccessMode(virDomainNumaPtr num= a, +virDomainMemoryAccess virDomainNumaGetNodeMemoryAccessMode(virDomainNumaPt= r numa, size_t node) ATTRIBUTE_NONNULL(1); unsigned long long virDomainNumaGetNodeMemorySize(virDomainNumaPtr numa, diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 1396661..601f11b 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3232,7 +3232,7 @@ qemuBuildMemoryBackendStr(unsigned long long size, virDomainHugePagePtr hugepage =3D NULL; virDomainNumatuneMemMode mode; const long system_page_size =3D virGetSystemPageSizeKB(); - virNumaMemAccess memAccess =3D VIR_NUMA_MEM_ACCESS_DEFAULT; + virDomainMemoryAccess memAccess =3D VIR_DOMAIN_MEMORY_ACCESS_DEFAULT; size_t i; char *mem_path =3D NULL; virBitmapPtr nodemask =3D NULL; @@ -3327,18 +3327,18 @@ qemuBuildMemoryBackendStr(unsigned long long size, goto cleanup; =20 switch (memAccess) { - case VIR_NUMA_MEM_ACCESS_SHARED: + case VIR_DOMAIN_MEMORY_ACCESS_SHARED: if (virJSONValueObjectAdd(props, "b:share", true, NULL) < 0) goto cleanup; break; =20 - case VIR_NUMA_MEM_ACCESS_PRIVATE: + case VIR_DOMAIN_MEMORY_ACCESS_PRIVATE: if (virJSONValueObjectAdd(props, "b:share", false, NULL) < 0) goto cleanup; break; =20 - case VIR_NUMA_MEM_ACCESS_DEFAULT: - case VIR_NUMA_MEM_ACCESS_LAST: + case VIR_DOMAIN_MEMORY_ACCESS_DEFAULT: + case VIR_DOMAIN_MEMORY_ACCESS_LAST: break; } } else { diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 184440d..92fa69b 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4498,7 +4498,7 @@ qemuProcessStartWarnShmem(virDomainObjPtr vm) if (!shmem && vm->def->mem.nhugepages) { for (i =3D 0; i < virDomainNumaGetNodeCount(vm->def->numa); i++) { if (virDomainNumaGetNodeMemoryAccessMode(vm->def->numa, i) =3D= =3D - VIR_NUMA_MEM_ACCESS_SHARED) { + VIR_DOMAIN_MEMORY_ACCESS_SHARED) { shmem =3D true; break; } --=20 2.7.4 -------------------------------------------------------------- Intel Research and Development Ireland Limited Registered in Ireland Registered Office: Collinstown Industrial Park, Leixlip, County Kildare Registered Number: 308263 This e-mail and any attachments may contain confidential material for the s= ole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact = the sender and delete all copies. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed May 1 19:22:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) client-ip=209.132.183.37; envelope-from=libvir-list-bounces@redhat.com; helo=mx5-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx5-phx2.redhat.com (mx5-phx2.redhat.com [209.132.183.37]) by mx.zohomail.com with SMTPS id 1486042298286593.9617715634049; Thu, 2 Feb 2017 05:31:38 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v12DS09s003503; Thu, 2 Feb 2017 08:28:00 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v12DRwUY017161 for ; Thu, 2 Feb 2017 08:27:58 -0500 Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v12DRw4h004883 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Thu, 2 Feb 2017 08:27:58 -0500 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DF718C05680F for ; Thu, 2 Feb 2017 13:27:47 +0000 (UTC) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP; 02 Feb 2017 05:27:46 -0800 Received: from silpixa00384861.ir.intel.com ([10.237.222.130]) by orsmga003.jf.intel.com with ESMTP; 02 Feb 2017 05:27:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,324,1477983600"; d="scan'208";a="929369516" From: Jaroslav Safka To: libvir-list@redhat.com Date: Thu, 2 Feb 2017 13:27:31 +0000 Message-Id: <1486042053-3640-3-git-send-email-jaroslavx.safka@intel.com> In-Reply-To: <1486042053-3640-1-git-send-email-jaroslavx.safka@intel.com> References: <1486042053-3640-1-git-send-email-jaroslavx.safka@intel.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 200 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 02 Feb 2017 13:27:48 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 02 Feb 2017 13:27:48 +0000 (UTC) for IP:'134.134.136.65' DOMAIN:'mga03.intel.com' HELO:'mga03.intel.com' FROM:'jaroslavx.safka@intel.com' RCPT:'' X-RedHat-Spam-Score: -4.222 (BAYES_50, RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RP_MATCHES_RCVD, SPF_PASS) 134.134.136.65 mga03.intel.com 134.134.136.65 mga03.intel.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-loop: libvir-list@redhat.com Cc: sean.k.mooney@intel.com, Jaroslav Safka , michalx.ptacek@intel.com Subject: [libvirt] [PATCHv5 2/4] qemu_conf: Add param memory_backing_dir 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add new parameter memory_backing_dir where files will be stored when memory= Backing source is selected as file. Value is stored inside char* memoryBackingDir --- src/qemu/libvirtd_qemu.aug | 3 +++ src/qemu/qemu.conf | 4 ++++ src/qemu/qemu_conf.c | 9 +++++++++ src/qemu/qemu_conf.h | 2 ++ src/qemu/test_libvirtd_qemu.aug.in | 1 + 5 files changed, 19 insertions(+) diff --git a/src/qemu/libvirtd_qemu.aug b/src/qemu/libvirtd_qemu.aug index de723b2..82bae9e 100644 --- a/src/qemu/libvirtd_qemu.aug +++ b/src/qemu/libvirtd_qemu.aug @@ -109,6 +109,8 @@ module Libvirtd_qemu =3D =20 let gluster_debug_level_entry =3D int_entry "gluster_debug_level" =20 + let memory_entry =3D str_entry "memory_backing_dir" + (* Each entry in the config is one of the following ... *) let entry =3D default_tls_entry | vnc_entry @@ -125,6 +127,7 @@ module Libvirtd_qemu =3D | log_entry | nvram_entry | gluster_debug_level_entry + | memory_entry =20 let comment =3D [ label "#comment" . del /#[ \t]*/ "# " . store /([^ \= t\n][^\n]*)?/ . del /\n/ "\n" ] let empty =3D [ label "#empty" . eol ] diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf index a8cd369..97d769d 100644 --- a/src/qemu/qemu.conf +++ b/src/qemu/qemu.conf @@ -673,3 +673,7 @@ # devices entries throughout the domain lifetime. This namespace is turned= on # by default. #namespaces =3D [ "mount" ] + +# This directory is used for memoryBacking source if configured as file. +# NOTE: big files will be stored here +#memory_backing_dir =3D "/var/lib/libvirt/qemu/ram" diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 6613d59..0223a95 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -186,6 +186,8 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool priv= ileged) goto error; if (virAsprintf(&cfg->nvramDir, "%s/nvram", cfg->libDir) < 0) goto error; + if (virAsprintf(&cfg->memoryBackingDir, "%s/ram", cfg->libDir) < 0) + goto error; } else { char *rundir; char *cachedir; @@ -231,6 +233,8 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool priv= ileged) if (virAsprintf(&cfg->nvramDir, "%s/qemu/nvram", cfg->configBaseDir) < 0) goto error; + if (virAsprintf(&cfg->memoryBackingDir, "%s/qemu/ram", cfg->config= BaseDir) < 0) + goto error; } =20 if (virAsprintf(&cfg->configDir, "%s/qemu", cfg->configBaseDir) < 0) @@ -408,6 +412,8 @@ static void virQEMUDriverConfigDispose(void *obj) VIR_FREE(cfg->lockManagerName); =20 virFirmwareFreeList(cfg->firmwares, cfg->nfirmwares); + + VIR_FREE(cfg->memoryBackingDir); } =20 =20 @@ -835,6 +841,9 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr = cfg, } } =20 + if (virConfGetValueString(conf, "memory_backing_dir", &cfg->memoryBack= ingDir) < 0) + goto cleanup; + ret =3D 0; =20 cleanup: diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index 92a7a50..91904ed 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -195,6 +195,8 @@ struct _virQEMUDriverConfig { virFirmwarePtr *firmwares; size_t nfirmwares; unsigned int glusterDebugLevel; + + char *memoryBackingDir; }; =20 /* Main driver state */ diff --git a/src/qemu/test_libvirtd_qemu.aug.in b/src/qemu/test_libvirtd_qe= mu.aug.in index a749f09..bd25235 100644 --- a/src/qemu/test_libvirtd_qemu.aug.in +++ b/src/qemu/test_libvirtd_qemu.aug.in @@ -94,3 +94,4 @@ module Test_libvirtd_qemu =3D { "namespaces" { "1" =3D "mount" } } +{ "memory_backing_dir" =3D "/var/lib/libvirt/qemu/ram" } --=20 2.7.4 -------------------------------------------------------------- Intel Research and Development Ireland Limited Registered in Ireland Registered Office: Collinstown Industrial Park, Leixlip, County Kildare Registered Number: 308263 This e-mail and any attachments may contain confidential material for the s= ole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact = the sender and delete all copies. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed May 1 19:22:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.25 as permitted sender) client-ip=209.132.183.25; envelope-from=libvir-list-bounces@redhat.com; helo=mx4-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.25 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by mx.zohomail.com with SMTPS id 1486042297346664.5699668017988; Thu, 2 Feb 2017 05:31:37 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v12DS2HY013303; Thu, 2 Feb 2017 08:28:02 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v12DRqqC017139 for ; Thu, 2 Feb 2017 08:27:52 -0500 Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.31]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v12DRq1O001586 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Thu, 2 Feb 2017 08:27:52 -0500 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 82295C04B92B for ; Thu, 2 Feb 2017 13:27:50 +0000 (UTC) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP; 02 Feb 2017 05:27:49 -0800 Received: from silpixa00384861.ir.intel.com ([10.237.222.130]) by orsmga003.jf.intel.com with ESMTP; 02 Feb 2017 05:27:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,324,1477983600"; d="scan'208";a="929369535" From: Jaroslav Safka To: libvir-list@redhat.com Date: Thu, 2 Feb 2017 13:27:32 +0000 Message-Id: <1486042053-3640-4-git-send-email-jaroslavx.safka@intel.com> In-Reply-To: <1486042053-3640-1-git-send-email-jaroslavx.safka@intel.com> References: <1486042053-3640-1-git-send-email-jaroslavx.safka@intel.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 200 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 02 Feb 2017 13:27:50 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 02 Feb 2017 13:27:50 +0000 (UTC) for IP:'134.134.136.65' DOMAIN:'mga03.intel.com' HELO:'mga03.intel.com' FROM:'jaroslavx.safka@intel.com' RCPT:'' X-RedHat-Spam-Score: -4.222 (BAYES_50, RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RP_MATCHES_RCVD, SPF_PASS) 134.134.136.65 mga03.intel.com 134.134.136.65 mga03.intel.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-loop: libvir-list@redhat.com Cc: sean.k.mooney@intel.com, Jaroslav Safka , michalx.ptacek@intel.com Subject: [libvirt] [PATCHv5 3/4] conf: Add new xml elements for file memorybacking support 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This part introduces new xml elements for file based memorybacking support and their parsing. (It allows vhost-user to be used without hugepages.) New xml elements: --- docs/formatdomain.html.in | 9 ++ docs/schemas/domaincommon.rng | 30 +++++ src/conf/domain_conf.c | 133 ++++++++++++++++-= ---- src/conf/domain_conf.h | 22 ++++ .../qemuxml2argv-memorybacking-set.xml | 24 ++++ .../qemuxml2argv-memorybacking-unset.xml | 24 ++++ .../qemuxml2xmlout-memorybacking-set.xml | 32 +++++ .../qemuxml2xmlout-memorybacking-unset.xml | 32 +++++ tests/qemuxml2xmltest.c | 3 + 9 files changed, 276 insertions(+), 33 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-memorybacking-set.x= ml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-memorybacking-unset= .xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-memorybacking-s= et.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-memorybacking-u= nset.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 77d8e71..0a115f5 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -903,6 +903,9 @@ </hugepages> <nosharepages/> <locked/> + <source type=3D"file|anonymous"/> + <access mode=3D"shared|private"/> + <allocation mode=3D"immediate|ondemand"/> </memoryBacking> ... </domain> @@ -942,6 +945,12 @@ most of the host's memory). Doing so may be dangerous to both the domain and the host itself since the host's kernel may run out of memory. Since 1.0.6 +
source
+
In this attribute you can switch to file memorybacking or keep = default anonymous.
+
access
+
Specify if memory is shared or private. This can be overridden = per numa node by memAccess
+
allocation
+
Specify when allocate the memory
=20 =20 diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index cc6e0d0..d715bff 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -565,6 +565,36 @@ + + + + + file + anonymous + + + + + + + + + shared + private + + + + + + + + + immediate + ondemand + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 877a0bf..e47b87f 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -837,6 +837,16 @@ VIR_ENUM_IMPL(virDomainDiskMirrorState, VIR_DOMAIN_DIS= K_MIRROR_STATE_LAST, "abort", "pivot") =20 +VIR_ENUM_IMPL(virDomainMemorySource, VIR_DOMAIN_MEMORY_SOURCE_LAST, + "none", + "file", + "anonymous") + +VIR_ENUM_IMPL(virDomainMemoryAllocation, VIR_DOMAIN_MEMORY_ALLOCATION_LAST, + "none", + "immediate", + "ondemand") + VIR_ENUM_IMPL(virDomainLoader, VIR_DOMAIN_LOADER_TYPE_LAST, "rom", @@ -16594,48 +16604,93 @@ virDomainDefParseXML(xmlDocPtr xml, } VIR_FREE(tmp); =20 - if ((n =3D virXPathNodeSet("./memoryBacking/hugepages/page", ctxt, &no= des)) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot extract hugepages nodes")); - goto error; + tmp =3D virXPathString("string(./memoryBacking/source/@type)", ctxt); + if (tmp) { + if ((def->mem.source =3D virDomainMemorySourceTypeFromString(tmp))= < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown memoryBacking/source/type '%s'"), tm= p); + goto error; + } + VIR_FREE(tmp); } =20 - if (n) { - if (VIR_ALLOC_N(def->mem.hugepages, n) < 0) + tmp =3D virXPathString("string(./memoryBacking/access/@mode)", ctxt); + if (tmp) { + if ((def->mem.access =3D virDomainMemoryAccessTypeFromString(tmp))= < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown memoryBacking/access/mode '%s'"), tm= p); goto error; + } + VIR_FREE(tmp); + } =20 - for (i =3D 0; i < n; i++) { - if (virDomainHugepagesParseXML(nodes[i], ctxt, - &def->mem.hugepages[i]) < 0) + tmp =3D virXPathString("string(./memoryBacking/allocation/@mode)", ctx= t); + if (tmp) { + if ((def->mem.allocation =3D virDomainMemoryAllocationTypeFromStri= ng(tmp)) < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown memoryBacking/allocation/mode '%s'")= , tmp); + goto error; + } + VIR_FREE(tmp); + } + + if (virXPathNode("./memoryBacking/hugepages", ctxt)) { + /* hugepages will be used */ + + if (def->mem.allocation =3D=3D VIR_DOMAIN_MEMORY_ALLOCATION_ONDEMA= ND) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("hugepages are not allowed with memory alloca= tion ondemand")); + goto error; + } + + if (def->mem.source =3D=3D VIR_DOMAIN_MEMORY_SOURCE_ANONYMOUS) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("hugepages are not allowed with anonymous mem= ory source")); + goto error; + } + + if ((n =3D virXPathNodeSet("./memoryBacking/hugepages/page", ctxt,= &nodes)) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot extract hugepages nodes")); + goto error; + } + + if (n) { + if (VIR_ALLOC_N(def->mem.hugepages, n) < 0) goto error; - def->mem.nhugepages++; =20 - for (j =3D 0; j < i; j++) { - if (def->mem.hugepages[i].nodemask && - def->mem.hugepages[j].nodemask && - virBitmapOverlaps(def->mem.hugepages[i].nodemask, - def->mem.hugepages[j].nodemask)) { - virReportError(VIR_ERR_XML_DETAIL, - _("nodeset attribute of hugepages " - "of sizes %llu and %llu intersect"), - def->mem.hugepages[i].size, - def->mem.hugepages[j].size); - goto error; - } else if (!def->mem.hugepages[i].nodemask && - !def->mem.hugepages[j].nodemask) { - virReportError(VIR_ERR_XML_DETAIL, - _("two master hugepages detected: " - "%llu and %llu"), - def->mem.hugepages[i].size, - def->mem.hugepages[j].size); + for (i =3D 0; i < n; i++) { + if (virDomainHugepagesParseXML(nodes[i], ctxt, + &def->mem.hugepages[i]) < 0) goto error; + def->mem.nhugepages++; + + for (j =3D 0; j < i; j++) { + if (def->mem.hugepages[i].nodemask && + def->mem.hugepages[j].nodemask && + virBitmapOverlaps(def->mem.hugepages[i].nodemask, + def->mem.hugepages[j].nodemask))= { + virReportError(VIR_ERR_XML_DETAIL, + _("nodeset attribute of hugepages " + "of sizes %llu and %llu intersect= "), + def->mem.hugepages[i].size, + def->mem.hugepages[j].size); + goto error; + } else if (!def->mem.hugepages[i].nodemask && + !def->mem.hugepages[j].nodemask) { + virReportError(VIR_ERR_XML_DETAIL, + _("two master hugepages detected: " + "%llu and %llu"), + def->mem.hugepages[i].size, + def->mem.hugepages[j].size); + goto error; + } } } - } =20 - VIR_FREE(nodes); - } else { - if ((node =3D virXPathNode("./memoryBacking/hugepages", ctxt))) { + VIR_FREE(nodes); + } else { + /* no hugepage pages */ if (VIR_ALLOC(def->mem.hugepages) < 0) goto error; =20 @@ -23728,7 +23783,9 @@ virDomainDefFormatInternal(virDomainDefPtr def, virBufferAddLit(buf, "\n"); } =20 - if (def->mem.nhugepages || def->mem.nosharepages || def->mem.locked) { + if (def->mem.nhugepages || def->mem.nosharepages || def->mem.locked + || def->mem.source || def->mem.access || def->mem.allocation) + { virBufferAddLit(buf, "\n"); virBufferAdjustIndent(buf, 2); if (def->mem.nhugepages) @@ -23737,6 +23794,16 @@ virDomainDefFormatInternal(virDomainDefPtr def, virBufferAddLit(buf, "\n"); if (def->mem.locked) virBufferAddLit(buf, "\n"); + if (def->mem.source) + virBufferAsprintf(buf, "\n", + virDomainMemorySourceTypeToString(def->mem.source)); + if (def->mem.access) + virBufferAsprintf(buf, "\n", + virDomainMemoryAccessTypeToString(def->mem.access)); + if (def->mem.allocation) + virBufferAsprintf(buf, "\n", + virDomainMemoryAllocationTypeToString(def->mem.allocation)= ); + virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); } diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 4d830c5..2615630 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -586,6 +586,22 @@ typedef enum { VIR_DOMAIN_DISK_MIRROR_STATE_LAST } virDomainDiskMirrorState; =20 +typedef enum { + VIR_DOMAIN_MEMORY_SOURCE_NONE =3D 0, /* No memory source defined */ + VIR_DOMAIN_MEMORY_SOURCE_FILE, /* Memory source is set as file */ + VIR_DOMAIN_MEMORY_SOURCE_ANONYMOUS, /* Memory source is set as anonymo= us */ + + VIR_DOMAIN_MEMORY_SOURCE_LAST, +} virDomainMemorySource; + +typedef enum { + VIR_DOMAIN_MEMORY_ALLOCATION_NONE =3D 0, /* No memory allocation defi= ned */ + VIR_DOMAIN_MEMORY_ALLOCATION_IMMEDIATE, /* Memory allocation is set as= immediate */ + VIR_DOMAIN_MEMORY_ALLOCATION_ONDEMAND, /* Memory allocation is set as= ondemand */ + + VIR_DOMAIN_MEMORY_ALLOCATION_LAST, +} virDomainMemoryAllocation; + =20 /* Stores the virtual disk configuration */ struct _virDomainDiskDef { @@ -2130,6 +2146,10 @@ struct _virDomainMemtune { unsigned long long soft_limit; /* in kibibytes, limit at off_t bytes */ unsigned long long min_guarantee; /* in kibibytes, limit at off_t byte= s */ unsigned long long swap_hard_limit; /* in kibibytes, limit at off_t by= tes */ + + int source; /* enum virDomainMemorySource */ + int access; /* enum virDomainMemoryAccess */ + int allocation; /* enum virDomainMemoryAllocation */ }; =20 typedef struct _virDomainPowerManagement virDomainPowerManagement; @@ -3115,6 +3135,8 @@ VIR_ENUM_DECL(virDomainTPMModel) VIR_ENUM_DECL(virDomainTPMBackend) VIR_ENUM_DECL(virDomainMemoryModel) VIR_ENUM_DECL(virDomainMemoryBackingModel) +VIR_ENUM_DECL(virDomainMemorySource) +VIR_ENUM_DECL(virDomainMemoryAllocation) VIR_ENUM_DECL(virDomainIOMMUModel) VIR_ENUM_DECL(virDomainShmemModel) /* from libvirt.h */ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-memorybacking-set.xml b/te= sts/qemuxml2argvdata/qemuxml2argv-memorybacking-set.xml new file mode 100644 index 0000000..e23bc36 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-memorybacking-set.xml @@ -0,0 +1,24 @@ + + SomeDummyGuest + ef1bdff4-27f3-4e85-a807-5fb4d58463cc + 1048576 + 1048576 + + + + + + 2 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu + + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-memorybacking-unset.xml b/= tests/qemuxml2argvdata/qemuxml2argv-memorybacking-unset.xml new file mode 100644 index 0000000..6f50765 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-memorybacking-unset.xml @@ -0,0 +1,24 @@ + + SomeDummyGuest + ef1bdff4-27f3-4e85-a807-5fb4d58463cc + 1048576 + 1048576 + + + + + + 2 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu + + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-memorybacking-set.xml = b/tests/qemuxml2xmloutdata/qemuxml2xmlout-memorybacking-set.xml new file mode 100644 index 0000000..fb07472 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-memorybacking-set.xml @@ -0,0 +1,32 @@ + + SomeDummyGuest + ef1bdff4-27f3-4e85-a807-5fb4d58463cc + 1048576 + 1048576 + + + + + + 2 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu + +
+ + + + + +
+ + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-memorybacking-unset.xm= l b/tests/qemuxml2xmloutdata/qemuxml2xmlout-memorybacking-unset.xml new file mode 100644 index 0000000..ac2a278 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-memorybacking-unset.xml @@ -0,0 +1,32 @@ + + SomeDummyGuest + ef1bdff4-27f3-4e85-a807-5fb4d58463cc + 1048576 + 1048576 + + + + + + 2 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu + +
+ + + + + +
+ + + diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 4f3b09a..0702f58 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1042,6 +1042,9 @@ mymain(void) DO_TEST("virtio-input", NONE); DO_TEST("virtio-input-passthrough", NONE); =20 + DO_TEST("memorybacking-set", NONE); + DO_TEST("memorybacking-unset", NONE); + virObjectUnref(cfg); =20 DO_TEST("acpi-table", NONE); --=20 2.7.4 -------------------------------------------------------------- Intel Research and Development Ireland Limited Registered in Ireland Registered Office: Collinstown Industrial Park, Leixlip, County Kildare Registered Number: 308263 This e-mail and any attachments may contain confidential material for the s= ole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact = the sender and delete all copies. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed May 1 19:22:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) client-ip=209.132.183.39; envelope-from=libvir-list-bounces@redhat.com; helo=mx6-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com [209.132.183.39]) by mx.zohomail.com with SMTPS id 1486042291087705.4588263469674; Thu, 2 Feb 2017 05:31:31 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v12DS265020587; Thu, 2 Feb 2017 08:28:02 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v12DRtBH017149 for ; Thu, 2 Feb 2017 08:27:55 -0500 Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.31]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v12DRsj1001640 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Thu, 2 Feb 2017 08:27:55 -0500 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6310DC04D2B8 for ; Thu, 2 Feb 2017 13:27:53 +0000 (UTC) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP; 02 Feb 2017 05:27:52 -0800 Received: from silpixa00384861.ir.intel.com ([10.237.222.130]) by orsmga003.jf.intel.com with ESMTP; 02 Feb 2017 05:27:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,324,1477983600"; d="scan'208";a="929369557" From: Jaroslav Safka To: libvir-list@redhat.com Date: Thu, 2 Feb 2017 13:27:33 +0000 Message-Id: <1486042053-3640-5-git-send-email-jaroslavx.safka@intel.com> In-Reply-To: <1486042053-3640-1-git-send-email-jaroslavx.safka@intel.com> References: <1486042053-3640-1-git-send-email-jaroslavx.safka@intel.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 200 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 02 Feb 2017 13:27:53 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 02 Feb 2017 13:27:53 +0000 (UTC) for IP:'134.134.136.65' DOMAIN:'mga03.intel.com' HELO:'mga03.intel.com' FROM:'jaroslavx.safka@intel.com' RCPT:'' X-RedHat-Spam-Score: -4.222 (BAYES_50, RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RP_MATCHES_RCVD, SPF_PASS) 134.134.136.65 mga03.intel.com 134.134.136.65 mga03.intel.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-loop: libvir-list@redhat.com Cc: sean.k.mooney@intel.com, Jaroslav Safka , michalx.ptacek@intel.com Subject: [libvirt] [PATCHv5 4/4] qemu: Add args generation for file memory backing 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This patch add support for file memory backing on numa topology. The specified access mode in memoryBacking can be overriden by specifying token memAccess in numa cell. --- src/qemu/qemu_command.c | 45 ++++++++++++++++--= ---- .../qemuxml2argv-fd-memory-no-numa-topology.args | 21 ++++++++++ .../qemuxml2argv-fd-memory-no-numa-topology.xml | 27 +++++++++++++ .../qemuxml2argv-fd-memory-numa-topology.args | 24 ++++++++++++ .../qemuxml2argv-fd-memory-numa-topology.xml | 30 +++++++++++++++ .../qemuxml2argv-fd-memory-numa-topology2.args | 27 +++++++++++++ .../qemuxml2argv-fd-memory-numa-topology2.xml | 31 +++++++++++++++ .../qemuxml2argv-fd-memory-numa-topology3.args | 30 +++++++++++++++ .../qemuxml2argv-fd-memory-numa-topology3.xml | 32 +++++++++++++++ tests/qemuxml2argvtest.c | 13 +++++++ 10 files changed, 268 insertions(+), 12 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-fd-memory-no-numa-t= opology.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-fd-memory-no-numa-t= opology.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topo= logy.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topo= logy.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topo= logy2.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topo= logy2.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topo= logy3.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topo= logy3.xml diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 601f11b..5fa735e 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3314,17 +3314,26 @@ qemuBuildMemoryBackendStr(unsigned long long size, if (!(props =3D virJSONValueNewObject())) return -1; =20 - if (pagesize) { - if (qemuGetDomainHupageMemPath(def, cfg, pagesize, &mem_path) < 0) - goto cleanup; - + if (pagesize || def->mem.source =3D=3D VIR_DOMAIN_MEMORY_SOURCE_FILE) { *backendType =3D "memory-backend-file"; =20 - if (virJSONValueObjectAdd(props, - "b:prealloc", true, - "s:mem-path", mem_path, - NULL) < 0) - goto cleanup; + if (def->mem.source =3D=3D VIR_DOMAIN_MEMORY_SOURCE_FILE) { + /* we can have both pagesize and mem source, then check mem so= urce first */ + force =3D true; + if (virJSONValueObjectAdd(props, + "s:mem-path", cfg->memoryBackingDir, + NULL) < 0) + goto cleanup; + } else { + if (qemuGetDomainHupageMemPath(def, cfg, pagesize, &mem_path) = < 0) + goto cleanup; + + if (virJSONValueObjectAdd(props, + "b:prealloc", true, + "s:mem-path", mem_path, + NULL) < 0) + goto cleanup; + } =20 switch (memAccess) { case VIR_DOMAIN_MEMORY_ACCESS_SHARED: @@ -3338,6 +3347,12 @@ qemuBuildMemoryBackendStr(unsigned long long size, break; =20 case VIR_DOMAIN_MEMORY_ACCESS_DEFAULT: + if (def->mem.access =3D=3D VIR_DOMAIN_MEMORY_ACCESS_SHARED) { + if (virJSONValueObjectAdd(props, "b:share", true, NULL) < = 0) + goto cleanup; + } + break; + case VIR_DOMAIN_MEMORY_ACCESS_LAST: break; } @@ -7302,7 +7317,10 @@ qemuBuildMemPathStr(virQEMUDriverConfigPtr cfg, if (qemuGetDomainHupageMemPath(def, cfg, def->mem.hugepages[0].size, &= mem_path) < 0) return -1; =20 - virCommandAddArgList(cmd, "-mem-prealloc", "-mem-path", mem_path, NULL= ); + if (def->mem.allocation !=3D VIR_DOMAIN_MEMORY_ALLOCATION_IMMEDIATE) + virCommandAddArgList(cmd, "-mem-prealloc", NULL); + + virCommandAddArgList(cmd, "-mem-path", mem_path, NULL); VIR_FREE(mem_path); =20 return 0; @@ -7332,9 +7350,12 @@ qemuBuildMemCommandLine(virCommandPtr cmd, virDomainDefGetMemoryInitial(def) / 1024); } =20 + if (def->mem.allocation =3D=3D VIR_DOMAIN_MEMORY_ALLOCATION_IMMEDIATE) + virCommandAddArgList(cmd, "-mem-prealloc", NULL); + /* - * Add '-mem-path' (and '-mem-prealloc') parameter here only if - * there is no numa node specified. + * Add '-mem-path' (and '-mem-prealloc') parameter here if + * the hugepages and no numa node is specified. */ if (!virDomainNumaGetNodeCount(def->numa) && qemuBuildMemPathStr(cfg, def, qemuCaps, cmd) < 0) diff --git a/tests/qemuxml2argvdata/qemuxml2argv-fd-memory-no-numa-topology= .args b/tests/qemuxml2argvdata/qemuxml2argv-fd-memory-no-numa-topology.args new file mode 100644 index 0000000..951a7cb --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-fd-memory-no-numa-topology.args @@ -0,0 +1,21 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name instance-00000092 \ +-S \ +-M pc-i440fx-wily \ +-m 14336 \ +-mem-prealloc \ +-smp 8,sockets=3D8,cores=3D1,threads=3D1 \ +-uuid 126f2720-6f8e-45ab-a886-ec9277079a67 \ +-nographic \ +-nodefaults \ +-monitor unix:/tmp/lib/domain--1-instance-00000092/monitor.sock,server,now= ait \ +-no-acpi \ +-boot c \ +-usb \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-fd-memory-no-numa-topology= .xml b/tests/qemuxml2argvdata/qemuxml2argv-fd-memory-no-numa-topology.xml new file mode 100644 index 0000000..243b65d --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-fd-memory-no-numa-topology.xml @@ -0,0 +1,27 @@ + + instance-00000092 + 126f2720-6f8e-45ab-a886-ec9277079a67 + 14680064 + 14680064 + + + + + + 8 + + hvm + + + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology.ar= gs b/tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology.args new file mode 100644 index 0000000..bef8136 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology.args @@ -0,0 +1,24 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name instance-00000092 \ +-S \ +-M pc-i440fx-wily \ +-m 14336 \ +-mem-prealloc \ +-smp 8,sockets=3D1,cores=3D8,threads=3D1 \ +-object memory-backend-file,id=3Dram-node0,mem-path=3D/var/lib/libvirt/qem= u/ram,\ +share=3Dyes,size=3D15032385536 \ +-numa node,nodeid=3D0,cpus=3D0-7,memdev=3Dram-node0 \ +-uuid 126f2720-6f8e-45ab-a886-ec9277079a67 \ +-nographic \ +-nodefaults \ +-monitor unix:/tmp/lib/domain--1-instance-00000092/monitor.sock,server,now= ait \ +-no-acpi \ +-boot c \ +-usb \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology.xm= l b/tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology.xml new file mode 100644 index 0000000..ca5402d --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology.xml @@ -0,0 +1,30 @@ + + instance-00000092 + 126f2720-6f8e-45ab-a886-ec9277079a67 + 14680064 + 14680064 + + + + + + 8 + + hvm + + + + + + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology2.a= rgs b/tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology2.args new file mode 100644 index 0000000..4420b9a --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology2.args @@ -0,0 +1,27 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name instance-00000092 \ +-S \ +-M pc-i440fx-wily \ +-m 28672 \ +-mem-prealloc \ +-smp 20,sockets=3D1,cores=3D8,threads=3D1 \ +-object memory-backend-file,id=3Dram-node0,mem-path=3D/var/lib/libvirt/qem= u/ram,\ +size=3D15032385536 \ +-numa node,nodeid=3D0,cpus=3D0-7,memdev=3Dram-node0 \ +-object memory-backend-file,id=3Dram-node1,mem-path=3D/var/lib/libvirt/qem= u/ram,\ +share=3Dyes,size=3D15032385536 \ +-numa node,nodeid=3D1,cpus=3D8-15,memdev=3Dram-node1 \ +-uuid 126f2720-6f8e-45ab-a886-ec9277079a67 \ +-nographic \ +-nodefaults \ +-monitor unix:/tmp/lib/domain--1-instance-00000092/monitor.sock,server,now= ait \ +-no-acpi \ +-boot c \ +-usb \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology2.x= ml b/tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology2.xml new file mode 100644 index 0000000..49beff1 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology2.xml @@ -0,0 +1,31 @@ + + instance-00000092 + 126f2720-6f8e-45ab-a886-ec9277079a67 + 14680064 + 14680064 + + + + + + 20 + + hvm + + + + + + + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology3.a= rgs b/tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology3.args new file mode 100644 index 0000000..4d98aa0 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology3.args @@ -0,0 +1,30 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name instance-00000092 \ +-S \ +-M pc-i440fx-wily \ +-m 43008 \ +-mem-prealloc \ +-smp 32,sockets=3D1,cores=3D24,threads=3D1 \ +-object memory-backend-file,id=3Dram-node0,mem-path=3D/var/lib/libvirt/qem= u/ram,\ +share=3Dyes,size=3D15032385536 \ +-numa node,nodeid=3D0,cpus=3D0-1,memdev=3Dram-node0 \ +-object memory-backend-file,id=3Dram-node1,mem-path=3D/var/lib/libvirt/qem= u/ram,\ +share=3Dyes,size=3D15032385536 \ +-numa node,nodeid=3D1,cpus=3D2-3,memdev=3Dram-node1 \ +-object memory-backend-file,id=3Dram-node2,mem-path=3D/var/lib/libvirt/qem= u/ram,\ +share=3Dno,size=3D15032385536 \ +-numa node,nodeid=3D2,cpus=3D4-5,memdev=3Dram-node2 \ +-uuid 126f2720-6f8e-45ab-a886-ec9277079a67 \ +-nographic \ +-nodefaults \ +-monitor unix:/tmp/lib/domain--1-instance-00000092/monitor.sock,server,now= ait \ +-no-acpi \ +-boot c \ +-usb \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology3.x= ml b/tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology3.xml new file mode 100644 index 0000000..7933507 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology3.xml @@ -0,0 +1,32 @@ + + instance-00000092 + 126f2720-6f8e-45ab-a886-ec9277079a67 + 14680064 + 14680064 + + + + + + 32 + + hvm + + + + + + + + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index d0b0cec..c244ad5 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -594,6 +594,9 @@ mymain(void) driver.config->spiceTLS =3D 1; if (VIR_STRDUP_QUIET(driver.config->spicePassword, "123456") < 0) return EXIT_FAILURE; + VIR_FREE(driver.config->memoryBackingDir); + if (VIR_STRDUP_QUIET(driver.config->memoryBackingDir, "/var/lib/libvir= t/qemu/ram") < 0) + return EXIT_FAILURE; =20 # define DO_TEST_FULL(name, migrateFrom, migrateFd, flags, \ parseFlags, gic, ...) \ @@ -2465,6 +2468,16 @@ mymain(void) =20 DO_TEST("cpu-hotplug-startup", QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS); =20 + DO_TEST("fd-memory-numa-topology", QEMU_CAPS_MEM_PATH, QEMU_CAPS_OBJEC= T_MEMORY_FILE, + QEMU_CAPS_KVM); + DO_TEST("fd-memory-numa-topology2", QEMU_CAPS_MEM_PATH, QEMU_CAPS_OBJE= CT_MEMORY_FILE, + QEMU_CAPS_KVM); + DO_TEST("fd-memory-numa-topology3", QEMU_CAPS_MEM_PATH, QEMU_CAPS_OBJE= CT_MEMORY_FILE, + QEMU_CAPS_KVM); + + DO_TEST("fd-memory-no-numa-topology", QEMU_CAPS_MEM_PATH, QEMU_CAPS_OB= JECT_MEMORY_FILE, + QEMU_CAPS_KVM); + qemuTestDriverFree(&driver); =20 return ret =3D=3D 0 ? EXIT_SUCCESS : EXIT_FAILURE; --=20 2.7.4 -------------------------------------------------------------- Intel Research and Development Ireland Limited Registered in Ireland Registered Office: Collinstown Industrial Park, Leixlip, County Kildare Registered Number: 308263 This e-mail and any attachments may contain confidential material for the s= ole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact = the sender and delete all copies. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list