[libvirt] [PATCH 0/3] Libvirt memory & NUMA fixes

This patch set addresses a bunch of memory & NUMA fixes. Series Description: =========== Patch 1/3 : Use consistent data type to represent memory elements in various XML attributes. This ensures all memory elements are always represented as 'unsigned long long'. Patch 2/3 : This adds a 'unit' attribute alongwith the 'memory' attribute of a NUMA cell. This enables users to easily describe how much memory needs to be allocated to each NUMA cell for a guest domain. Patch 3/3 : This augments test cases to add the 'unit' tag. Regards, -- Prerna Saxena Linux Technology Centre, IBM Systems and Technology Lab, Bangalore, India

From 4b3e336ea045759758b04440d75802e990506e2b Mon Sep 17 00:00:00 2001 From: Prerna Saxena <prerna@linux.vnet.ibm.com> Date: Fri, 31 Oct 2014 16:07:21 +0530
Domain memory elements such as max_balloon and cur_balloon are implemented as 'unsigned long long', whereas the 'memory' element in NUMA cells is implemented as 'unsigned int'. Use the same data type (unsigned long long) for 'memory' element in NUMA cells. Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com> --- src/conf/cpu_conf.c | 4 ++-- src/conf/cpu_conf.h | 2 +- src/qemu/qemu_command.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index 9b7fbb0..5475c07 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c @@ -496,7 +496,7 @@ virCPUDefParseXML(xmlNodePtr node, goto error; } - ret = virStrToLong_ui(memory, NULL, 10, &def->cells[cur_cell].mem); + ret = virStrToLong_ull(memory, NULL, 10, &def->cells[cur_cell].mem); if (ret == -1) { virReportError(VIR_ERR_XML_ERROR, "%s", _("Invalid 'memory' attribute in NUMA cell")); @@ -702,7 +702,7 @@ virCPUDefFormatBuf(virBufferPtr buf, virBufferAddLit(buf, "<cell"); virBufferAsprintf(buf, " id='%zu'", i); virBufferAsprintf(buf, " cpus='%s'", def->cells[i].cpustr); - virBufferAsprintf(buf, " memory='%d'", def->cells[i].mem); + virBufferAsprintf(buf, " memory='%llu'", def->cells[i].mem); if (memAccess) virBufferAsprintf(buf, " memAccess='%s'", virMemAccessTypeToString(memAccess)); diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h index d45210b..5bcf101 100644 --- a/src/conf/cpu_conf.h +++ b/src/conf/cpu_conf.h @@ -105,7 +105,7 @@ typedef virCellDef *virCellDefPtr; struct _virCellDef { virBitmapPtr cpumask; /* CPUs that are part of this node */ char *cpustr; /* CPUs stored in string form for dumpxml */ - unsigned int mem; /* Node memory in kB */ + unsigned long long mem; /* Node memory in kB */ virMemAccess memAccess; }; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 917639e..13b54dd 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6693,7 +6693,7 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg, } for (i = 0; i < def->cpu->ncells; i++) { - int cellmem = VIR_DIV_UP(def->cpu->cells[i].mem, 1024); + unsigned long long cellmem = VIR_DIV_UP(def->cpu->cells[i].mem, 1024); def->cpu->cells[i].mem = cellmem * 1024; virMemAccess memAccess = def->cpu->cells[i].memAccess; @@ -6799,7 +6799,7 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg, virBufferAddLit(&buf, "memory-backend-ram"); } - virBufferAsprintf(&buf, ",size=%dM,id=ram-node%zu", cellmem, i); + virBufferAsprintf(&buf, ",size=%lluM,id=ram-node%zu", cellmem, i); if (virDomainNumatuneMaybeFormatNodeset(def->numatune, nodeset, &nodemask, i) < 0) @@ -6849,7 +6849,7 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg, virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_FILE)) { virBufferAsprintf(&buf, ",memdev=ram-node%zu", i); } else { - virBufferAsprintf(&buf, ",mem=%d", cellmem); + virBufferAsprintf(&buf, ",mem=%llu", cellmem); } virCommandAddArgBuffer(cmd, &buf); -- 1.9.3 -- Prerna Saxena Linux Technology Centre, IBM Systems and Technology Lab, Bangalore, India

