qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

migration/postcopy: postpone setting PostcopyState to END

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

authored by

Wei Yang and committed by
Dr. David Alan Gilbert
2d49bacd 2a461c24

+2 -2
-2
migration/postcopy-ram.c
··· 577 577 } 578 578 } 579 579 580 - postcopy_state_set(POSTCOPY_INCOMING_END); 581 - 582 580 if (mis->postcopy_tmp_page) { 583 581 munmap(mis->postcopy_tmp_page, mis->largest_page_size); 584 582 mis->postcopy_tmp_page = NULL;
+2
migration/savevm.c
··· 1837 1837 1838 1838 rcu_unregister_thread(); 1839 1839 mis->have_listen_thread = false; 1840 + postcopy_state_set(POSTCOPY_INCOMING_END); 1841 + 1840 1842 return NULL; 1841 1843 } 1842 1844