Blame SOURCES/kvm-pc-acpi-fix-memory-hotplug-regression-by-reducing-st.patch

357786
From 6d5bc18c3af1969cfcaea9c9bafb5ad0d32bb163 Mon Sep 17 00:00:00 2001
357786
From: Igor Mammedov <imammedo@redhat.com>
357786
Date: Tue, 7 Aug 2018 12:33:52 +0200
357786
Subject: [PATCH 05/13] pc: acpi: fix memory hotplug regression by reducing
357786
 stub SRAT entry size
357786
357786
RH-Author: Igor Mammedov <imammedo@redhat.com>
357786
Message-id: <1533645232-98572-1-git-send-email-imammedo@redhat.com>
357786
Patchwork-id: 81662
357786
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH] pc: acpi: fix memory hotplug regression by reducing stub SRAT entry size
357786
Bugzilla: 1609234
357786
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
357786
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
357786
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
357786
357786
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1609234
357786
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=17640116
357786
Branch: rhv7/master-2.12.0
357786
357786
 1: there is no coldplugged dimm in the last numa node
357786
    but there is a coldplugged dimm in another node
357786
357786
  -m 4096,slots=4,maxmem=32G               \
357786
  -object memory-backend-ram,id=m0,size=2G \
357786
  -device pc-dimm,memdev=m0,node=0         \
357786
  -numa node,nodeid=0                      \
357786
  -numa node,nodeid=1
357786
357786
 2: if order of dimms on CLI is:
357786
       1st plugged dimm in node1
357786
       2nd plugged dimm in node0
357786
357786
  -m 4096,slots=4,maxmem=32G               \
357786
  -object memory-backend-ram,size=2G,id=m0 \
357786
  -device pc-dimm,memdev=m0,node=1         \
357786
  -object memory-backend-ram,id=m1,size=2G \
357786
  -device pc-dimm,memdev=m1,node=0         \
357786
  -numa node,nodeid=0                      \
357786
  -numa node,nodeid=1
357786
357786
(qemu) object_add memory-backend-ram,id=m2,size=1G
357786
(qemu) device_add pc-dimm,memdev=m2,node=0
357786
357786
the first DIMM hotplug to any node except the last one
357786
fails (Windows is unable to online it).
357786
357786
Length reduction of stub hotplug memory SRAT entry,
357786
fixes issue for some reason.
357786
357786
RHBZ: 1609234
357786
357786
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
357786
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
357786
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
357786
357786
(cherry picked from commit 10efd7e1088855dc019e6a248ac7f9b24af8dd26)
357786
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
357786
---
357786
 hw/i386/acpi-build.c | 19 ++++++++++---------
357786
 1 file changed, 10 insertions(+), 9 deletions(-)
357786
357786
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
357786
index b309a97..683e5f4 100644
357786
--- a/hw/i386/acpi-build.c
357786
+++ b/hw/i386/acpi-build.c
357786
@@ -2271,7 +2271,16 @@ static void build_srat_hotpluggable_memory(GArray *table_data, uint64_t base,
357786
         numamem = acpi_data_push(table_data, sizeof *numamem);
357786
 
357786
         if (!info) {
357786
-            build_srat_memory(numamem, cur, end - cur, default_node,
357786
+            /*
357786
+             * Entry is required for Windows to enable memory hotplug in OS
357786
+             * and for Linux to enable SWIOTLB when booted with less than
357786
+             * 4G of RAM. Windows works better if the entry sets proximity
357786
+             * to the highest NUMA node in the machine at the end of the
357786
+             * reserved space.
357786
+             * Memory devices may override proximity set by this entry,
357786
+             * providing _PXM method if necessary.
357786
+             */
357786
+            build_srat_memory(numamem, end - 1, 1, default_node,
357786
                               MEM_AFFINITY_HOTPLUGGABLE | MEM_AFFINITY_ENABLED);
357786
             break;
357786
         }
357786
@@ -2404,14 +2413,6 @@ build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine)
357786
         build_srat_memory(numamem, 0, 0, 0, MEM_AFFINITY_NOFLAGS);
357786
     }
357786
 
357786
-    /*
357786
-     * Entry is required for Windows to enable memory hotplug in OS
357786
-     * and for Linux to enable SWIOTLB when booted with less than
357786
-     * 4G of RAM. Windows works better if the entry sets proximity
357786
-     * to the highest NUMA node in the machine.
357786
-     * Memory devices may override proximity set by this entry,
357786
-     * providing _PXM method if necessary.
357786
-     */
357786
     if (hotplugabble_address_space_size) {
357786
         build_srat_hotpluggable_memory(table_data, pcms->hotplug_memory.base,
357786
                                        hotplugabble_address_space_size,
357786
-- 
357786
1.8.3.1
357786