On 05.11.2014 11:58, Prerna Saxena wrote:
From 4b3e336ea045759758b04440d75802e990506e2b Mon Sep 17 00:00:00 2001 From: Prerna Saxena <prerna@linux.vnet.ibm.com> Date: Fri, 31 Oct 2014 16:07:21 +0530
Domain memory elements such as max_balloon and cur_balloon are implemented as 'unsigned long long', whereas the 'memory' element in NUMA cells is implemented as 'unsigned int'.
Use the same data type (unsigned long long) for 'memory' element in NUMA cells.
Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com> --- src/conf/cpu_conf.c | 4 ++-- src/conf/cpu_conf.h | 2 +- src/qemu/qemu_command.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index 9b7fbb0..5475c07 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c @@ -496,7 +496,7 @@ virCPUDefParseXML(xmlNodePtr node, goto error; }
- ret = virStrToLong_ui(memory, NULL, 10, &def->cells[cur_cell].mem); + ret = virStrToLong_ull(memory, NULL, 10, &def->cells[cur_cell].mem); if (ret == -1) { virReportError(VIR_ERR_XML_ERROR, "%s", _("Invalid 'memory' attribute in NUMA cell")); @@ -702,7 +702,7 @@ virCPUDefFormatBuf(virBufferPtr buf, virBufferAddLit(buf, "<cell"); virBufferAsprintf(buf, " id='%zu'", i); virBufferAsprintf(buf, " cpus='%s'", def->cells[i].cpustr); - virBufferAsprintf(buf, " memory='%d'", def->cells[i].mem); + virBufferAsprintf(buf, " memory='%llu'", def->cells[i].mem); if (memAccess) virBufferAsprintf(buf, " memAccess='%s'", virMemAccessTypeToString(memAccess)); diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h index d45210b..5bcf101 100644 --- a/src/conf/cpu_conf.h +++ b/src/conf/cpu_conf.h @@ -105,7 +105,7 @@ typedef virCellDef *virCellDefPtr; struct _virCellDef { virBitmapPtr cpumask; /* CPUs that are part of this node */ char *cpustr; /* CPUs stored in string form for dumpxml */ - unsigned int mem; /* Node memory in kB */ + unsigned long long mem; /* Node memory in kB */ virMemAccess memAccess; };
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 917639e..13b54dd 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6693,7 +6693,7 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg, }
for (i = 0; i < def->cpu->ncells; i++) { - int cellmem = VIR_DIV_UP(def->cpu->cells[i].mem, 1024); + unsigned long long cellmem = VIR_DIV_UP(def->cpu->cells[i].mem, 1024); def->cpu->cells[i].mem = cellmem * 1024; virMemAccess memAccess = def->cpu->cells[i].memAccess;
@@ -6799,7 +6799,7 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg, virBufferAddLit(&buf, "memory-backend-ram"); }
- virBufferAsprintf(&buf, ",size=%dM,id=ram-node%zu", cellmem, i); + virBufferAsprintf(&buf, ",size=%lluM,id=ram-node%zu", cellmem, i);
if (virDomainNumatuneMaybeFormatNodeset(def->numatune, nodeset, &nodemask, i) < 0) @@ -6849,7 +6849,7 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg, virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_FILE)) { virBufferAsprintf(&buf, ",memdev=ram-node%zu", i); } else { - virBufferAsprintf(&buf, ",mem=%d", cellmem); + virBufferAsprintf(&buf, ",mem=%llu", cellmem); }
virCommandAddArgBuffer(cmd, &buf);
ACKed & pushed as this doesn't depend on the rest of the patches. Michal

