summaryrefslogtreecommitdiffstats
path: root/migration/savevm.c
diff options
context:
space:
mode:
authorPeter Maydell2016-02-26 16:21:26 +0100
committerPeter Maydell2016-02-26 16:21:26 +0100
commitaa53d5bfc35d73099184bdd1c538591a5f795c9e (patch)
tree8237a541ab46539a971040d1a377814940749c4a /migration/savevm.c
parentMerge remote-tracking branch 'remotes/lalrae/tags/mips-20160226' into staging (diff)
parentmigration (postcopy): move bdrv_invalidate_cache_all of of coroutine context (diff)
downloadqemu-aa53d5bfc35d73099184bdd1c538591a5f795c9e.tar.gz
qemu-aa53d5bfc35d73099184bdd1c538591a5f795c9e.tar.xz
qemu-aa53d5bfc35d73099184bdd1c538591a5f795c9e.zip
Merge remote-tracking branch 'remotes/amit-migration/tags/migration-for-2.6-5' into staging
migration pull - fix a qcow2 assert - fix for older distros (CentOS 5) - documentation for vmstate flags - minor code rearrangement # gpg: Signature made Fri 26 Feb 2016 15:15:15 GMT using RSA key ID 854083B6 # gpg: Good signature from "Amit Shah <amit@amitshah.net>" # gpg: aka "Amit Shah <amit@kernel.org>" # gpg: aka "Amit Shah <amitshah@gmx.net>" * remotes/amit-migration/tags/migration-for-2.6-5: migration (postcopy): move bdrv_invalidate_cache_all of of coroutine context migration (ordinary): move bdrv_invalidate_cache_all of of coroutine context migration/vmstate: document VMStateFlags MAINTAINERS: Add docs/migration.txt to the "Migration" section migration/postcopy-ram: Guard use of sys/eventfd.h with CONFIG_EVENTFD migration: reorder code to make it symmetric Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'migration/savevm.c')
-rw-r--r--migration/savevm.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/migration/savevm.c b/migration/savevm.c
index 94f2894243..b45915612f 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -1088,12 +1088,11 @@ void qemu_savevm_state_complete_precopy(QEMUFile *f, bool iterable_only)
json_prop_int(vmdesc, "instance_id", se->instance_id);
save_section_header(f, se, QEMU_VM_SECTION_FULL);
-
vmstate_save(f, se, vmdesc);
-
- json_end_object(vmdesc);
trace_savevm_section_end(se->idstr, se->section_id, 0);
save_section_footer(f, se);
+
+ json_end_object(vmdesc);
}
if (!in_postcopy) {
@@ -1496,17 +1495,10 @@ static int loadvm_postcopy_handle_listen(MigrationIncomingState *mis)
return 0;
}
-/* After all discards we can start running and asking for pages */
-static int loadvm_postcopy_handle_run(MigrationIncomingState *mis)
+static void loadvm_postcopy_handle_run_bh(void *opaque)
{
- PostcopyState ps = postcopy_state_set(POSTCOPY_INCOMING_RUNNING);
Error *local_err = NULL;
-
- trace_loadvm_postcopy_handle_run();
- if (ps != POSTCOPY_INCOMING_LISTENING) {
- error_report("CMD_POSTCOPY_RUN in wrong postcopy state (%d)", ps);
- return -1;
- }
+ MigrationIncomingState *mis = opaque;
/* TODO we should move all of this lot into postcopy_ram.c or a shared code
* in migration.c
@@ -1519,7 +1511,6 @@ static int loadvm_postcopy_handle_run(MigrationIncomingState *mis)
bdrv_invalidate_cache_all(&local_err);
if (local_err) {
error_report_err(local_err);
- return -1;
}
trace_loadvm_postcopy_handle_run_cpu_sync();
@@ -1535,6 +1526,23 @@ static int loadvm_postcopy_handle_run(MigrationIncomingState *mis)
runstate_set(RUN_STATE_PAUSED);
}
+ qemu_bh_delete(mis->bh);
+}
+
+/* After all discards we can start running and asking for pages */
+static int loadvm_postcopy_handle_run(MigrationIncomingState *mis)
+{
+ PostcopyState ps = postcopy_state_set(POSTCOPY_INCOMING_RUNNING);
+
+ trace_loadvm_postcopy_handle_run();
+ if (ps != POSTCOPY_INCOMING_LISTENING) {
+ error_report("CMD_POSTCOPY_RUN in wrong postcopy state (%d)", ps);
+ return -1;
+ }
+
+ mis->bh = qemu_bh_new(loadvm_postcopy_handle_run_bh, NULL);
+ qemu_bh_schedule(mis->bh);
+
/* We need to finish reading the stream from the package
* and also stop reading anything more from the stream that loaded the
* package (since it's now being read by the listener thread).