From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: [Qemu-devel] [PULL 02/17] cpu_physical_memory_sync_dirty_bitmap: Fix alignment check
Date: Tue, 1 Aug 2017 18:17:10 +0200 [thread overview]
Message-ID: <1501604245-33460-3-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1501604245-33460-1-git-send-email-pbonzini@redhat.com>
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
This code has an optimised, word aligned version, and a boring
unaligned version. Recently 084140bd498909 fixed a missing offset
addition from the core of both versions. However, the offset isn't
necessarily aligned and thus the choice between the two versions
needs fixing up to also include the offset.
Symptom:
A few stuck unsent pages during migration; not normally noticed
unless under very low bandwidth in which case the migration may get
stuck never ending and never performing a 2nd sync; noticed by
a hanging postcopy-test on a very heavily loaded system.
Fixes: 084140bd498909
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reported-by: Alex Benneé <alex.benee@linaro.org>
Tested-by: Alex Benneé <alex.benee@linaro.org>
--
v2
Move 'page' inside the if (Comment from Paolo)
Message-Id: <20170724165125.29887-1-dgilbert@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
include/exec/ram_addr.h | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h
index c04f4f6..d017639 100644
--- a/include/exec/ram_addr.h
+++ b/include/exec/ram_addr.h
@@ -377,19 +377,20 @@ uint64_t cpu_physical_memory_sync_dirty_bitmap(RAMBlock *rb,
uint64_t *real_dirty_pages)
{
ram_addr_t addr;
- unsigned long page = BIT_WORD(start >> TARGET_PAGE_BITS);
+ unsigned long word = BIT_WORD((start + rb->offset) >> TARGET_PAGE_BITS);
uint64_t num_dirty = 0;
unsigned long *dest = rb->bmap;
/* start address is aligned at the start of a word? */
- if (((page * BITS_PER_LONG) << TARGET_PAGE_BITS) == start) {
+ if (((word * BITS_PER_LONG) << TARGET_PAGE_BITS) ==
+ (start + rb->offset)) {
int k;
int nr = BITS_TO_LONGS(length >> TARGET_PAGE_BITS);
unsigned long * const *src;
- unsigned long word = BIT_WORD((start + rb->offset) >> TARGET_PAGE_BITS);
unsigned long idx = (word * BITS_PER_LONG) / DIRTY_MEMORY_BLOCK_SIZE;
unsigned long offset = BIT_WORD((word * BITS_PER_LONG) %
DIRTY_MEMORY_BLOCK_SIZE);
+ unsigned long page = BIT_WORD(start >> TARGET_PAGE_BITS);
rcu_read_lock();
--
1.8.3.1
next prev parent reply other threads:[~2017-08-01 16:17 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-01 16:17 [Qemu-devel] [PULL 00/17] Misc changes for QEMU 2.10-rc1 (?) Paolo Bonzini
2017-08-01 16:17 ` [Qemu-devel] [PULL 01/17] vl.c/exit: pause cpus before closing block devices Paolo Bonzini
2017-08-01 16:17 ` Paolo Bonzini [this message]
2017-08-01 17:56 ` [Qemu-devel] [PULL 02/17] cpu_physical_memory_sync_dirty_bitmap: Fix alignment check Peter Maydell
2017-08-01 18:04 ` Dr. David Alan Gilbert
2017-08-02 7:39 ` Paolo Bonzini
2017-08-07 10:07 ` Alex Bennée
2017-08-01 16:17 ` [Qemu-devel] [PULL 03/17] accel: cleanup error output Paolo Bonzini
2017-08-01 16:17 ` [Qemu-devel] [PULL 04/17] char-fd: remove useless chr pointer Paolo Bonzini
2017-08-01 16:17 ` [Qemu-devel] [PULL 05/17] char: don't exit on hmp 'chardev-add help' Paolo Bonzini
2017-08-01 16:17 ` [Qemu-devel] [PULL 06/17] docs: document deprecation policy & deprecated features in appendix Paolo Bonzini
2017-08-01 16:17 ` [Qemu-devel] [PULL 07/17] target-i386: kvm_get/put_vcpu_events don't handle sipi_vector Paolo Bonzini
2017-08-01 16:17 ` [Qemu-devel] [PULL 08/17] exec: Add lock parameter to qemu_ram_ptr_length Paolo Bonzini
2017-08-01 16:17 ` [Qemu-devel] [PULL 09/17] bt: stop the sdp memory allocation craziness Paolo Bonzini
2017-08-01 16:17 ` [Qemu-devel] [PULL 10/17] qemu-options: document existance of versioned machine types Paolo Bonzini
2017-08-01 16:17 ` [Qemu-devel] [PULL 11/17] migration: optimize the downtime Paolo Bonzini
2017-08-01 16:17 ` [Qemu-devel] [PULL 12/17] hw/scsi/vmw_pvscsi: Remove the dead error handling Paolo Bonzini
2017-08-01 16:17 ` [Qemu-devel] [PULL 13/17] hw/scsi/vmw_pvscsi: Convert to realize Paolo Bonzini
2017-08-01 16:17 ` [Qemu-devel] [PULL 14/17] rtc-test: cleanup register_b_set_flag test Paolo Bonzini
2017-08-01 16:17 ` [Qemu-devel] [PULL 15/17] rtc-test: introduce more update tests Paolo Bonzini
2017-08-01 16:17 ` [Qemu-devel] [PULL 16/17] mc146818rtc: simplify check_update_timer Paolo Bonzini
2017-08-01 16:17 ` [Qemu-devel] [PULL 17/17] mc146818rtc: implement UIP latching as intended Paolo Bonzini
2017-08-01 16:48 ` [Qemu-devel] [PULL 00/17] Misc changes for QEMU 2.10-rc1 (?) no-reply
2017-08-01 16:50 ` Paolo Bonzini
2017-08-01 17:10 ` Peter Maydell
2017-08-01 17:17 ` Paolo Bonzini
2017-08-01 17:22 ` Peter Maydell
2017-08-01 17:26 ` Paolo Bonzini
2017-08-01 17:56 ` Peter Maydell
2017-08-02 5:48 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1501604245-33460-3-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=dgilbert@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).