From 7fe8487c5e8d24086637d2157bad25322b3654f7 Mon Sep 17 00:00:00 2001 From: Prerna Saxena <prerna@linux.vnet.ibm.com> Date: Mon, 3 Nov 2014 07:53:59 +0530
CPU numa topology implicitly allows memory specification in 'KiB'. Enabling this to accept the 'unit' in which memory needs to be specified. This now allows users to specify memory in units of choice, and lists the same in 'KiB' -- just like other 'memory' elements in XML. <numa> <cell cpus='0-3' memory='1024' unit='MiB' /> <cell cpus='4-7' memory='1024' unit='MiB' /> </numa> I wanted to use virDomainParseScaledValue(), but that function implicitly assumes an XML layout where 'memory' is an _element_ of type 'scaledInteger', with 'unit' as its attribute. A NUMA cell has XML specification where 'memory' is an _attribute_ of element 'cell'. Since changing XML layout is not an option, I have borrowed code from the same. Looking forward to suggestions on how this can best be done. Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com> --- docs/schemas/domaincommon.rng | 5 +++++ src/conf/cpu_conf.c | 36 ++++++++++++++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 20d81ae..44cabad 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -4144,6 +4144,11 @@ <ref name="memoryKB"/> </attribute> <optional> + <attribute name="unit"> + <ref name="unit"/> + </attribute> + </optional> + <optional> <attribute name="memAccess"> <choice> <value>shared</value> diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index 5475c07..65b9815 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c @@ -189,6 +189,7 @@ virCPUDefParseXML(xmlNodePtr node, char *cpuMode; char *fallback = NULL; char *vendor_id = NULL; + unsigned long long max; if (!xmlStrEqual(node->name, BAD_CAST "cpu")) { virReportError(VIR_ERR_XML_ERROR, "%s", @@ -439,10 +440,20 @@ virCPUDefParseXML(xmlNodePtr node, def->ncells = n; + /* 32 vs 64 bit will differ in value of upper memory bound. + * On 32-bit machines, our bound is 0xffffffff * KiB. On 64-bit + * machines, our bound is off_t (2^63). + */ + if (sizeof(unsigned long) < sizeof(long long)) + max = 1024ull * ULONG_MAX; + else + max = LLONG_MAX; + for (i = 0; i < n; i++) { - char *cpus, *memory, *memAccessStr; + char *cpus, *memory, *memAccessStr, *unit; int ret, ncpus = 0; unsigned int cur_cell; + unsigned long long bytes; char *tmp = NULL; tmp = virXMLPropString(nodes[i], "id"); @@ -496,14 +507,34 @@ virCPUDefParseXML(xmlNodePtr node, goto error; } - ret = virStrToLong_ull(memory, NULL, 10, &def->cells[cur_cell].mem); + ret = virStrToLong_ull(memory, NULL, 10, &bytes); if (ret == -1) { virReportError(VIR_ERR_XML_ERROR, "%s", _("Invalid 'memory' attribute in NUMA cell")); VIR_FREE(memory); goto error; } + + unit = virXMLPropString(nodes[i], "unit"); + if (!unit) { + if (VIR_STRDUP(unit, "KiB") < 0) + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Error processing 'memory' in NUMA cell")); + } + + if (virScaleInteger(&bytes, unit, 1024, max) < 0) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("Error scaling 'memory' in NUMA cell")); + VIR_FREE(memory); + VIR_FREE(unit); + goto error; + } + + def->cells[cur_cell].mem = VIR_DIV_UP(bytes, 1024); + + bytes = 0; VIR_FREE(memory); + VIR_FREE(unit); memAccessStr = virXMLPropString(nodes[i], "memAccess"); if (memAccessStr) { @@ -703,6 +734,7 @@ virCPUDefFormatBuf(virBufferPtr buf, virBufferAsprintf(buf, " id='%zu'", i); virBufferAsprintf(buf, " cpus='%s'", def->cells[i].cpustr); virBufferAsprintf(buf, " memory='%llu'", def->cells[i].mem); + virBufferAddLit(buf, " unit='KiB'"); if (memAccess) virBufferAsprintf(buf, " memAccess='%s'", virMemAccessTypeToString(memAccess)); -- 1.9.3 -- Prerna Saxena Linux Technology Centre, IBM Systems and Technology Lab, Bangalore, India

On 05.11.2014 12:06, Prerna Saxena wrote:
From 7fe8487c5e8d24086637d2157bad25322b3654f7 Mon Sep 17 00:00:00 2001 From: Prerna Saxena <prerna@linux.vnet.ibm.com> Date: Mon, 3 Nov 2014 07:53:59 +0530
CPU numa topology implicitly allows memory specification in 'KiB'.
Enabling this to accept the 'unit' in which memory needs to be specified. This now allows users to specify memory in units of choice, and lists the same in 'KiB' -- just like other 'memory' elements in XML.
<numa> <cell cpus='0-3' memory='1024' unit='MiB' /> <cell cpus='4-7' memory='1024' unit='MiB' /> </numa>
I wanted to use virDomainParseScaledValue(), but that function implicitly assumes an XML layout where 'memory' is an _element_ of type 'scaledInteger', with 'unit' as its attribute. A NUMA cell has XML specification where 'memory' is an _attribute_ of element 'cell'. Since changing XML layout is not an option, I have borrowed code from the same.
Yeah, I did the same in virDomainHugepagesParseXML. Maybe you can rename it to something more generic and reuse it here?
Looking forward to suggestions on how this can best be done.
Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com> --- docs/schemas/domaincommon.rng | 5 +++++ src/conf/cpu_conf.c | 36 ++++++++++++++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 2 deletions(-)
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 20d81ae..44cabad 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -4144,6 +4144,11 @@ <ref name="memoryKB"/> </attribute> <optional> + <attribute name="unit"> + <ref name="unit"/> + </attribute> + </optional> + <optional>
Any XML change requires docs update. I can't ACK this with lacking documentation, sorry.
<attribute name="memAccess"> <choice> <value>shared</value> diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index 5475c07..65b9815 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c @@ -189,6 +189,7 @@ virCPUDefParseXML(xmlNodePtr node, char *cpuMode; char *fallback = NULL; char *vendor_id = NULL; + unsigned long long max;
if (!xmlStrEqual(node->name, BAD_CAST "cpu")) { virReportError(VIR_ERR_XML_ERROR, "%s", @@ -439,10 +440,20 @@ virCPUDefParseXML(xmlNodePtr node,
def->ncells = n;
+ /* 32 vs 64 bit will differ in value of upper memory bound. + * On 32-bit machines, our bound is 0xffffffff * KiB. On 64-bit + * machines, our bound is off_t (2^63). + */ + if (sizeof(unsigned long) < sizeof(long long)) + max = 1024ull * ULONG_MAX; + else + max = LLONG_MAX; + for (i = 0; i < n; i++) { - char *cpus, *memory, *memAccessStr; + char *cpus, *memory, *memAccessStr, *unit; int ret, ncpus = 0; unsigned int cur_cell; + unsigned long long bytes; char *tmp = NULL;
tmp = virXMLPropString(nodes[i], "id"); @@ -496,14 +507,34 @@ virCPUDefParseXML(xmlNodePtr node, goto error; }
- ret = virStrToLong_ull(memory, NULL, 10, &def->cells[cur_cell].mem); + ret = virStrToLong_ull(memory, NULL, 10, &bytes); if (ret == -1) { virReportError(VIR_ERR_XML_ERROR, "%s", _("Invalid 'memory' attribute in NUMA cell")); VIR_FREE(memory); goto error; } + + unit = virXMLPropString(nodes[i], "unit"); + if (!unit) { + if (VIR_STRDUP(unit, "KiB") < 0) + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Error processing 'memory' in NUMA cell")); + } + + if (virScaleInteger(&bytes, unit, 1024, max) < 0) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("Error scaling 'memory' in NUMA cell")); + VIR_FREE(memory); + VIR_FREE(unit); + goto error; + } + + def->cells[cur_cell].mem = VIR_DIV_UP(bytes, 1024); + + bytes = 0; VIR_FREE(memory); + VIR_FREE(unit);
memAccessStr = virXMLPropString(nodes[i], "memAccess"); if (memAccessStr) { @@ -703,6 +734,7 @@ virCPUDefFormatBuf(virBufferPtr buf, virBufferAsprintf(buf, " id='%zu'", i); virBufferAsprintf(buf, " cpus='%s'", def->cells[i].cpustr); virBufferAsprintf(buf, " memory='%llu'", def->cells[i].mem); + virBufferAddLit(buf, " unit='KiB'"); if (memAccess) virBufferAsprintf(buf, " memAccess='%s'", virMemAccessTypeToString(memAccess));
Michal

From 2fe0e329e7224b7cd29e1252e4b4e70d9195ab2b Mon Sep 17 00:00:00 2001 From: Prerna Saxena <prerna@linux.vnet.ibm.com> Date: Mon, 3 Nov 2014 15:16:12 +0530
This adds the tag 'unit="KiB"' for memory attribute in NUMA cells. Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com> --- tests/qemuxml2argvdata/qemuxml2argv-cpu-numa-disjoint.xml | 4 ++-- tests/qemuxml2argvdata/qemuxml2argv-cpu-numa-memshared.xml | 4 ++-- tests/qemuxml2argvdata/qemuxml2argv-cpu-numa1.xml | 4 ++-- tests/qemuxml2argvdata/qemuxml2argv-cpu-numa2.xml | 4 ++-- tests/qemuxml2argvdata/qemuxml2argv-cpu-numa3.xml | 4 ++-- tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages.xml | 8 ++++---- tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages2.xml | 4 ++-- tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages3.xml | 4 ++-- tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages4.xml | 8 ++++---- tests/qemuxml2argvdata/qemuxml2argv-hugepages-shared.xml | 8 ++++---- tests/qemuxml2argvdata/qemuxml2argv-numatune-auto-prefer.xml | 2 +- .../qemuxml2argvdata/qemuxml2argv-numatune-memnode-no-memory.xml | 4 ++-- tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode.xml | 6 +++--- .../qemuxml2argv-numatune-memnodes-problematic.xml | 4 ++-- tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa1.xml | 4 ++-- tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa2.xml | 4 ++-- tests/qemuxml2xmloutdata/qemuxml2xmlout-numatune-auto-prefer.xml | 2 +- tests/qemuxml2xmloutdata/qemuxml2xmlout-numatune-memnode.xml | 6 +++--- 18 files changed, 42 insertions(+), 42 deletions(-) diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa-disjoint.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa-disjoint.xml index 474a238..bdffcd1 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa-disjoint.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa-disjoint.xml @@ -11,8 +11,8 @@ <cpu> <topology sockets='2' cores='4' threads='2'/> <numa> - <cell id='0' cpus='0-3,8-11' memory='109550'/> - <cell id='1' cpus='4-7,12-15' memory='109550'/> + <cell id='0' cpus='0-3,8-11' memory='109550' unit='KiB'/> + <cell id='1' cpus='4-7,12-15' memory='109550' unit='KiB'/> </numa> </cpu> <clock offset='utc'/> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa-memshared.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa-memshared.xml index cf7c040..c638ffa 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa-memshared.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa-memshared.xml @@ -11,8 +11,8 @@ <cpu> <topology sockets='2' cores='4' threads='2'/> <numa> - <cell id='0' cpus='0-7' memory='109550' memAccess='shared'/> - <cell id='1' cpus='8-15' memory='109550' memAccess='private'/> + <cell id='0' cpus='0-7' memory='109550' unit='KiB' memAccess='shared'/> + <cell id='1' cpus='8-15' memory='109550' unit='KiB' memAccess='private'/> </numa> </cpu> <clock offset='utc'/> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa1.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa1.xml index 0543f7f..20120e9 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa1.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa1.xml @@ -11,8 +11,8 @@ <cpu> <topology sockets='2' cores='4' threads='2'/> <numa> - <cell cpus='0-7' memory='109550'/> - <cell cpus='8-15' memory='109550'/> + <cell cpus='0-7' memory='109550' unit='KiB'/> + <cell cpus='8-15' memory='109550' unit='KiB'/> </numa> </cpu> <clock offset='utc'/> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa2.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa2.xml index 0a5f9fc..a90e7a2 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa2.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa2.xml @@ -11,8 +11,8 @@ <cpu> <topology sockets='2' cores='4' threads='2'/> <numa> - <cell id='1' cpus='8-15' memory='109550'/> - <cell id='0' cpus='0-7' memory='109550'/> + <cell id='1' cpus='8-15' memory='109550' unit='KiB'/> + <cell id='0' cpus='0-7' memory='109550' unit='KiB'/> </numa> </cpu> <clock offset='utc'/> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa3.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa3.xml index fa3070d..ea2dc81 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa3.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa3.xml @@ -11,8 +11,8 @@ <cpu> <topology sockets='2' cores='4' threads='2'/> <numa> - <cell id='1' cpus='0-7' memory='109550'/> - <cell id='2' cpus='8-15' memory='109550'/> + <cell id='1' cpus='0-7' memory='109550' unit='KiB'/> + <cell id='2' cpus='8-15' memory='109550' unit='KiB'/> </numa> </cpu> <clock offset='utc'/> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages.xml b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages.xml index 5ad0695..b67df2f 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages.xml @@ -20,10 +20,10 @@ </os> <cpu> <numa> - <cell id='0' cpus='0' memory='1048576'/> - <cell id='1' cpus='1' memory='1048576'/> - <cell id='2' cpus='2' memory='1048576'/> - <cell id='3' cpus='3' memory='1048576'/> + <cell id='0' cpus='0' memory='1048576' unit='KiB'/> + <cell id='1' cpus='1' memory='1048576' unit='KiB'/> + <cell id='2' cpus='2' memory='1048576' unit='KiB'/> + <cell id='3' cpus='3' memory='1048576' unit='KiB'/> </numa> </cpu> <clock offset='utc'/> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages2.xml b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages2.xml index 3df870b..6afa6ef 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages2.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages2.xml @@ -15,8 +15,8 @@ </os> <cpu> <numa> - <cell id='0' cpus='0' memory='262144'/> - <cell id='1' cpus='1' memory='786432'/> + <cell id='0' cpus='0' memory='262144' unit='KiB'/> + <cell id='1' cpus='1' memory='786432' unit='KiB'/> </numa> </cpu> <clock offset='utc'/> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages3.xml b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages3.xml index 35aa2cf..21f4985 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages3.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages3.xml @@ -15,8 +15,8 @@ </os> <cpu> <numa> - <cell id='0' cpus='0' memory='262144'/> - <cell id='1' cpus='1' memory='786432'/> + <cell id='0' cpus='0' memory='262144' unit='KiB'/> + <cell id='1' cpus='1' memory='786432' unit='KiB'/> </numa> </cpu> <clock offset='utc'/> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages4.xml b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages4.xml index a3ed29b..eb18f24 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages4.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages4.xml @@ -20,10 +20,10 @@ </os> <cpu> <numa> - <cell id='0' cpus='0' memory='1048576'/> - <cell id='1' cpus='1' memory='1048576'/> - <cell id='2' cpus='2' memory='1048576'/> - <cell id='3' cpus='3' memory='1048576'/> + <cell id='0' cpus='0' memory='1048576' unit='KiB'/> + <cell id='1' cpus='1' memory='1048576' unit='KiB'/> + <cell id='2' cpus='2' memory='1048576' unit='KiB'/> + <cell id='3' cpus='3' memory='1048576' unit='KiB'/> </numa> </cpu> <clock offset='utc'/> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hugepages-shared.xml b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-shared.xml index e7db69c..52ca2f9 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-hugepages-shared.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-shared.xml @@ -20,10 +20,10 @@ </os> <cpu> <numa> - <cell id='0' cpus='0' memory='1048576'/> - <cell id='1' cpus='1' memory='1048576' memAccess='shared'/> - <cell id='2' cpus='2' memory='1048576' memAccess='private'/> - <cell id='3' cpus='3' memory='1048576'/> + <cell id='0' cpus='0' memory='1048576' unit='KiB'/> + <cell id='1' cpus='1' memory='1048576' unit='KiB' memAccess='shared'/> + <cell id='2' cpus='2' memory='1048576' unit='KiB' memAccess='private'/> + <cell id='3' cpus='3' memory='1048576' unit='KiB'/> </numa> </cpu> <clock offset='utc'/> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-numatune-auto-prefer.xml b/tests/qemuxml2argvdata/qemuxml2argv-numatune-auto-prefer.xml index 63f0d1f..8f80962 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-numatune-auto-prefer.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-numatune-auto-prefer.xml @@ -13,7 +13,7 @@ </os> <cpu> <numa> - <cell id='0' cpus='0' memory='65536'/> + <cell id='0' cpus='0' memory='65536' unit='KiB'/> </numa> </cpu> <clock offset='utc'/> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode-no-memory.xml b/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode-no-memory.xml index 4b2efa2..886a07a 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode-no-memory.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode-no-memory.xml @@ -13,8 +13,8 @@ </os> <cpu> <numa> - <cell id='0' cpus='0' memory='32768'/> - <cell id='1' cpus='1' memory='32768'/> + <cell id='0' cpus='0' memory='32768' unit='KiB'/> + <cell id='1' cpus='1' memory='32768' unit='KiB'/> </numa> </cpu> <clock offset='utc'/> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode.xml b/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode.xml index 440413b..8912017 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode.xml @@ -15,9 +15,9 @@ </os> <cpu> <numa> - <cell id='0' cpus='0' memory='20002'/> - <cell id='1' cpus='1-27,29' memory='660066'/> - <cell id='2' cpus='28-31,^29' memory='24002400'/> + <cell id='0' cpus='0' memory='20002' unit='KiB'/> + <cell id='1' cpus='1-27,29' memory='660066' unit='KiB'/> + <cell id='2' cpus='28-31,^29' memory='24002400' unit='KiB'/> </numa> </cpu> <clock offset='utc'/> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnodes-problematic.xml b/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnodes-problematic.xml index bb4e4af..e1d115c 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnodes-problematic.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnodes-problematic.xml @@ -14,8 +14,8 @@ </os> <cpu> <numa> - <cell id='0' cpus='0' memory='32768'/> - <cell id='1' cpus='1' memory='32768'/> + <cell id='0' cpus='0' memory='32768' unit='KiB'/> + <cell id='1' cpus='1' memory='32768' unit='KiB'/> </numa> </cpu> <clock offset='utc'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa1.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa1.xml index 227bf1c..58f40b9 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa1.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa1.xml @@ -11,8 +11,8 @@ <cpu> <topology sockets='2' cores='4' threads='2'/> <numa> - <cell id='0' cpus='0-7' memory='109550'/> - <cell id='1' cpus='8-15' memory='109550'/> + <cell id='0' cpus='0-7' memory='109550' unit='KiB'/> + <cell id='1' cpus='8-15' memory='109550' unit='KiB'/> </numa> </cpu> <clock offset='utc'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa2.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa2.xml index 227bf1c..58f40b9 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa2.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa2.xml @@ -11,8 +11,8 @@ <cpu> <topology sockets='2' cores='4' threads='2'/> <numa> - <cell id='0' cpus='0-7' memory='109550'/> - <cell id='1' cpus='8-15' memory='109550'/> + <cell id='0' cpus='0-7' memory='109550' unit='KiB'/> + <cell id='1' cpus='8-15' memory='109550' unit='KiB'/> </numa> </cpu> <clock offset='utc'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-numatune-auto-prefer.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-numatune-auto-prefer.xml index 19761b4..1000e9f 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-numatune-auto-prefer.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-numatune-auto-prefer.xml @@ -13,7 +13,7 @@ </os> <cpu> <numa> - <cell id='0' cpus='0' memory='65536'/> + <cell id='0' cpus='0' memory='65536' unit='KiB'/> </numa> </cpu> <clock offset='utc'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-numatune-memnode.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-numatune-memnode.xml index 82b5f61..ffc57cf 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-numatune-memnode.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-numatune-memnode.xml @@ -15,9 +15,9 @@ </os> <cpu> <numa> - <cell id='0' cpus='0' memory='20002'/> - <cell id='1' cpus='1-27,29' memory='660066'/> - <cell id='2' cpus='28-31,^29' memory='24002400'/> + <cell id='0' cpus='0' memory='20002' unit='KiB'/> + <cell id='1' cpus='1-27,29' memory='660066' unit='KiB'/> + <cell id='2' cpus='28-31,^29' memory='24002400' unit='KiB'/> </numa> </cpu> <clock offset='utc'/> -- 1.9.3 -- Prerna Saxena Linux Technology Centre, IBM Systems and Technology Lab, Bangalore, India

On 05.11.2014 11:56, Prerna Saxena wrote:
This patch set addresses a bunch of memory & NUMA fixes.
Series Description: =========== Patch 1/3 : Use consistent data type to represent memory elements in various XML attributes. This ensures all memory elements are always represented as 'unsigned long long'. Patch 2/3 : This adds a 'unit' attribute alongwith the 'memory' attribute of a NUMA cell. This enables users to easily describe how much memory needs to be allocated to each NUMA cell for a guest domain. Patch 3/3 : This augments test cases to add the 'unit' tag.
Regards,
The 2/3 and 3/3 should be merged together so that 'make check' won't fail after 2/3. Otherwise looking good. I've merged 1/3 already. Michal

On Wednesday 05 November 2014 08:40 PM, Michal Privoznik wrote:
On 05.11.2014 11:56, Prerna Saxena wrote:
This patch set addresses a bunch of memory & NUMA fixes.
Series Description: =========== Patch 1/3 : Use consistent data type to represent memory elements in various XML attributes. This ensures all memory elements are always represented as 'unsigned long long'. Patch 2/3 : This adds a 'unit' attribute alongwith the 'memory' attribute of a NUMA cell. This enables users to easily describe how much memory needs to be allocated to each NUMA cell for a guest domain. Patch 3/3 : This augments test cases to add the 'unit' tag.
Regards,
The 2/3 and 3/3 should be merged together so that 'make check' won't fail after 2/3. Otherwise looking good. I've merged 1/3 already.
Thanks Michal ! I'll merge the remaining two and send out a cumulative patch :) Regards, -- Prerna Saxena Linux Technology Centre, IBM Systems and Technology Lab, Bangalore, India
participants (2)
-
Michal Privoznik
-
Prerna Saxena