Skip to contentSkip to conversation

Migration fixes

PATCH Applied Glauber Costa 2 participants 6 messages Mar 31, 2009 – Apr 5, 2009

lore
Share & tools
lore
#0 lore raw

v2 cover Migration fixes

Same thing, with comments addressed.

#1 lore raw

PATCH v2 1/3 stop dirty tracking just at the end of migration

If there is still work to do, it is not safe to assume we can end the dirty tracking. Specifically, kvm can update the dirty tracking log inside ram_save_block(), leaving pages still out of sync if we go with the current code.

Based on a patch by Yaniv Kamay

---
 vl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
vl.c +1 -1
index 5e6c621..1626f8a 100644
@@ -3249,10 +3249,10 @@ static int ram_save_live(QEMUFile *f, int stage, void *opaque)
     /* try transferring iterative blocks of memory */
 
     if (stage == 3) {
-        cpu_physical_memory_set_dirty_tracking(0);
 
         /* flush all remaining blocks regardless of rate limiting */
         while (ram_save_block(f) != 0);
+        cpu_physical_memory_set_dirty_tracking(0);
     }
 
     qemu_put_be64(f, RAM_SAVE_FLAG_EOS);
Signature · 1 line
1.5.6.6
#2 lore raw

PATCH v2 2/3 create qemu_file_set_error

This is mainly for consistency, since we don't want anything outside of savevm setting it explicitly. There are current no users of that in qemu tree, but there are potential candidates on kvm-userspace. And avi is a nice guy, let's be nice with him.

Based on a patch by Yaniv Kamay

---
 hw/hw.h  |    1 +
 savevm.c |    5 +++++
 2 files changed, 6 insertions(+), 0 deletions(-)
hw/hw.h +1 -0
index eab7bb4..e9628d4 100644
@@ -67,6 +67,7 @@ unsigned int qemu_get_be32(QEMUFile *f);
 uint64_t qemu_get_be64(QEMUFile *f);
 int qemu_file_rate_limit(QEMUFile *f);
 int qemu_file_has_error(QEMUFile *f);
+void qemu_file_set_error(QEMUFile *f);
 
 /* Try to send any outstanding data.  This function is useful when output is
  * halted due to rate limiting or EAGAIN errors occur as it can be used to
savevm.c +5 -0
index ce12628..9f81d07 100644
@@ -370,6 +370,11 @@ int qemu_file_has_error(QEMUFile *f)
     return f->has_error;
 }
 
+void qemu_file_set_error(QEMUFile *f)
+{
+    f->has_error = 1;
+}
+
 void qemu_fflush(QEMUFile *f)
 {
     if (!f->put_buffer)
Signature · 1 line
1.5.6.6
#3 lore raw

PATCH v2 3/3 propagate error on failed completion

migrate_fd_put_ready() calls qemu_savevm_state_complete(), but the later can fail.

If it happens, re-start the vm and propagate the error up

Based on a patch by Yaniv Kamay

---
 migration.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
migration.c +8 -2
index b3904b2..859d945 100644
@@ -220,13 +220,19 @@ void migrate_fd_put_ready(void *opaque)
 
     dprintf("iterate\n");
     if (qemu_savevm_state_iterate(s->file) == 1) {
+        int state;
         dprintf("done iterating\n");
         vm_stop(0);
 
         bdrv_flush_all();
-        qemu_savevm_state_complete(s->file);
-        s->state = MIG_STATE_COMPLETED;
+        if ((qemu_savevm_state_complete(s->file)) < 0) {
+            vm_start();
+            state = MIG_STATE_ERROR;
+        } else {
+            state = MIG_STATE_COMPLETED;
+        }
         migrate_fd_cleanup(s);
+        s->state = state;
     }
 }
 
Signature · 1 line
1.5.6.6
#4 lore raw

Re: [Qemu-devel] [PATCH v2 1/3] stop dirty tracking just at the end of migration

In reply to Glauber Costa
Quoted 9 lines · Glauber Costa

If there is still work to do, it is not safe to assume we can end the dirty tracking. Specifically, kvm can update the dirty tracking log inside ram_save_block(), leaving pages still out of sync if we go with the current code.

Based on a patch by Yaniv Kamay

Applied all. Thanks.

Signature · 3 lines
Regards,

Anthony Liguori
#5 lore raw

Re: [Qemu-devel] [PATCH v2 1/3] stop dirty tracking just at the end of migration

In reply to Glauber Costa
Quoted 8 lines · Glauber Costa

If there is still work to do, it is not safe to assume we can end the dirty tracking. Specifically, kvm can update the dirty tracking log inside ram_save_block(), leaving pages still out of sync if we go with the current code.

Based on a patch by Yaniv Kamay

Applied to stable. Thanks.

Signature · 3 lines
Regards,

Anthony Liguori