]> git.proxmox.com Git - mirror_qemu.git/commitdiff
migration/postcopy: postpone setting PostcopyState to END
authorWei Yang <richardw.yang@linux.intel.com>
Sun, 6 Oct 2019 00:02:48 +0000 (08:02 +0800)
committerDr. David Alan Gilbert <dgilbert@redhat.com>
Fri, 11 Oct 2019 13:57:22 +0000 (14:57 +0100)
There are two places to call function postcopy_ram_incoming_cleanup()

    postcopy_ram_listen_thread on migration success
    loadvm_postcopy_handle_listen one setup failure

On success, the vm will never accept another migration. On failure,
PostcopyState is transited from LISTENING to END and would be checked in
qemu_loadvm_state_main(). If PostcopyState is RUNNING, migration would
be paused and retried.

Currently PostcopyState is set to END in function
postcopy_ram_incoming_cleanup(). With above analysis, we can take this
step out and postpone this till the end of listen thread to indicate the
listen thread is done.

This is a preparation patch for later cleanup.

Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
Message-Id: <20191006000249.29926-3-richardw.yang@linux.intel.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
  Fixed up in merge to the 1 parameter postcopy_state_set

migration/postcopy-ram.c
migration/savevm.c

index 3a72f7b4fe0337d772da175f3aa8904054adb9e1..a793bad477c9ee39de84056eb793ad14af01bef7 100644 (file)
@@ -577,8 +577,6 @@ int postcopy_ram_incoming_cleanup(MigrationIncomingState *mis)
         }
     }
 
-    postcopy_state_set(POSTCOPY_INCOMING_END);
-
     if (mis->postcopy_tmp_page) {
         munmap(mis->postcopy_tmp_page, mis->largest_page_size);
         mis->postcopy_tmp_page = NULL;
index c62687afef0f36b216747eca3f60bfc7ecda6367..bf3da58ecc1e92356f4dd3ea5ed39b724b76d3ea 100644 (file)
@@ -1837,6 +1837,8 @@ static void *postcopy_ram_listen_thread(void *opaque)
 
     rcu_unregister_thread();
     mis->have_listen_thread = false;
+    postcopy_state_set(POSTCOPY_INCOMING_END);
+
     return NULL;
 }