From: Igor Mammedov <imammedo@redhat.com>
To: qemu-devel@nongnu.org
Cc: eblake@redhat.com, armbru@redhat.com, ehabkost@redhat.com,
pkrempa@redhat.com, david@gibson.dropbear.id.au,
peter.maydell@linaro.org, pbonzini@redhat.com
Subject: [Qemu-devel] [RFC v2 4/4] numa: pc: reset machine if numa config has changed in prelaunch time
Date: Thu, 28 Dec 2017 18:22:59 +0100 [thread overview]
Message-ID: <1514481779-184817-5-git-send-email-imammedo@redhat.com> (raw)
In-Reply-To: <1514481779-184817-1-git-send-email-imammedo@redhat.com>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
include/hw/boards.h | 1 +
hw/core/machine.c | 2 +-
hw/i386/pc.c | 1 +
numa.c | 14 +++++++++++---
vl.c | 4 ++++
5 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 156b16f..9b3ec6a 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -62,6 +62,7 @@ MachineClass *find_default_machine(void);
extern MachineState *current_machine;
void machine_run_board_init(MachineState *machine);
+void machine_numa_finish_init(MachineState *machine);
bool machine_usb(MachineState *machine);
bool machine_kernel_irqchip_allowed(MachineState *machine);
bool machine_kernel_irqchip_required(MachineState *machine);
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 212dfec..120b7ca 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -701,7 +701,7 @@ static char *cpu_slot_to_string(const CPUArchId *cpu)
return g_string_free(s, false);
}
-static void machine_numa_finish_init(MachineState *machine)
+void machine_numa_finish_init(MachineState *machine)
{
int i;
bool default_mapping;
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 3fcf318..6c91554 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -2244,6 +2244,7 @@ static void pc_machine_reset(void)
CPUState *cs;
X86CPU *cpu;
+ parse_numa_opts(MACHINE(qdev_get_machine()));
qemu_devices_reset();
/* Reset APIC after devices have been reset to cancel
diff --git a/numa.c b/numa.c
index fd2bf1c..83eaaea 100644
--- a/numa.c
+++ b/numa.c
@@ -53,7 +53,7 @@ static int max_numa_nodeid; /* Highest specified NUMA node ID, plus one.
int nb_numa_nodes;
bool have_numa_distance;
NodeInfo numa_info[MAX_NODES];
-
+static bool numa_inited;
static void parse_numa_node(MachineState *ms, NumaNodeOptions *node,
Error **errp)
@@ -173,6 +173,11 @@ void parse_NumaOptions(MachineState *ms, NumaOptions *object, Error **errp)
{
Error *err = NULL;
+ if (numa_inited && runstate_check(RUN_STATE_PRELAUNCH)) {
+ qemu_system_reset_request(SHUTDOWN_CAUSE_HOST_QMP);
+ }
+ numa_inited = false;
+
switch (object->type) {
case NUMA_OPTIONS_TYPE_NODE:
parse_numa_node(ms, &object->u.node, &err);
@@ -352,9 +357,10 @@ void parse_numa_opts(MachineState *ms)
int i;
MachineClass *mc = MACHINE_GET_CLASS(ms);
- if (qemu_opts_foreach(qemu_find_opts("numa"), parse_numa, ms, NULL)) {
- exit(1);
+ if (numa_inited) {
+ return;
}
+ numa_inited = true;
/*
* If memory hotplug is enabled (slots > 0) but without '-numa'
@@ -439,6 +445,8 @@ void parse_numa_opts(MachineState *ms)
/* Validation succeeded, now fill in any missing distances. */
complete_init_numa_distance();
}
+
+ machine_numa_finish_init(ms);
}
}
diff --git a/vl.c b/vl.c
index d3a5c5d..9e00604 100644
--- a/vl.c
+++ b/vl.c
@@ -4690,6 +4690,10 @@ int main(int argc, char **argv, char **envp)
current_machine->boot_order = boot_order;
current_machine->cpu_model = cpu_model;
+ if (qemu_opts_foreach(qemu_find_opts("numa"), parse_numa,
+ current_machine, NULL)) {
+ exit(1);
+ }
parse_numa_opts(current_machine);
/* parse features once if machine provides default cpu_type */
--
2.7.4
next prev parent reply other threads:[~2017-12-28 17:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-28 17:22 [Qemu-devel] [RFC v2 0/4] enable numa configuration before machine is running from HMP/QMP Igor Mammedov
2017-12-28 17:22 ` [Qemu-devel] [RFC v2 1/4] numa: split out NumaOptions parsing into parse_NumaOptions() Igor Mammedov
2017-12-28 17:22 ` [Qemu-devel] [RFC v2 2/4] HMP: add set-numa-node command Igor Mammedov
2017-12-28 17:22 ` [Qemu-devel] [RFC v2 3/4] QMP: " Igor Mammedov
2017-12-28 17:22 ` Igor Mammedov [this message]
2018-01-03 5:52 ` [Qemu-devel] [RFC v2 0/4] enable numa configuration before machine is running from HMP/QMP David Gibson
2018-01-03 14:17 ` Markus Armbruster
2018-01-08 8:35 ` Igor Mammedov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1514481779-184817-5-git-send-email-imammedo@redhat.com \
--to=imammedo@redhat.com \
--cc=armbru@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=eblake@redhat.com \
--cc=ehabkost@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=pkrempa@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).