cryptospore / rpms / qemu-kvm

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