[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 29/35] postcopy/outgoing: add movebg mode(-m) to
From: |
Isaku Yamahata |
Subject: |
[Qemu-devel] [PATCH v3 29/35] postcopy/outgoing: add movebg mode(-m) to migration command |
Date: |
Tue, 30 Oct 2012 17:33:05 +0900 |
When movebg mode is enabled, the point to send background page is set
to the next page to on-demand page.
Signed-off-by: Isaku Yamahata <address@hidden>
---
hmp-commands.hx | 8 +++++---
hmp.c | 3 ++-
migration-postcopy.c | 8 ++++++++
migration.c | 5 ++++-
migration.h | 1 +
qapi-schema.json | 2 +-
qmp-commands.hx | 2 +-
savevm.c | 1 +
8 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/hmp-commands.hx b/hmp-commands.hx
index 5e2c77c..942f620 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -826,15 +826,16 @@ ETEXI
{
.name = "migrate",
- .args_type = "detach:-d,blk:-b,inc:-i,postcopy:-p,nobg:-n,uri:s,"
+ .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] uri [forward] [backword]",
+ .params = "[-d] [-b] [-i] [-p [-n] [-m]] uri [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 "
"shared storage with incremental copy of disk "
"(base image shared between src and destination)"
"\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\tforward: the number of pages to "
"forward-prefault when postcopy (default 0)"
@@ -845,12 +846,13 @@ ETEXI
STEXI
address@hidden migrate [-d] [-b] [-i] [-p [-n]] @var{uri} @var{forward}
@var{backward}
address@hidden migrate [-d] [-b] [-i] [-p [-n] [-m]] @var{uri} @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
-i for migration with incremental copy of disk (base image is shared)
-p for migration with postcopy mode enabled (forward/backward is
prefault size when postcopy)
+ -m for migratoin with postcopy mode enabled with moving position
-n for migration with postcopy mode enabled without background transfer
ETEXI
diff --git a/hmp.c b/hmp.c
index fb1275d..a0bd869 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1036,6 +1036,7 @@ void hmp_migrate(Monitor *mon, const QDict *qdict)
int blk = qdict_get_try_bool(qdict, "blk", 0);
int inc = qdict_get_try_bool(qdict, "inc", 0);
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 forward = qdict_get_try_int(qdict, "forward", 0);
int backward = qdict_get_try_int(qdict, "backward", 0);
@@ -1043,7 +1044,7 @@ void hmp_migrate(Monitor *mon, const QDict *qdict)
Error *err = NULL;
qmp_migrate(uri, !!blk, blk, !!inc, inc, false, false,
- !!postcopy, postcopy, !!nobg, nobg,
+ !!postcopy, postcopy, !!movebg, movebg, !!nobg, nobg,
!!forward, forward, !!backward, backward,
&err);
if (err) {
diff --git a/migration-postcopy.c b/migration-postcopy.c
index 3d51898..421fb39 100644
--- a/migration-postcopy.c
+++ b/migration-postcopy.c
@@ -432,6 +432,14 @@ static int
postcopy_outgoing_handle_req(PostcopyOutgoingState *s,
true, j);
}
}
+ if (s->ms->params.movebg) {
+ ram_addr_t last_offset =
+ (req->pgoffs[req->nr - 1] + s->ms->params.prefault_forward) <<
+ TARGET_PAGE_BITS;
+ last_offset = MIN(last_offset,
+ s->last_block_read->length - TARGET_PAGE_SIZE);
+ ram_save_set_last_block(s->last_block_read, last_offset);
+ }
/* backward prefault */
for (j = 1; j <= s->ms->params.prefault_backward; j++) {
for (i = 0; i < req->nr; i++) {
diff --git a/migration.c b/migration.c
index f29e3bb..057ea31 100644
--- a/migration.c
+++ b/migration.c
@@ -510,7 +510,9 @@ void migrate_del_blocker(Error *reason)
void qmp_migrate(const char *uri, bool has_blk, bool blk,
bool has_inc, bool inc, bool has_detach, bool detach,
- bool has_postcopy, bool postcopy, bool has_nobg, bool nobg,
+ bool has_postcopy, bool postcopy,
+ bool has_movebg, bool movebg,
+ bool has_nobg, bool nobg,
bool has_forward, int64_t forward,
bool has_backward, int64_t backward,
Error **errp)
@@ -524,6 +526,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
params.shared = inc;
params.postcopy = postcopy;
params.nobg = nobg;
+ params.movebg = movebg;
params.prefault_forward = 0;
if (has_forward) {
if (forward < 0) {
diff --git a/migration.h b/migration.h
index 8462251..6cc3682 100644
--- a/migration.h
+++ b/migration.h
@@ -26,6 +26,7 @@ struct MigrationParams {
bool shared;
bool postcopy;
bool nobg;
+ bool movebg;
int64_t prefault_forward;
int64_t prefault_backward;
};
diff --git a/qapi-schema.json b/qapi-schema.json
index 746bf21..cf5d988 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -2095,7 +2095,7 @@
##
{ 'command': 'migrate',
'data': {'uri': 'str', '*blk': 'bool', '*inc': 'bool', '*detach': 'bool' ,
- '*postcopy': 'bool', '*nobg': 'bool',
+ '*postcopy': 'bool', '*movebg': 'bool', '*nobg': 'bool',
'*forward': 'int', '*backward': 'int'} }
# @xen-save-devices-state:
diff --git a/qmp-commands.hx b/qmp-commands.hx
index defbeba..7028ece 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,nobg:-n,uri:s",
+ .args_type =
"detach:-d,blk:-b,inc:-i,postcopy:-p,movebg:-m,nobg:-n,uri:s",
.mhandler.cmd_new = qmp_marshal_input_migrate,
},
diff --git a/savevm.c b/savevm.c
index 0a3acd8..8d26354 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1839,6 +1839,7 @@ static int qemu_savevm_state(QEMUFile *f)
.blk = 0,
.shared = 0,
.postcopy = 0,
+ .movebg = 0,
.nobg = 0,
};
--
1.7.10.4
- [Qemu-devel] [PATCH v3 06/35] osdep: add qemu_read_full() to read interrupt-safely, (continued)
- [Qemu-devel] [PATCH v3 06/35] osdep: add qemu_read_full() to read interrupt-safely, Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 04/35] add a version number to ram_list, Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 03/35] split MRU ram list, Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 10/35] savevm/QEMUFile: add read/write QEMUFile on memory buffer, Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 12/35] arch_init: export RAM_SAVE_xxx flags for postcopy, Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 20/35] osdep: add QEMU_MADV_REMOVE and tirivial fix, Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 01/35] migration.c: remove redundant line in migrate_init(), Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 14/35] arch_init: refactor ram_save_block() and export ram_save_block(), Isaku Yamahata, 2012/10/30
- [Qemu-devel] [PATCH v3 11/35] savevm, buffered_file: introduce method to drain buffer of buffered file, Isaku Yamahata, 2012/10/30
- [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 <=
- [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, 2012/10/30
- [Qemu-devel] [PATCH v3 16/35] arch_init/ram_load: refactor ram_load, Isaku Yamahata, 2012/10/30