[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH COLO-Frame v16 27/35] migration/savevm: Add new help
From: |
zhanghailiang |
Subject: |
[Qemu-devel] [PATCH COLO-Frame v16 27/35] migration/savevm: Add new helpers to process the different stages of loadvm |
Date: |
Fri, 8 Apr 2016 14:26:29 +0800 |
There are several stages during loadvm process. In different stage,
migration incoming processes different section.
We want to control these stages more accuracy, to optimize the COLO
capability.
Here we add two new helper functions: qemu_loadvm_state_begin()
and qemu_load_device_state().
Besides, we make qemu_loadvm_state_main() API public.
Signed-off-by: zhanghailiang <address@hidden>
Signed-off-by: Li Zhijian <address@hidden>
Reviewed-by: Dr. David Alan Gilbert <address@hidden>
---
v16:
- Add Reviewed-by
v14:
- Split from patch 'COLO: Separate the process of saving/loading
ram and device state
---
include/sysemu/sysemu.h | 3 +++
migration/savevm.c | 38 +++++++++++++++++++++++++++++++++++---
2 files changed, 38 insertions(+), 3 deletions(-)
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 8537bed..2e8f397 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -133,6 +133,9 @@ void qemu_savevm_send_postcopy_ram_discard(QEMUFile *f,
const char *name,
uint64_t *length_list);
int qemu_loadvm_state(QEMUFile *f);
+int qemu_loadvm_state_begin(QEMUFile *f);
+int qemu_loadvm_state_main(QEMUFile *f, MigrationIncomingState *mis);
+int qemu_load_device_state(QEMUFile *f);
typedef enum DisplayType
{
diff --git a/migration/savevm.c b/migration/savevm.c
index e9ddcca..c1f57a6 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -1253,8 +1253,6 @@ enum LoadVMExitCodes {
LOADVM_QUIT = 1,
};
-static int qemu_loadvm_state_main(QEMUFile *f, MigrationIncomingState *mis);
-
/* ------ incoming postcopy messages ------ */
/* 'advise' arrives before any transfers just to tell us that a postcopy
* *might* happen - it might be skipped if precopy transferred everything
@@ -1853,7 +1851,7 @@ qemu_loadvm_section_part_end(QEMUFile *f,
MigrationIncomingState *mis)
return 0;
}
-static int qemu_loadvm_state_main(QEMUFile *f, MigrationIncomingState *mis)
+int qemu_loadvm_state_main(QEMUFile *f, MigrationIncomingState *mis)
{
uint8_t section_type;
int ret;
@@ -1986,6 +1984,40 @@ int qemu_loadvm_state(QEMUFile *f)
return ret;
}
+int qemu_loadvm_state_begin(QEMUFile *f)
+{
+ MigrationIncomingState *mis = migration_incoming_get_current();
+ Error *local_err = NULL;
+ int ret;
+
+ if (qemu_savevm_state_blocked(&local_err)) {
+ error_report_err(local_err);
+ return -EINVAL;
+ }
+ /* Load QEMU_VM_SECTION_START section */
+ ret = qemu_loadvm_state_main(f, mis);
+ if (ret < 0) {
+ error_report("Failed to loadvm begin work: %d", ret);
+ }
+ return ret;
+}
+
+int qemu_load_device_state(QEMUFile *f)
+{
+ MigrationIncomingState *mis = migration_incoming_get_current();
+ int ret;
+
+ /* Load QEMU_VM_SECTION_FULL section */
+ ret = qemu_loadvm_state_main(f, mis);
+ if (ret < 0) {
+ error_report("Failed to load device state: %d", ret);
+ return ret;
+ }
+
+ cpu_synchronize_all_post_init();
+ return 0;
+}
+
void hmp_savevm(Monitor *mon, const QDict *qdict)
{
BlockDriverState *bs, *bs1;
--
1.8.3.1
- Re: [Qemu-devel] [PATCH COLO-Frame v16 13/35] COLO: Load VMState into qsb before restore it, (continued)
- [Qemu-devel] [PATCH COLO-Frame v16 10/35] COLO: Save PVM state to secondary side when do checkpoint, zhanghailiang, 2016/04/08
- [Qemu-devel] [PATCH COLO-Frame v16 14/35] COLO: Flush PVM's cached RAM into SVM's memory, zhanghailiang, 2016/04/08
- [Qemu-devel] [PATCH COLO-Frame v16 12/35] ram/COLO: Record the dirty pages that SVM received, zhanghailiang, 2016/04/08
- [Qemu-devel] [PATCH COLO-Frame v16 23/35] COLO failover: Don't do failover during loading VM's state, zhanghailiang, 2016/04/08
- [Qemu-devel] [PATCH COLO-Frame v16 20/35] COLO: Implement failover work for Secondary VM, zhanghailiang, 2016/04/08
- [Qemu-devel] [PATCH COLO-Frame v16 16/35] COLO: synchronize PVM's state to SVM periodically, zhanghailiang, 2016/04/08
- [Qemu-devel] [PATCH COLO-Frame v16 26/35] savevm: Introduce two helper functions for save/find loadvm_handlers entry, zhanghailiang, 2016/04/08
- [Qemu-devel] [PATCH COLO-Frame v16 27/35] migration/savevm: Add new helpers to process the different stages of loadvm,
zhanghailiang <=
- [Qemu-devel] [PATCH COLO-Frame v16 28/35] migration/savevm: Export two helper functions for savevm process, zhanghailiang, 2016/04/08
- [Qemu-devel] [PATCH COLO-Frame v16 24/35] COLO: Process shutdown command for VM in COLO state, zhanghailiang, 2016/04/08
- [Qemu-devel] [PATCH COLO-Frame v16 21/35] qmp event: Add COLO_EXIT event to notify users while exited from COLO, zhanghailiang, 2016/04/08
- [Qemu-devel] [PATCH COLO-Frame v16 19/35] COLO: Implement failover work for Primary VM, zhanghailiang, 2016/04/08
- [Qemu-devel] [PATCH COLO-Frame v16 11/35] COLO: Load PVM's dirty pages into SVM's RAM cache temporarily, zhanghailiang, 2016/04/08
- [Qemu-devel] [PATCH COLO-Frame v16 17/35] COLO failover: Introduce a new command to trigger a failover, zhanghailiang, 2016/04/08
- [Qemu-devel] [PATCH COLO-Frame v16 18/35] COLO failover: Introduce state to record failover process, zhanghailiang, 2016/04/08
- [Qemu-devel] [PATCH COLO-Frame v16 25/35] COLO: Update the global runstate after going into colo state, zhanghailiang, 2016/04/08