From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:38815) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S0ixY-0008S1-Iz for qemu-devel@nongnu.org; Thu, 23 Feb 2012 19:24:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S0ixU-0004Sq-0z for qemu-devel@nongnu.org; Thu, 23 Feb 2012 19:24:28 -0500 Received: from ozlabs.org ([203.10.76.45]:57949) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S0ixT-0004SS-Kk for qemu-devel@nongnu.org; Thu, 23 Feb 2012 19:24:23 -0500 From: David Gibson Date: Fri, 24 Feb 2012 11:23:32 +1100 Message-Id: <1330043012-30556-7-git-send-email-david@gibson.dropbear.id.au> In-Reply-To: <1330043012-30556-1-git-send-email-david@gibson.dropbear.id.au> References: <1330043012-30556-1-git-send-email-david@gibson.dropbear.id.au> Subject: [Qemu-devel] [PATCH 6/6] kvm: Fix dirty tracking with large kernel page size List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws Cc: Marcelo Tossatti , qemu-devel@nongnu.org, David Gibson , Avi Kivity From: Benjamin Herrenschmidt If the kernel page size is larger than TARGET_PAGE_SIZE, which happens for example on ppc64 with kernels compiled for 64K pages, the dirty tracking doesn't work. Cc: Avi Kivity Cc: Marcelo Tossatti Signed-off-by: Benjamin Herrenschmidt Signed-off-by: David Gibson --- kvm-all.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index 5e188bf..3f8cfd9 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -348,10 +348,11 @@ static int kvm_set_migration_log(int enable) static int kvm_get_dirty_pages_log_range(MemoryRegionSection *section, unsigned long *bitmap) { - unsigned int i, j; + unsigned int i, j; unsigned long page_number, c; target_phys_addr_t addr, addr1; unsigned int len = ((section->size / TARGET_PAGE_SIZE) + HOST_LONG_BITS - 1) / HOST_LONG_BITS; + unsigned long hpratio = getpagesize() / TARGET_PAGE_SIZE; /* * bitmap-traveling is faster than memory-traveling (for addr...) @@ -363,10 +364,10 @@ static int kvm_get_dirty_pages_log_range(MemoryRegionSection *section, do { j = ffsl(c) - 1; c &= ~(1ul << j); - page_number = i * HOST_LONG_BITS + j; + page_number = (i * HOST_LONG_BITS + j) * hpratio; addr1 = page_number * TARGET_PAGE_SIZE; addr = section->offset_within_region + addr1; - memory_region_set_dirty(section->mr, addr, TARGET_PAGE_SIZE); + memory_region_set_dirty(section->mr, addr, TARGET_PAGE_SIZE * hpratio); } while (c != 0); } } -- 1.7.9