aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2012-05-10 08:08:31 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2012-05-10 08:08:31 -0500
commitb3def7f5ff7cb3f5e6128fbb7b6a9aaade98774d (patch)
treea51445b1006cad926d20cf8ab81a4d0eed90aa09
parent9f34841a812dc622f8de98bc6141925c22f0ee93 (diff)
parent3145fcb6057c82e9d8b57bf86494df6af844c732 (diff)
Merge remote-tracking branch 'qemu-kvm/uq/master' into staging
* qemu-kvm/uq/master: kvm: Fix dirty tracking with large kernel page size
-rw-r--r--kvm-all.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/kvm-all.c b/kvm-all.c
index b8e9dc69de..9b73ccfbec 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -348,6 +348,7 @@ static int kvm_get_dirty_pages_log_range(MemoryRegionSection *section,
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...)
@@ -359,10 +360,11 @@ 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);
}
}
@@ -980,6 +982,14 @@ int kvm_init(void)
s = g_malloc0(sizeof(KVMState));
+ /*
+ * On systems where the kernel can support different base page
+ * sizes, host page size may be different from TARGET_PAGE_SIZE,
+ * even with KVM. TARGET_PAGE_SIZE is assumed to be the minimum
+ * page size for the system though.
+ */
+ assert(TARGET_PAGE_SIZE <= getpagesize());
+
#ifdef KVM_CAP_SET_GUEST_DEBUG
QTAILQ_INIT(&s->kvm_sw_breakpoints);
#endif