[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 47/60] kvm: fix incorrect length in a loop over kvm
From: |
Michael Tokarev |
Subject: |
[Qemu-devel] [PATCH 47/60] kvm: fix incorrect length in a loop over kvm dirty pages map |
Date: |
Mon, 4 Feb 2013 14:40:57 +0400 |
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>
(cherry picked from commit 752ced0488806830f18f96b60ae6f3d1fadfd089)
Conflicts:
kvm-all.c
---
kvm-all.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kvm-all.c b/kvm-all.c
index 9b73ccf..e92dc6f 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -347,7 +347,7 @@ static int
kvm_get_dirty_pages_log_range(MemoryRegionSection *section,
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 int len = ((section->size / getpagesize()) + HOST_LONG_BITS - 1)
/ HOST_LONG_BITS;
unsigned long hpratio = getpagesize() / TARGET_PAGE_SIZE;
/*
--
1.7.10.4
- [Qemu-devel] [PATCH 10/60] pcie_aer: clear cmask for Advanced Error Interrupt Message Number, (continued)
- [Qemu-devel] [PATCH 48/60] ide: Fix crash with too long PRD, Michael Tokarev, 2013/02/04
- [Qemu-devel] [PATCH 35/60] s390x: fix -initrd in virtio machine, Michael Tokarev, 2013/02/04
- [Qemu-devel] [PATCH 53/60] hw/qxl: qxl_send_events: nop if stopped, Michael Tokarev, 2013/02/04
- [Qemu-devel] [PATCH 17/60] net: notify iothread after flushing queue, Michael Tokarev, 2013/02/04
- [Qemu-devel] [PATCH 34/60] memory: fix rendering of a region obscured by another, Michael Tokarev, 2013/02/04
- [Qemu-devel] [PATCH 52/60] uhci: Don't queue up packets after one with the SPD flag set, Michael Tokarev, 2013/02/04
- [Qemu-devel] [PATCH 47/60] kvm: fix incorrect length in a loop over kvm dirty pages map,
Michael Tokarev <=
- [Qemu-devel] [PATCH 15/60] i386: kvm: bit 10 of CPUID[8000_0001].EDX is reserved, Michael Tokarev, 2013/02/04
- [Qemu-devel] [PATCH 32/60] qed: refuse unaligned zero writes with a backing file, Michael Tokarev, 2013/02/04
- [Qemu-devel] [PATCH 16/60] blockdev: preserve readonly and snapshot states across media changes, Michael Tokarev, 2013/02/04
- [Qemu-devel] [PATCH 46/60] e1000: Discard oversized packets based on SBP|LPE, Michael Tokarev, 2013/02/04
- [Qemu-devel] [PATCH 45/60] e1000: Discard packets that are too long if !SBP and !LPE, Michael Tokarev, 2013/02/04
- [Qemu-devel] [PATCH 33/60] e1000: drop check_rxov, always treat RX ring with RDH == RDT as empty, Michael Tokarev, 2013/02/04
- [Qemu-devel] [PATCH 07/60] cpu_physical_memory_write_rom() needs to do TB invalidates, Michael Tokarev, 2013/02/04
- [Qemu-devel] [PATCH 20/60] ui/vnc: Only report/use TIGHT_PNG encoding if enabled., Michael Tokarev, 2013/02/04
- [Qemu-devel] [PATCH 56/60] target-xtensa: fix search_pc for the last TB opcode, Michael Tokarev, 2013/02/04
- [Qemu-devel] [PATCH 21/60] vnc: fix "info vnc" with "-vnc ..., reverse=on", Michael Tokarev, 2013/02/04