[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 28/36] Count used RAMBlock pages for migration_dirty
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PATCH 28/36] Count used RAMBlock pages for migration_dirty_pages |
Date: |
Mon, 5 May 2014 22:30:26 +0200 |
From: "Dr. David Alan Gilbert" <address@hidden>
This is a fix for a bug* triggered by a migration after hot unplugging
a few virtio-net NICs, that caused migration never to converge, because
'migration_dirty_pages' is incorrectly initialised.
'migration_dirty_pages' is used as a tally of the number of outstanding
dirty pages, to give the migration code an idea of how much more data
will need to be transferred, and thus whether it can end the iterative
phase.
It was initialised to the total size of the RAMBlock address space,
however hotunplug can leave this space sparse, and hence
migration_dirty_pages ended up too large.
Signed-off-by: Dr. David Alan Gilbert <address@hidden>
(* https://bugzilla.redhat.com/show_bug.cgi?id=1074913 )
Signed-off-by: Juan Quintela <address@hidden>
---
arch_init.c | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/arch_init.c b/arch_init.c
index 60c975d..0c8c07d 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -726,11 +726,8 @@ static void reset_ram_globals(void)
static int ram_save_setup(QEMUFile *f, void *opaque)
{
RAMBlock *block;
- int64_t ram_pages = last_ram_offset() >> TARGET_PAGE_BITS;
+ int64_t ram_bitmap_pages; /* Size of bitmap in pages, including gaps */
- migration_bitmap = bitmap_new(ram_pages);
- bitmap_set(migration_bitmap, 0, ram_pages);
- migration_dirty_pages = ram_pages;
mig_throttle_on = false;
dirty_rate_high_cnt = 0;
@@ -770,6 +767,22 @@ static int ram_save_setup(QEMUFile *f, void *opaque)
bytes_transferred = 0;
reset_ram_globals();
+ ram_bitmap_pages = last_ram_offset() >> TARGET_PAGE_BITS;
+ migration_bitmap = bitmap_new(ram_bitmap_pages);
+ bitmap_set(migration_bitmap, 0, ram_bitmap_pages);
+
+ /*
+ * Count the total number of pages used by ram blocks not including any
+ * gaps due to alignment or unplugs.
+ */
+ migration_dirty_pages = 0;
+ QTAILQ_FOREACH(block, &ram_list.blocks, next) {
+ uint64_t block_pages;
+
+ block_pages = block->length >> TARGET_PAGE_BITS;
+ migration_dirty_pages += block_pages;
+ }
+
memory_global_dirty_log_start();
migration_bitmap_sync();
qemu_mutex_unlock_iothread();
--
1.9.0
- [Qemu-devel] [PATCH 21/36] savevm: Ignore minimum_version_id_old if there is no load_state_old, (continued)
- [Qemu-devel] [PATCH 21/36] savevm: Ignore minimum_version_id_old if there is no load_state_old, Juan Quintela, 2014/05/05
- [Qemu-devel] [PATCH 22/36] ssi-sd: fix buffer overrun on invalid state load, Juan Quintela, 2014/05/05
- [Qemu-devel] [PATCH 19/36] vmstate: s/VMSTATE_INT32_LE/VMSTATE_INT32_POSITIVE_LE/, Juan Quintela, 2014/05/05
- [Qemu-devel] [PATCH 23/36] openpic: avoid buffer overrun on incoming migration, Juan Quintela, 2014/05/05
- [Qemu-devel] [PATCH 20/36] usb: sanity check setup_index+setup_len in post_load, Juan Quintela, 2014/05/05
- [Qemu-devel] [PATCH 24/36] virtio-net: out-of-bounds buffer write on load, Juan Quintela, 2014/05/05
- [Qemu-devel] [PATCH 27/36] Make qemu_peek_buffer loop until it gets it's data, Juan Quintela, 2014/05/05
- [Qemu-devel] [PATCH 26/36] Disallow outward migration while awaiting incoming migration, Juan Quintela, 2014/05/05
- [Qemu-devel] [PATCH 25/36] virtio: validate config_len on load, Juan Quintela, 2014/05/05
- [Qemu-devel] [PATCH 30/36] Init the XBZRLE.lock in ram_mig_init, Juan Quintela, 2014/05/05
- [Qemu-devel] [PATCH 28/36] Count used RAMBlock pages for migration_dirty_pages,
Juan Quintela <=
- [Qemu-devel] [PATCH 29/36] Provide init function for ram migration, Juan Quintela, 2014/05/05
- [Qemu-devel] [PATCH 31/36] Coverity: Fix failure path for qemu_accept in migration, Juan Quintela, 2014/05/05
- [Qemu-devel] [PATCH 32/36] migration: remove duplicate code, Juan Quintela, 2014/05/05
- [Qemu-devel] [PATCH 33/36] XBZRLE: Fix one XBZRLE corruption issues, Juan Quintela, 2014/05/05
- [Qemu-devel] [PATCH 34/36] migration: Add counts of updating the dirty bitmap, Juan Quintela, 2014/05/05
- [Qemu-devel] [PATCH 35/36] migration: expose the bitmap_sync_count to the end, Juan Quintela, 2014/05/05
- [Qemu-devel] [PATCH 36/36] migration: expose xbzrle cache miss rate, Juan Quintela, 2014/05/05
- [Qemu-devel] [PATCH 02/36] vmstate: add VMS_MUST_EXIST, Juan Quintela, 2014/05/05
- Re: [Qemu-devel] [PULL 00/36] migration queue, Peter Maydell, 2014/05/07