[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 38/39] numa: fixup parsed NumaNodeOptions earlier
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [PULL 38/39] numa: fixup parsed NumaNodeOptions earlier |
Date: |
Thu, 26 Oct 2017 16:04:03 +0200 |
From: Igor Mammedov <address@hidden>
numa 'mem' option with suffix or without one is possible
only on CLI/HMP. Instead of fixing up special suffix less
CLI case deep in parse_numa_node() do it earlier right
after option is parsed into NumaNodeOptions with OptVisistor
so that the rest of the code would use valid values in
NumaNodeOptions and won't have to reparse QemuOpts.
It will help to isolate CLI/HMP parts in parse_numa() and
split out parsed NumaNodeOptions processing into separate
function that could be reused by QMP handler where we have
only NumaNodeOptions and don't need any fixups.
While at it reuse qemu_strtosz_MiB() instead of manually
checking for suffixes.
Signed-off-by: Igor Mammedov <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Eduardo Habkost <address@hidden>
Signed-off-by: Eduardo Habkost <address@hidden>
---
numa.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/numa.c b/numa.c
index 100a67febf..8d78d959f6 100644
--- a/numa.c
+++ b/numa.c
@@ -38,6 +38,7 @@
#include "hw/mem/pc-dimm.h"
#include "qemu/option.h"
#include "qemu/config-file.h"
+#include "qemu/cutils.h"
QemuOptsList qemu_numa_opts = {
.name = "numa",
@@ -142,7 +143,7 @@ uint32_t numa_get_node(ram_addr_t addr, Error **errp)
}
static void parse_numa_node(MachineState *ms, NumaNodeOptions *node,
- QemuOpts *opts, Error **errp)
+ Error **errp)
{
uint16_t nodenr;
uint16List *cpus = NULL;
@@ -199,13 +200,7 @@ static void parse_numa_node(MachineState *ms,
NumaNodeOptions *node,
}
if (node->has_mem) {
- uint64_t mem_size = node->mem;
- const char *mem_str = qemu_opt_get(opts, "mem");
- /* Fix up legacy suffix-less format */
- if (g_ascii_isdigit(mem_str[strlen(mem_str) - 1])) {
- mem_size <<= 20;
- }
- numa_info[nodenr].node_mem = mem_size;
+ numa_info[nodenr].node_mem = node->mem;
}
if (node->has_memdev) {
Object *o;
@@ -275,9 +270,15 @@ static int parse_numa(void *opaque, QemuOpts *opts, Error
**errp)
goto end;
}
+ /* Fix up legacy suffix-less format */
+ if ((object->type == NUMA_OPTIONS_TYPE_NODE) && object->u.node.has_mem) {
+ const char *mem_str = qemu_opt_get(opts, "mem");
+ qemu_strtosz_MiB(mem_str, NULL, &object->u.node.mem);
+ }
+
switch (object->type) {
case NUMA_OPTIONS_TYPE_NODE:
- parse_numa_node(ms, &object->u.node, opts, &err);
+ parse_numa_node(ms, &object->u.node, &err);
if (err) {
goto end;
}
--
2.13.6
- [Qemu-devel] [PULL 27/39] tricore: use generic cpu_model parsing, (continued)
- [Qemu-devel] [PULL 27/39] tricore: use generic cpu_model parsing, Eduardo Habkost, 2017/10/26
- [Qemu-devel] [PULL 30/39] sparc: sparc: use generic cpu_model parsing, Eduardo Habkost, 2017/10/26
- [Qemu-devel] [PULL 29/39] sparc: sun4u/sun4v/niagara: use generic cpu_model parsing, Eduardo Habkost, 2017/10/26
- [Qemu-devel] [PULL 31/39] sparc: leon3: use generic cpu_model parsing, Eduardo Habkost, 2017/10/26
- [Qemu-devel] [PULL 32/39] mips: use object_new() instead of gnew()+object_initialize(), Eduardo Habkost, 2017/10/26
- [Qemu-devel] [PULL 33/39] mips: malta/boston: replace cpu_model with cpu_type, Eduardo Habkost, 2017/10/26
- [Qemu-devel] [PULL 34/39] mips: fulong2e: replace cpu_model with cpu_type, Eduardo Habkost, 2017/10/26
- [Qemu-devel] [PULL 35/39] mips: Magnum/Acer Pica 61: replace cpu_model with cpu_type, Eduardo Habkost, 2017/10/26
- [Qemu-devel] [PULL 37/39] mips: r4k: replace cpu_model with cpu_type, Eduardo Habkost, 2017/10/26
- [Qemu-devel] [PULL 36/39] mips: mipssim: replace cpu_model with cpu_type, Eduardo Habkost, 2017/10/26
- [Qemu-devel] [PULL 38/39] numa: fixup parsed NumaNodeOptions earlier,
Eduardo Habkost <=
- [Qemu-devel] [PULL 39/39] x86: Skip check apic_id_limit for Xen, Eduardo Habkost, 2017/10/26
- Re: [Qemu-devel] [PULL 00/39] x86/cpu/numa queue, 2017-10-26, Peter Maydell, 2017/10/27