Message ID | 1439413464-7326-2-git-send-email-liang.z.li@intel.com |
---|---|
State | New |
Headers | show |
On 12/08/2015 23:04, Liang Li wrote: > @@ -1008,8 +1009,10 @@ static void *migration_thread(void *opaque) > } > > qemu_mutex_lock_iothread(); > + end_time = qemu_clock_get_ms(QEMU_CLOCK_REALTIME); > + qemu_savevm_state_cancel(); > + You can remove the qemu_savevm_state_cancel() call from migrate_fd_cleanup, too. Probably best to post a v2 with that change as well. Paolo
> > On 12/08/2015 23:04, Liang Li wrote: > > @@ -1008,8 +1009,10 @@ static void *migration_thread(void *opaque) > > } > > > > qemu_mutex_lock_iothread(); > > + end_time = qemu_clock_get_ms(QEMU_CLOCK_REALTIME); > > + qemu_savevm_state_cancel(); > > + > > You can remove the qemu_savevm_state_cancel() call from > migrate_fd_cleanup, too. Probably best to post a v2 with that change as well. > > Paolo You are right. Done. Liang
diff --git a/migration/block.c b/migration/block.c index ed865ed..85496fd 100644 --- a/migration/block.c +++ b/migration/block.c @@ -750,7 +750,6 @@ static int block_save_complete(QEMUFile *f, void *opaque) qemu_put_be64(f, BLK_MIG_FLAG_EOS); - blk_mig_cleanup(); return 0; } diff --git a/migration/migration.c b/migration/migration.c index 662e77e..c22095e 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -923,6 +923,7 @@ static void *migration_thread(void *opaque) int64_t initial_bytes = 0; int64_t max_size = 0; int64_t start_time = initial_time; + int64_t end_time; bool old_vm_running = false; rcu_register_thread(); @@ -1008,8 +1009,10 @@ static void *migration_thread(void *opaque) } qemu_mutex_lock_iothread(); + end_time = qemu_clock_get_ms(QEMU_CLOCK_REALTIME); + qemu_savevm_state_cancel(); + if (s->state == MIGRATION_STATUS_COMPLETED) { - int64_t end_time = qemu_clock_get_ms(QEMU_CLOCK_REALTIME); uint64_t transferred_bytes = qemu_ftell(s->file); s->total_time = end_time - s->total_time; s->downtime = end_time - start_time; diff --git a/migration/ram.c b/migration/ram.c index 7f007e6..6249f6e 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1269,7 +1269,6 @@ static int ram_save_complete(QEMUFile *f, void *opaque) rcu_read_unlock(); - migration_end(); qemu_put_be64(f, RAM_SAVE_FLAG_EOS); return 0;
Because of the patch 3ea3b7fa9af067982f34b of kvm, now the migration_end() is a time consuming operation, which takes about dozens of milliseconds, and will prolong VM downtime. Such an operation should be done after migration completion. For a VM with 8G RAM, this patch can reduce the VM downtime about 32 ms during live migration. Signed-off-by: Liang Li <liang.z.li@intel.com> --- migration/block.c | 1 - migration/migration.c | 5 ++++- migration/ram.c | 1 - 3 files changed, 4 insertions(+), 3 deletions(-)