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

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