qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] pc: memhp: enforce minimal 128Mb alignment for pc-dimm
@ 2015-10-26  8:42 Igor Mammedov
  2015-10-26  9:02 ` Michael S. Tsirkin
  2015-10-26 18:33 ` Eduardo Habkost
  0 siblings, 2 replies; 7+ messages in thread
From: Igor Mammedov @ 2015-10-26  8:42 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, ehabkost, mst

commit aa8580cd "pc: memhp: force gaps between DIMM's GPA"
regressed memory hot-unplug for linux guests triggering
following BUGON
 =====
 kernel BUG at mm/memory_hotplug.c:703!
 ...
 [<ffffffff81385fa7>] acpi_memory_device_remove+0x79/0xa5
 [<ffffffff81357818>] acpi_bus_trim+0x5a/0x8d
 [<ffffffff81359026>] acpi_device_hotplug+0x1b7/0x418
 ===
    BUG_ON(phys_start_pfn & ~PAGE_SECTION_MASK);
 ===

reson for it is that x86-64 linux guest supports memory
hotplug in chunks of 128Mb and memory section also should
be 128Mb aligned.
However gaps forced between 128Mb DIMMs with backend's
natural alignment of 2Mb make the 2nd and following
DIMMs not being aligned on 128Mb boundary as it was
originally. To fix regression enforce minimal 128Mb
alignment like it was done for PPC.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/i386/pc.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 3d958ba..cd68169 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1610,6 +1610,8 @@ void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name)
     }
 }
 
+#define MIN_DIMM_ALIGNMENT (1ULL << 27) /* 128Mb */
+
 static void pc_dimm_plug(HotplugHandler *hotplug_dev,
                          DeviceState *dev, Error **errp)
 {
@@ -1624,6 +1626,9 @@ static void pc_dimm_plug(HotplugHandler *hotplug_dev,
 
     if (memory_region_get_alignment(mr) && pcms->enforce_aligned_dimm) {
         align = memory_region_get_alignment(mr);
+        if (pcmc->inter_dimm_gap && (align < MIN_DIMM_ALIGNMENT)) {
+            align = MIN_DIMM_ALIGNMENT;
+        }
     }
 
     if (!pcms->acpi_dev) {
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-10-27 18:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-26  8:42 [Qemu-devel] [PATCH] pc: memhp: enforce minimal 128Mb alignment for pc-dimm Igor Mammedov
2015-10-26  9:02 ` Michael S. Tsirkin
2015-10-26  9:20   ` Igor Mammedov
2015-10-26 18:33 ` Eduardo Habkost
2015-10-27  9:08   ` Michael S. Tsirkin
2015-10-27 16:24     ` Eduardo Habkost
2015-10-27 18:35       ` Michael S. Tsirkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).