From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54029) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VDzqt-0000B5-FK for qemu-devel@nongnu.org; Mon, 26 Aug 2013 12:41:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VDzqn-0003FX-8q for qemu-devel@nongnu.org; Mon, 26 Aug 2013 12:41:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48643) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VDzqn-0003FP-0n for qemu-devel@nongnu.org; Mon, 26 Aug 2013 12:41:09 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r7QGf8xK009448 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 26 Aug 2013 12:41:08 -0400 Date: Mon, 26 Aug 2013 19:43:05 +0300 From: "Michael S. Tsirkin" Message-ID: <1377535318-30491-3-git-send-email-mst@redhat.com> References: <1377535318-30491-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1377535318-30491-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PULL 02/14] arch_init: align MR size to target page size List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Laszlo Ersek 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 Reviewed-by: Laszlo Ersek --- arch_init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch_init.c b/arch_init.c index 68a7ab7..ac8eb59 100644 --- a/arch_init.c +++ b/arch_init.c @@ -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; -- MST