yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-arch_init-align-MR-size-to-target-page-size.patch

0a122b
From be5e59136ca2d08576c189ae008e0ae806065e62 Mon Sep 17 00:00:00 2001
0a122b
Message-Id: <be5e59136ca2d08576c189ae008e0ae806065e62.1387298827.git.minovotn@redhat.com>
0a122b
In-Reply-To: <3ed0fb61a3dc912ef036d7ef450bed192090709e.1387298827.git.minovotn@redhat.com>
0a122b
References: <3ed0fb61a3dc912ef036d7ef450bed192090709e.1387298827.git.minovotn@redhat.com>
0a122b
From: "Michael S. Tsirkin" <mst@redhat.com>
0a122b
Date: Tue, 17 Dec 2013 15:17:16 +0100
0a122b
Subject: [PATCH 11/56] arch_init: align MR size to target page size
0a122b
0a122b
RH-Author: Michael S. Tsirkin <mst@redhat.com>
0a122b
Message-id: <1387293161-4085-12-git-send-email-mst@redhat.com>
0a122b
Patchwork-id: 56316
0a122b
O-Subject: [PATCH qemu-kvm RHEL7.0 v2 11/57] arch_init: align MR size to target page size
0a122b
Bugzilla: 1034876
0a122b
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
0a122b
RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com>
0a122b
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
0a122b
0a122b
Migration code assumes that each MR is a multiple of TARGET_PAGE_SIZE:
0a122b
MR size is divided by TARGET_PAGE_SIZE, so if it isn't migration
0a122b
never completes.
0a122b
But this isn't really required for regions set up with
0a122b
memory_region_init_ram, since that calls qemu_ram_alloc
0a122b
which aligns size up using TARGET_PAGE_ALIGN.
0a122b
0a122b
Align MR size up to full target page sizes, this way
0a122b
migration completes even if we create a RAM MR
0a122b
which is not a full target page size.
0a122b
0a122b
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
0a122b
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
0a122b
(cherry picked from commit 0851c9f75ccb0baf28f5bf901b9ffe3c91fcf969)
0a122b
---
0a122b
 arch_init.c | 3 ++-
0a122b
 1 file changed, 2 insertions(+), 1 deletion(-)
0a122b
0a122b
Signed-off-by: Michal Novotny <minovotn@redhat.com>
0a122b
---
0a122b
 arch_init.c | 3 ++-
0a122b
 1 file changed, 2 insertions(+), 1 deletion(-)
0a122b
0a122b
diff --git a/arch_init.c b/arch_init.c
0a122b
index 5301cfd..2c0ea1b 100644
0a122b
--- a/arch_init.c
0a122b
+++ b/arch_init.c
0a122b
@@ -341,7 +341,8 @@ ram_addr_t migration_bitmap_find_and_reset_dirty(MemoryRegion *mr,
0a122b
 {
0a122b
     unsigned long base = mr->ram_addr >> TARGET_PAGE_BITS;
0a122b
     unsigned long nr = base + (start >> TARGET_PAGE_BITS);
0a122b
-    unsigned long size = base + (int128_get64(mr->size) >> TARGET_PAGE_BITS);
0a122b
+    uint64_t mr_size = TARGET_PAGE_ALIGN(memory_region_size(mr));
0a122b
+    unsigned long size = base + (mr_size >> TARGET_PAGE_BITS);
0a122b
 
0a122b
     unsigned long next;
0a122b
 
0a122b
-- 
0a122b
1.7.11.7
0a122b