cpu_physical_memory_sync_dirty_bitmap: Fix alignment check
This code has an optimised, word aligned version, and a boring unaligned version. Recently084140bd49
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:084140bd49
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>
This commit is contained in:
parent
452589b6b4
commit
f70d3451fe
|
@ -377,19 +377,20 @@ uint64_t cpu_physical_memory_sync_dirty_bitmap(RAMBlock *rb,
|
||||||
uint64_t *real_dirty_pages)
|
uint64_t *real_dirty_pages)
|
||||||
{
|
{
|
||||||
ram_addr_t addr;
|
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;
|
uint64_t num_dirty = 0;
|
||||||
unsigned long *dest = rb->bmap;
|
unsigned long *dest = rb->bmap;
|
||||||
|
|
||||||
/* start address is aligned at the start of a word? */
|
/* 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 k;
|
||||||
int nr = BITS_TO_LONGS(length >> TARGET_PAGE_BITS);
|
int nr = BITS_TO_LONGS(length >> TARGET_PAGE_BITS);
|
||||||
unsigned long * const *src;
|
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 idx = (word * BITS_PER_LONG) / DIRTY_MEMORY_BLOCK_SIZE;
|
||||||
unsigned long offset = BIT_WORD((word * BITS_PER_LONG) %
|
unsigned long offset = BIT_WORD((word * BITS_PER_LONG) %
|
||||||
DIRTY_MEMORY_BLOCK_SIZE);
|
DIRTY_MEMORY_BLOCK_SIZE);
|
||||||
|
unsigned long page = BIT_WORD(start >> TARGET_PAGE_BITS);
|
||||||
|
|
||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue