From 2ff4f67cabbefb1842b06611e4f79857fc42925a Mon Sep 17 00:00:00 2001 From: David Hildenbrand Date: Mon, 2 Jul 2018 11:41:52 +0200 Subject: [PATCH 1/2] machine: properly free device_memory Machines might have inititalized device_memory if they support memory devices, so let's properly free it. Signed-off-by: David Hildenbrand Message-Id: <20180702094152.7882-1-david@redhat.com> Reviewed-by: Igor Mammedov Signed-off-by: Eduardo Habkost --- hw/core/machine.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/core/machine.c b/hw/core/machine.c index 2077328bcc..3fad6f8801 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -674,6 +674,7 @@ static void machine_finalize(Object *obj) g_free(ms->dumpdtb); g_free(ms->dt_compatible); g_free(ms->firmware); + g_free(ms->device_memory); } bool machine_usb(MachineState *machine) From 7747abf114874537e898c60ff863828a4e82201d Mon Sep 17 00:00:00 2001 From: Dou Liyang Date: Wed, 4 Jul 2018 21:22:39 +0800 Subject: [PATCH 2/2] hw/machine: Remove the Zero check of nb_numa_nodes for numa_complete_configuration() Commit 7a3099fc9c5c("numa: postpone options post-processing till machine_run_board_init()") broke the commit 7b8be49d36fc("NUMA: Enable adding NUMA node implicitly"). The machine_run_board_init() doesn't do NUMA setup if nb_numa_nodes=0, but the numa_complete_configuration need add a new node if memory hotplug is enabled (slots > 0) even nb_numa_nodes=0. So, Remove the check for numa_complete_configuration() to fix this. Fixes 7a3099fc9c5c("numa: postpone options post-processing till machine_run_board_init()") Signed-off-by: Dou Liyang Message-Id: <20180704132239.6506-1-douly.fnst@cn.fujitsu.com> Reviewed-by: Eduardo Habkost Signed-off-by: Eduardo Habkost --- hw/core/machine.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index 3fad6f8801..a9aeb22f03 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -792,10 +792,9 @@ void machine_run_board_init(MachineState *machine) { MachineClass *machine_class = MACHINE_GET_CLASS(machine); - if (nb_numa_nodes) { - numa_complete_configuration(machine); + numa_complete_configuration(machine); + if (nb_numa_nodes) machine_numa_finish_cpu_init(machine); - } /* If the machine supports the valid_cpu_types check and the user * specified a CPU with -cpu check here that the user CPU is supported.