[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 34/35] postcopy/outgoing: introduce precopy_count
From: |
Isaku Yamahata |
Subject: |
[Qemu-devel] [PATCH v3 34/35] postcopy/outgoing: introduce precopy_count parameter |
Date: |
Tue, 30 Oct 2012 17:33:10 +0900 |
Precopy with this loop number before postcopy mode.
This will be implemented by the next patch.
Signed-off-by: Isaku Yamahata <address@hidden>
---
hmp-commands.hx | 10 ++++++----
hmp.c | 2 ++
migration-postcopy.c | 2 +-
migration.c | 2 ++
migration.h | 3 ++-
qapi-schema.json | 4 +++-
qmp-commands.hx | 2 +-
savevm.c | 3 ++-
8 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/hmp-commands.hx b/hmp-commands.hx
index 942f620..957bf76 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -826,9 +826,10 @@ ETEXI
{
.name = "migrate",
- .args_type =
"detach:-d,blk:-b,inc:-i,postcopy:-p,movebg:-m,nobg:-n,uri:s,"
- "forward:i?,backward:i?",
- .params = "[-d] [-b] [-i] [-p [-n] [-m]] uri [forward] [backword]",
+ .args_type = "detach:-d,blk:-b,inc:-i,postcopy:-p,movebg:-m,nobg:-n,"
+ "uri:s,precopy_count:i?,forward:i?,backward:i?",
+ .params = "[-d] [-b] [-i] [-p [-n] [-m]] uri "
+ "[precopy_count] [forward] [backword]",
.help = "migrate to URI (using -d to not wait for completion)"
"\n\t\t\t -b for migration without shared storage with"
" full copy of disk\n\t\t\t -i for migration without "
@@ -837,6 +838,7 @@ ETEXI
"\n\t\t\t-p for migration with postcopy mode enabled"
"\n\t\t\t-m for move background transfer of postcopy mode"
"\n\t\t\t-n for no background transfer of postcopy mode"
+ "\n\t\t\tprecopy_count: loop of precopy when postcopy"
"\n\t\t\tforward: the number of pages to "
"forward-prefault when postcopy (default 0)"
"\n\t\t\tbackward: the number of pages to "
@@ -846,7 +848,7 @@ ETEXI
STEXI
address@hidden migrate [-d] [-b] [-i] [-p [-n] [-m]] @var{uri} @var{forward}
@var{backward}
address@hidden migrate [-d] [-b] [-i] [-p [-n] [-m]] @var{uri}
@var{precopy_count} @var{forward} @var{backward}
@findex migrate
Migrate to @var{uri} (using -d to not wait for completion).
-b for migration with full copy of disk
diff --git a/hmp.c b/hmp.c
index a0bd869..be88db9 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1038,6 +1038,7 @@ void hmp_migrate(Monitor *mon, const QDict *qdict)
int postcopy = qdict_get_try_bool(qdict, "postcopy", 0);
int movebg = qdict_get_try_bool(qdict, "movebg", 0);
int nobg = qdict_get_try_bool(qdict, "nobg", 0);
+ int precopy_count = qdict_get_try_int(qdict, "precopy_count", 0);
int forward = qdict_get_try_int(qdict, "forward", 0);
int backward = qdict_get_try_int(qdict, "backward", 0);
const char *uri = qdict_get_str(qdict, "uri");
@@ -1045,6 +1046,7 @@ void hmp_migrate(Monitor *mon, const QDict *qdict)
qmp_migrate(uri, !!blk, blk, !!inc, inc, false, false,
!!postcopy, postcopy, !!movebg, movebg, !!nobg, nobg,
+ !!precopy_count, precopy_count,
!!forward, forward, !!backward, backward,
&err);
if (err) {
diff --git a/migration-postcopy.c b/migration-postcopy.c
index 9298cd4..8a43c42 100644
--- a/migration-postcopy.c
+++ b/migration-postcopy.c
@@ -319,7 +319,7 @@ int postcopy_outgoing_create_read_socket(MigrationState *s)
return 0;
}
-void postcopy_outgoing_state_begin(QEMUFile *f)
+void postcopy_outgoing_state_begin(QEMUFile *f, const MigrationParams *params)
{
uint64_t options = 0;
qemu_put_ubyte(f, QEMU_VM_POSTCOPY_INIT);
diff --git a/migration.c b/migration.c
index 057ea31..84ca4b3 100644
--- a/migration.c
+++ b/migration.c
@@ -513,6 +513,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
bool has_postcopy, bool postcopy,
bool has_movebg, bool movebg,
bool has_nobg, bool nobg,
+ bool has_precopy_count, int64_t precopy_count,
bool has_forward, int64_t forward,
bool has_backward, int64_t backward,
Error **errp)
@@ -527,6 +528,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
params.postcopy = postcopy;
params.nobg = nobg;
params.movebg = movebg;
+ params.precopy_count = precopy_count,
params.prefault_forward = 0;
if (has_forward) {
if (forward < 0) {
diff --git a/migration.h b/migration.h
index 2801e7e..c4d7b0a 100644
--- a/migration.h
+++ b/migration.h
@@ -27,6 +27,7 @@ struct MigrationParams {
bool postcopy;
bool nobg;
bool movebg;
+ int precopy_count;
int64_t prefault_forward;
int64_t prefault_backward;
};
@@ -150,7 +151,7 @@ int64_t xbzrle_cache_resize(int64_t new_size);
/* For outgoing postcopy */
int postcopy_outgoing_create_read_socket(MigrationState *s);
-void postcopy_outgoing_state_begin(QEMUFile *f);
+void postcopy_outgoing_state_begin(QEMUFile *f, const MigrationParams *params);
void postcopy_outgoing_state_complete(
QEMUFile *f, const uint8_t *buffer, size_t buffer_size);
int postcopy_outgoing_ram_save_iterate(QEMUFile *f, void *opaque);
diff --git a/qapi-schema.json b/qapi-schema.json
index cf5d988..5c4d2f2 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -2089,6 +2089,8 @@
# @detach: this argument exists only for compatibility reasons and
# is ignored by QEMU
#
+# @precopy_count: #optional the number of loops of precopy when postcopy
+#
# Returns: nothing on success
#
# Since: 0.14.0
@@ -2096,7 +2098,7 @@
{ 'command': 'migrate',
'data': {'uri': 'str', '*blk': 'bool', '*inc': 'bool', '*detach': 'bool' ,
'*postcopy': 'bool', '*movebg': 'bool', '*nobg': 'bool',
- '*forward': 'int', '*backward': 'int'} }
+ '*precopy_count': 'int', '*forward': 'int', '*backward': 'int'} }
# @xen-save-devices-state:
#
diff --git a/qmp-commands.hx b/qmp-commands.hx
index 7028ece..b8cf174 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -518,7 +518,7 @@ EQMP
{
.name = "migrate",
- .args_type =
"detach:-d,blk:-b,inc:-i,postcopy:-p,movebg:-m,nobg:-n,uri:s",
+ .args_type =
"detach:-d,blk:-b,inc:-i,postcopy:-p,movebg:-m,nobg:-n,uri:s,precopy_cout:i?",
.mhandler.cmd_new = qmp_marshal_input_migrate,
},
diff --git a/savevm.c b/savevm.c
index 8d26354..32781e1 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1650,7 +1650,7 @@ int qemu_savevm_state_begin(QEMUFile *f,
if (params->postcopy) {
/* tell this is postcopy */
qemu_put_byte(f, QEMU_VM_POSTCOPY);
- postcopy_outgoing_state_begin(f);
+ postcopy_outgoing_state_begin(f, params);
}
QTAILQ_FOREACH(se, &savevm_handlers, entry) {
@@ -1839,6 +1839,7 @@ static int qemu_savevm_state(QEMUFile *f)
.blk = 0,
.shared = 0,
.postcopy = 0,
+ .precopy_count = 0,
.movebg = 0,
.nobg = 0,
};
--
1.7.10.4
- [Qemu-devel] [PATCH v3 33/35] arch_init: export migration_bitmap_sync and helper method to get bitmap, (continued)
- [Qemu-devel] [PATCH v3 33/35] arch_init: export migration_bitmap_sync and helper method to get bitmap, Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 29/35] postcopy/outgoing: add movebg mode(-m) to migration command, Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 24/35] postcopy outgoing: add -p option to migrate command, Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 07/35] savevm: export qemu_peek_buffer, qemu_peek_byte, qemu_file_skip, qemu_fflush, Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 15/35] arch_init/ram_save_setup: factor out bitmap alloc/free, Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 19/35] uvmem.h: import Linux uvmem.h and teach update-linux-headers.sh, Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 31/35] arch_init: export ram_save_iterate(), Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 28/35] arch_init: factor out setting last_block, last_offset, Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 17/35] arch_init: factor out logic to find ram block with id string, Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 18/35] migration: export migrate_fd_completed() and migrate_fd_cleanup(), Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 34/35] postcopy/outgoing: introduce precopy_count parameter,
Isaku Yamahata <=
- [Qemu-devel] [PATCH v3 16/35] arch_init/ram_load: refactor ram_load, Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 13/35] arch_init/ram_save: introduce constant for ram save version = 4, Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 30/35] arch_init: factor out ram_load, Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 22/35] savevm: add new section that is used by postcopy, Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 32/35] postcopy: pre+post optimization incoming side, Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 21/35] postcopy: introduce helper functions for postcopy, Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 35/35] postcopy: pre+post optimization outgoing side, Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 27/35] postcopy/outgoing: implement forward/backword prefault, Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 23/35] postcopy: implement incoming part of postcopy live migration, Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 25/35] postcopy: implement outgoing part of postcopy live migration, Isaku Yamahata, 2012/10/30