yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-spapr-Fix-ibm-max-associativity-domains-property-num.patch

ae23c9
From 4da5757f8ad715c203e2ef9320c49432e8259ee8 Mon Sep 17 00:00:00 2001
ae23c9
From: David Gibson <dgibson@redhat.com>
ae23c9
Date: Thu, 30 May 2019 04:37:23 +0100
ae23c9
Subject: [PATCH 2/8] spapr: Fix ibm, max-associativity-domains property number
ae23c9
 of nodes
ae23c9
ae23c9
RH-Author: David Gibson <dgibson@redhat.com>
ae23c9
Message-id: <20190530043728.32575-2-dgibson@redhat.com>
ae23c9
Patchwork-id: 88418
ae23c9
O-Subject: [RHEL-8.1 qemu-kvm PATCH 1/6] spapr: Fix ibm, max-associativity-domains property number of nodes
ae23c9
Bugzilla: 1710662
ae23c9
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
ae23c9
RH-Acked-by: Auger Eric <eric.auger@redhat.com>
ae23c9
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
ae23c9
ae23c9
From: Serhii Popovych <spopovyc@redhat.com>
ae23c9
ae23c9
Laurent Vivier reported off by one with maximum number of NUMA nodes
ae23c9
provided by qemu-kvm being less by one than required according to
ae23c9
description of "ibm,max-associativity-domains" property in LoPAPR.
ae23c9
ae23c9
It appears that I incorrectly treated LoPAPR description of this
ae23c9
property assuming it provides last valid domain (NUMA node here)
ae23c9
instead of maximum number of domains.
ae23c9
ae23c9
  ### Before hot-add
ae23c9
ae23c9
  (qemu) info numa
ae23c9
  3 nodes
ae23c9
  node 0 cpus: 0
ae23c9
  node 0 size: 0 MB
ae23c9
  node 0 plugged: 0 MB
ae23c9
  node 1 cpus:
ae23c9
  node 1 size: 1024 MB
ae23c9
  node 1 plugged: 0 MB
ae23c9
  node 2 cpus:
ae23c9
  node 2 size: 0 MB
ae23c9
  node 2 plugged: 0 MB
ae23c9
ae23c9
  $ numactl -H
ae23c9
  available: 2 nodes (0-1)
ae23c9
  node 0 cpus: 0
ae23c9
  node 0 size: 0 MB
ae23c9
  node 0 free: 0 MB
ae23c9
  node 1 cpus:
ae23c9
  node 1 size: 999 MB
ae23c9
  node 1 free: 658 MB
ae23c9
  node distances:
ae23c9
  node   0   1
ae23c9
    0:  10  40
ae23c9
    1:  40  10
ae23c9
ae23c9
  ### Hot-add
ae23c9
ae23c9
  (qemu) object_add memory-backend-ram,id=mem0,size=1G
ae23c9
  (qemu) device_add pc-dimm,id=dimm1,memdev=mem0,node=2
ae23c9
  (qemu) [   87.704898] pseries-hotplug-mem: Attempting to hot-add 4 ...
ae23c9
  <there is no "Initmem setup node 2 [mem 0xHEX-0xHEX]">
ae23c9
  [   87.705128] lpar: Attempting to resize HPT to shift 21
ae23c9
  ... <HPT resize messages>
ae23c9
ae23c9
  ### After hot-add
ae23c9
ae23c9
  (qemu) info numa
ae23c9
  3 nodes
ae23c9
  node 0 cpus: 0
ae23c9
  node 0 size: 0 MB
ae23c9
  node 0 plugged: 0 MB
ae23c9
  node 1 cpus:
ae23c9
  node 1 size: 1024 MB
ae23c9
  node 1 plugged: 0 MB
ae23c9
  node 2 cpus:
ae23c9
  node 2 size: 1024 MB
ae23c9
  node 2 plugged: 1024 MB
ae23c9
ae23c9
  $ numactl -H
ae23c9
  available: 2 nodes (0-1)
ae23c9
  ^^^^^^^^^^^^^^^^^^^^^^^^
ae23c9
             Still only two nodes (and memory hot-added to node 0 below)
ae23c9
  node 0 cpus: 0
ae23c9
  node 0 size: 1024 MB
ae23c9
  node 0 free: 1021 MB
ae23c9
  node 1 cpus:
ae23c9
  node 1 size: 999 MB
ae23c9
  node 1 free: 658 MB
ae23c9
  node distances:
ae23c9
  node   0   1
ae23c9
    0:  10  40
ae23c9
    1:  40  10
ae23c9
ae23c9
After fix applied numactl(8) reports 3 nodes available and memory
ae23c9
plugged into node 2 as expected.
ae23c9
ae23c9
>From David Gibson:
ae23c9
------------------
ae23c9
  Qemu makes a distinction between "non NUMA" (nb_numa_nodes == 0) and
ae23c9
  "NUMA with one node" (nb_numa_nodes == 1).  But from a PAPR guests's
ae23c9
  point of view these are equivalent.  I don't want to present two
ae23c9
  different cases to the guest when we don't need to, so even though the
ae23c9
  guest can handle it, I'd prefer we put a '1' here for both the
ae23c9
  nb_numa_nodes == 0 and nb_numa_nodes == 1 case.
ae23c9
ae23c9
This consolidates everything discussed previously on mailing list.
ae23c9
ae23c9
Fixes: da9f80fbad21 ("spapr: Add ibm,max-associativity-domains property")
ae23c9
Reported-by: Laurent Vivier <lvivier@redhat.com>
ae23c9
Signed-off-by: Serhii Popovych <spopovyc@redhat.com>
ae23c9
ae23c9
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
ae23c9
Reviewed-by: Greg Kurz <groug@kaod.org>
ae23c9
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
ae23c9
(cherry picked from commit 3908a24fcb83913079d315de0ca6d598e8616dbb)
ae23c9
ae23c9
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1710662
ae23c9
ae23c9
Signed-off-by: David Gibson <dgibson@redhat.com>
ae23c9
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ae23c9
---
ae23c9
 hw/ppc/spapr.c | 2 +-
ae23c9
 1 file changed, 1 insertion(+), 1 deletion(-)
ae23c9
ae23c9
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
ae23c9
index ea72782..b57c0be 100644
ae23c9
--- a/hw/ppc/spapr.c
ae23c9
+++ b/hw/ppc/spapr.c
ae23c9
@@ -915,7 +915,7 @@ static void spapr_dt_rtas(sPAPRMachineState *spapr, void *fdt)
ae23c9
         cpu_to_be32(0),
ae23c9
         cpu_to_be32(0),
ae23c9
         cpu_to_be32(0),
ae23c9
-        cpu_to_be32(nb_numa_nodes ? nb_numa_nodes - 1 : 0),
ae23c9
+        cpu_to_be32(nb_numa_nodes ? nb_numa_nodes : 1),
ae23c9
     };
ae23c9
 
ae23c9
     _FDT(rtas = fdt_add_subnode(fdt, 0, "rtas"));
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9