[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 45/51] cpu_physical_memory_sync_dirty_bitmap: Another
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 45/51] cpu_physical_memory_sync_dirty_bitmap: Another alignment fix |
Date: |
Tue, 16 Jan 2018 15:17:27 +0100 |
From: "Dr. David Alan Gilbert" <address@hidden>
This code has an optimised, word aligned version, and a boring
unaligned version. My commit f70d345 fixed one alignment issue, but
there's another.
The optimised version operates on 'longs' dealing with (typically) 64
pages at a time, replacing the whole long by a 0 and counting the bits.
If the Ramblock is less than 64bits in length that long can contain bits
representing two different RAMBlocks, but the code will update the
bmap belinging to the 1st RAMBlock only while having updated the total
dirty page count for both.
This probably didn't matter prior to 6b6712ef which split the dirty
bitmap by RAMBlock, but now they're separate RAMBlocks we end up
with a count that doesn't match the state in the bitmaps.
Symptom:
Migration showing a few dirty pages left to be sent constantly
Seen on aarch64 and x86 with x86+ovmf
Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Reported-by: Wei Huang <address@hidden>
Fixes: 6b6712efccd383b48a909bee0b29e079a57601ec
Signed-off-by: Paolo Bonzini <address@hidden>
---
include/exec/ram_addr.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h
index 6cbc02a..7633ef6 100644
--- a/include/exec/ram_addr.h
+++ b/include/exec/ram_addr.h
@@ -391,9 +391,10 @@ uint64_t cpu_physical_memory_sync_dirty_bitmap(RAMBlock
*rb,
uint64_t num_dirty = 0;
unsigned long *dest = rb->bmap;
- /* start address is aligned at the start of a word? */
+ /* start address and length is aligned at the start of a word? */
if (((word * BITS_PER_LONG) << TARGET_PAGE_BITS) ==
- (start + rb->offset)) {
+ (start + rb->offset) &&
+ !(length & ((BITS_PER_LONG << TARGET_PAGE_BITS) - 1))) {
int k;
int nr = BITS_TO_LONGS(length >> TARGET_PAGE_BITS);
unsigned long * const *src;
--
1.8.3.1
- [Qemu-devel] [PULL 32/51] target-i386: update hflags on Hypervisor.framework, (continued)
- [Qemu-devel] [PULL 32/51] target-i386: update hflags on Hypervisor.framework, Paolo Bonzini, 2018/01/16
- [Qemu-devel] [PULL 37/51] irq: fix memory leak, Paolo Bonzini, 2018/01/16
- [Qemu-devel] [PULL 33/51] scripts/qemu-gdb: add simple tcg lock status helper, Paolo Bonzini, 2018/01/16
- [Qemu-devel] [PULL 36/51] cpus: unify qemu_*_wait_io_event, Paolo Bonzini, 2018/01/16
- [Qemu-devel] [PULL 41/51] chardev: Clean up previous patch indentation, Paolo Bonzini, 2018/01/16
- [Qemu-devel] [PULL 38/51] net: Drop unusual use of do { } while (0);, Paolo Bonzini, 2018/01/16
- [Qemu-devel] [PULL 39/51] mips: Tweak location of ';' in macros, Paolo Bonzini, 2018/01/16
- [Qemu-devel] [PULL 40/51] chardev: Use goto/label instead of do/break/while(0), Paolo Bonzini, 2018/01/16
- [Qemu-devel] [PULL 42/51] tests: Avoid 'do/while(false); ' in vhost-user-bridge, Paolo Bonzini, 2018/01/16
- [Qemu-devel] [PULL 43/51] maint: Fix macros with broken 'do/while(0); ' usage, Paolo Bonzini, 2018/01/16
- [Qemu-devel] [PULL 45/51] cpu_physical_memory_sync_dirty_bitmap: Another alignment fix,
Paolo Bonzini <=
- [Qemu-devel] [PULL 44/51] checkpatch: Enforce proper do/while (0) style, Paolo Bonzini, 2018/01/16
- [Qemu-devel] [PULL 47/51] find_ram_offset: Align ram_addr_t allocation on long boundaries, Paolo Bonzini, 2018/01/16
- [Qemu-devel] [PULL 51/51] scripts/analyse-locks-simpletrace.py: script to analyse lock times, Paolo Bonzini, 2018/01/16
- [Qemu-devel] [PULL 49/51] cpu: flush TB cache when loading VMState, Paolo Bonzini, 2018/01/16
- [Qemu-devel] [PULL 46/51] find_ram_offset: Add comments and tracing, Paolo Bonzini, 2018/01/16
- [Qemu-devel] [PULL 50/51] util/qemu-thread-*: add qemu_lock, locked and unlock trace events, Paolo Bonzini, 2018/01/16
- [Qemu-devel] [PULL 48/51] block/iscsi: fix initialization of iTask in iscsi_co_get_block_status, Paolo Bonzini, 2018/01/16
- Re: [Qemu-devel] [PULL v4 00/51] Misc patches for 2018-01-12, no-reply, 2018/01/16
- Re: [Qemu-devel] [PULL v4 00/51] Misc patches for 2018-01-12, Peter Maydell, 2018/01/16