Skip to contentSkip to conversation

migration cleanup fixes

PATCH New Dr. David Alan Gilbert (git) 1 participant 3 messages Sep 14, 2018

lore
Share & tools
lore
#0 lore raw

cover migration cleanup fixes

From: "Dr. David Alan Gilbert" <[email protected]>

This is a pair of related migration fixes for cases where the loadvm state doesn't get cleaned up.

In the first case this is because the code hasn't cleared the postcopy flag, and so a following loadvm gets very confused (leading to it not cleaning up the loadvm state or syncing the CPUs leading to no interrupts and a very confused guest).

In the second case I just noticed a few return cases where it didn't get cleaned up in error paths.

Dave

Dr. David Alan Gilbert (2):
migration/postcopy: Clear have_listen_thread
migration: cleanup in error paths in loadvm

 migration/savevm.c | 3 +++
 1 file changed, 3 insertions(+)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/2 migration/postcopy: Clear have_listen_thread

From: "Dr. David Alan Gilbert" <[email protected]>

Clear have_listen_thread when we exit the thread.
The fallout from this was that various things thought there was an ongoing postcopy after the postcopy had finished.

The case that failed was postcopy->savevm->loadvm.

This corresponds to RH bug https://bugzilla.redhat.com/show_bug.cgi?id=1608765

---
 migration/savevm.c | 1 +
 1 file changed, 1 insertion(+)
migration/savevm.c +1 -0
index 13e51f0e34..6384cf676d 100644
@@ -1679,6 +1679,7 @@ static void *postcopy_ram_listen_thread(void *opaque)
     qemu_loadvm_state_cleanup();
 
     rcu_unregister_thread();
+    mis->have_listen_thread = false;
     return NULL;
 }
 
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/2 migration: cleanup in error paths in loadvm

In reply to Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

There's a couple of error paths in qemu_loadvm_state which happen early on but after we've initialised the load state; that needs to be cleaned up otherwise we can hit asserts if the state gets reinitialised later.

---
 migration/savevm.c | 2 ++
 1 file changed, 2 insertions(+)
migration/savevm.c +2 -0
index 6384cf676d..534f7daf31 100644
@@ -2331,11 +2331,13 @@ int qemu_loadvm_state(QEMUFile *f)
     if (migrate_get_current()->send_configuration) {
         if (qemu_get_byte(f) != QEMU_VM_CONFIGURATION) {
             error_report("Configuration section missing");
+            qemu_loadvm_state_cleanup();
             return -EINVAL;
         }
         ret = vmstate_load_state(f, &vmstate_configuration, &savevm_state, 0);
 
         if (ret) {
+            qemu_loadvm_state_cleanup();
             return ret;
         }
     }
Signature · 1 line
2.17.1