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

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