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

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