]> Git Repo - qemu.git/commitdiff
arch_init: align MR size to target page size
authorMichael S. Tsirkin <[email protected]>
Mon, 19 Aug 2013 14:26:52 +0000 (17:26 +0300)
committerMichael S. Tsirkin <[email protected]>
Tue, 20 Aug 2013 21:18:39 +0000 (00:18 +0300)
Migration code assumes that each MR is a multiple of TARGET_PAGE_SIZE:
MR size is divided by TARGET_PAGE_SIZE, so if it isn't migration
never completes.
But this isn't really required for regions set up with
memory_region_init_ram, since that calls qemu_ram_alloc
which aligns size up using TARGET_PAGE_ALIGN.

Align MR size up to full target page sizes, this way
migration completes even if we create a RAM MR
which is not a full target page size.

Signed-off-by: Michael S. Tsirkin <[email protected]>
Reviewed-by: Laszlo Ersek <[email protected]>
arch_init.c

index 68a7ab784f24a8784e482992b579995a86bc1d53..ac8eb593c953c688d3d86991838619f65db4ffa3 100644 (file)
@@ -342,7 +342,8 @@ ram_addr_t migration_bitmap_find_and_reset_dirty(MemoryRegion *mr,
 {
     unsigned long base = mr->ram_addr >> TARGET_PAGE_BITS;
     unsigned long nr = base + (start >> TARGET_PAGE_BITS);
-    unsigned long size = base + (int128_get64(mr->size) >> TARGET_PAGE_BITS);
+    uint64_t mr_size = TARGET_PAGE_ALIGN(memory_region_size(mr));
+    unsigned long size = base + (mr_size >> TARGET_PAGE_BITS);
 
     unsigned long next;
 
This page took 0.027863 seconds and 4 git commands to generate.