cryptospore / rpms / qemu-kvm

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