[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 3/6] kvm: fix incorrect length in a loop over kvm di
From: |
Alexander Graf |
Subject: |
[Qemu-devel] [PATCH 3/6] kvm: fix incorrect length in a loop over kvm dirty pages map |
Date: |
Mon, 26 Nov 2012 19:55:54 +0100 |
From: Alexey Kardashevskiy <address@hidden>
QEMU allocates a map enough for 4k pages. However the system page size
can be 64K (for example on POWER) and the host kernel uses only a small
part of it as one big stores a dirty flag for 16 pages 4K each,
the hpratio variable stores this ratio and
the kvm_get_dirty_pages_log_range function handles it correctly.
However kvm_get_dirty_pages_log_range still goes beyond the data
provided by the host kernel which is not correct. It does not cause
errors at the moment as the whole bitmap is zeroed before doing KVM ioctl.
The patch reduces number of iterations over the map.
Signed-off-by: Alexey Kardashevskiy <address@hidden>
Signed-off-by: Alexander Graf <address@hidden>
---
kvm-all.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/kvm-all.c b/kvm-all.c
index 3bc3347..8e9a8d8 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -364,7 +364,7 @@ static int
kvm_get_dirty_pages_log_range(MemoryRegionSection *section,
unsigned int i, j;
unsigned long page_number, c;
hwaddr addr, addr1;
- unsigned int len = ((section->size / TARGET_PAGE_SIZE) + HOST_LONG_BITS -
1) / HOST_LONG_BITS;
+ unsigned int len = ((section->size / getpagesize()) + HOST_LONG_BITS - 1)
/ HOST_LONG_BITS;
unsigned long hpratio = getpagesize() / TARGET_PAGE_SIZE;
/*
--
1.6.0.2
- [Qemu-devel] [PULL 1.3 0/6] ppc 1.3 patch queue 2012-11-26, Alexander Graf, 2012/11/26
- [Qemu-devel] [PATCH 3/6] kvm: fix incorrect length in a loop over kvm dirty pages map,
Alexander Graf <=
- [Qemu-devel] [PATCH 1/6] hw/ide/macio: Fix segfault caused by NULL DMAContext*, Alexander Graf, 2012/11/26
- [Qemu-devel] [PATCH 6/6] fbdev: fix pixman compile on old pixman, Alexander Graf, 2012/11/26
- [Qemu-devel] [PATCH 4/6] pseries: Fix bug in PCI MSI allocation, Alexander Graf, 2012/11/26
- [Qemu-devel] [PATCH 2/6] PPC: Fix missing TRACE exception, Alexander Graf, 2012/11/26
- [Qemu-devel] [PATCH 5/6] vl.c: Fix broken -usb option, Alexander Graf, 2012/11/26
- Re: [Qemu-devel] [PULL 1.3 0/6] ppc 1.3 patch queue 2012-11-26, Anthony Liguori, 2012/11/28