qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] migration: flush the bdrv before stopping VM
@ 2015-03-17  8:53 Liang Li
  2015-03-17 12:12 ` Juan Quintela
  0 siblings, 1 reply; 17+ messages in thread
From: Liang Li @ 2015-03-17  8:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: amit.shah, yang.z.zhang, Liang Li, quintela

If there are file write operations in the guest when doing live
migration, the VM downtime will be much longer than the max_downtime,
this is caused by bdrv_flush_all(), this function is a time consuming
operation if there a lot of data have to be flushed to disk.

By adding bdrv_flush_all() before VM stop, we can reduce the time
consumed by bdrv_flush_all() in vm_stop_force_state, this means the
VM down time can be reduced.

The test shows this optimization can help to reduce the VM downtime
from more than 20 seconds to about 100 milliseconds.

Signed-off-by: Liang Li <liang.z.li@intel.com>
---
 migration/migration.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/migration/migration.c b/migration/migration.c
index 2c805f1..fc4735c 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -655,6 +655,10 @@ static void *migration_thread(void *opaque)
                 qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER);
                 old_vm_running = runstate_is_running();
 
+                /* do flush here is aimed to shorten the VM downtime,
+                 * bdrv_flush_all is a time consuming operation
+                 * when the guest has done some file writing */
+                bdrv_flush_all();
                 ret = vm_stop_force_state(RUN_STATE_FINISH_MIGRATE);
                 if (ret >= 0) {
                     qemu_file_set_rate_limit(s->file, INT64_MAX);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2015-06-25 12:34 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-17  8:53 [Qemu-devel] [PATCH] migration: flush the bdrv before stopping VM Liang Li
2015-03-17 12:12 ` Juan Quintela
2015-03-18  3:19   ` Li, Liang Z
2015-03-18 11:17     ` Kevin Wolf
2015-03-18 12:36       ` Juan Quintela
2015-03-18 12:59         ` Paolo Bonzini
2015-03-18 13:42         ` Kevin Wolf
2015-03-20  7:22         ` Li, Liang Z
2015-03-25 10:50           ` Juan Quintela
2015-03-25 10:53             ` Kevin Wolf
2015-03-26  1:13               ` Li, Liang Z
2015-06-24 11:08               ` Li, Liang Z
2015-06-25 12:34                 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2015-03-18 13:39       ` [Qemu-devel] " Li, Liang Z
2015-03-18 16:55         ` Dr. David Alan Gilbert
2015-03-19 14:06           ` Li, Liang Z
2015-03-19 14:40             ` Dr. David Alan Gilbert

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).