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

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