yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
902636
From e3a1c2ff0d7b930b1782d59d093fd15471d3aee1 Mon Sep 17 00:00:00 2001
902636
From: "plai@redhat.com" <plai@redhat.com>
902636
Date: Thu, 21 May 2020 23:56:46 +0100
902636
Subject: [PATCH 03/12] numa: properly check if numa is supported
902636
902636
RH-Author: plai@redhat.com
902636
Message-id: <20200521235655.27141-3-plai@redhat.com>
902636
Patchwork-id: 96732
902636
O-Subject: [RHEL8.2.1 AV qemu-kvm PATCH 02/11] numa: properly check if numa is supported
902636
Bugzilla: 1600217
902636
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
902636
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
902636
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
902636
902636
From: Igor Mammedov <imammedo@redhat.com>
902636
902636
Commit aa57020774b, by mistake used MachineClass::numa_mem_supported
902636
to check if NUMA is supported by machine and also as unrelated change
902636
set it to true for sbsa-ref board.
902636
902636
Luckily change didn't break machines that support NUMA, as the field
902636
is set to true for them.
902636
902636
But the field is not intended for checking if NUMA is supported and
902636
will be flipped to false within this release for new machine types.
902636
902636
Fix it:
902636
 - by using previously used condition
902636
      !mc->cpu_index_to_instance_props || !mc->get_default_cpu_node_id
902636
   the first time and then use MachineState::numa_state down the road
902636
   to check if NUMA is supported
902636
 - dropping stray sbsa-ref chunk
902636
902636
Fixes: aa57020774b690a22be72453b8e91c9b5a68c516
902636
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
902636
Message-Id: <1576154936-178362-3-git-send-email-imammedo@redhat.com>
902636
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
902636
(cherry picked from commit fcd3f2cc124600385dba46c69a80626985c15b50)
902636
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
902636
---
902636
 hw/arm/sbsa-ref.c | 1 -
902636
 hw/core/machine.c | 4 ++--
902636
 2 files changed, 2 insertions(+), 3 deletions(-)
902636
902636
diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
902636
index 27046cc..c6261d4 100644
902636
--- a/hw/arm/sbsa-ref.c
902636
+++ b/hw/arm/sbsa-ref.c
902636
@@ -791,7 +791,6 @@ static void sbsa_ref_class_init(ObjectClass *oc, void *data)
902636
     mc->possible_cpu_arch_ids = sbsa_ref_possible_cpu_arch_ids;
902636
     mc->cpu_index_to_instance_props = sbsa_ref_cpu_index_to_props;
902636
     mc->get_default_cpu_node_id = sbsa_ref_get_default_cpu_node_id;
902636
-    mc->numa_mem_supported = true;
902636
 }
902636
 
902636
 static const TypeInfo sbsa_ref_info = {
902636
diff --git a/hw/core/machine.c b/hw/core/machine.c
902636
index 5a025d1..19c78c6 100644
902636
--- a/hw/core/machine.c
902636
+++ b/hw/core/machine.c
902636
@@ -1128,7 +1128,7 @@ static void machine_initfn(Object *obj)
902636
                                         NULL);
902636
     }
902636
 
902636
-    if (mc->numa_mem_supported) {
902636
+    if (mc->cpu_index_to_instance_props && mc->get_default_cpu_node_id) {
902636
         ms->numa_state = g_new0(NumaState, 1);
902636
     }
902636
 
902636
@@ -1272,7 +1272,7 @@ void machine_run_board_init(MachineState *machine)
902636
 {
902636
     MachineClass *machine_class = MACHINE_GET_CLASS(machine);
902636
 
902636
-    if (machine_class->numa_mem_supported) {
902636
+    if (machine->numa_state) {
902636
         numa_complete_configuration(machine);
902636
         if (machine->numa_state->num_nodes) {
902636
             machine_numa_finish_cpu_init(machine);
902636
-- 
902636
1.8.3.1
902636