This is for benchmark purpose Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx> --- hmp-commands.hx | 10 ++++++---- hmp.c | 4 +++- migration-postcopy.c | 7 +++++++ migration.c | 4 +++- migration.h | 1 + qapi-schema.json | 2 +- qmp-commands.hx | 3 ++- savevm.c | 1 + 8 files changed, 24 insertions(+), 8 deletions(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index f2f1264..b054760 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -826,25 +826,27 @@ ETEXI { .name = "migrate", - .args_type = "detach:-d,blk:-b,inc:-i,postcopy:-p,uri:s", - .params = "[-d] [-b] [-i] [-p] uri", + .args_type = "detach:-d,blk:-b,inc:-i,postcopy:-p,nobg:-n,uri:s", + .params = "[-d] [-b] [-i] [-p [-n]] uri", .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-p for migration with postcopy mode enabled" + "\n\t\t\t-n for no background transfer of postcopy mode", .mhandler.cmd = hmp_migrate, }, STEXI -@item migrate [-d] [-b] [-i] [-p] @var{uri} +@item migrate [-d] [-b] [-i] [-p [-n]] @var{uri} @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 + -n for migration with postcopy mode enabled without background transfer ETEXI { diff --git a/hmp.c b/hmp.c index 2ea3bc4..203b552 100644 --- a/hmp.c +++ b/hmp.c @@ -1036,11 +1036,13 @@ 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 nobg = qdict_get_try_bool(qdict, "nobg", 0); const char *uri = qdict_get_str(qdict, "uri"); Error *err = NULL; qmp_migrate(uri, !!blk, blk, !!inc, inc, false, false, - !!postcopy, postcopy, &err); + !!postcopy, postcopy, !!nobg, nobg, + &err); if (err) { monitor_printf(mon, "migrate: %s\n", error_get_pretty(err)); error_free(err); diff --git a/migration-postcopy.c b/migration-postcopy.c index 399e233..5f98ae6 100644 --- a/migration-postcopy.c +++ b/migration-postcopy.c @@ -557,6 +557,13 @@ int postcopy_outgoing_ram_save_background(QEMUFile *f, void *postcopy) abort(); } + if (s->ms->params.nobg) { + if (ram_bytes_remaining() == 0) { + postcopy_outgoing_ram_all_sent(f, s); + } + return 0; + } + DPRINTF("outgoing background state: %d\n", s->state); i = 0; t0 = qemu_get_clock_ns(rt_clock); diff --git a/migration.c b/migration.c index 85f8f71..279dda5 100644 --- a/migration.c +++ b/migration.c @@ -510,7 +510,8 @@ 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, Error **errp) + bool has_postcopy, bool postcopy, bool has_nobg, bool nobg, + Error **errp) { MigrationState *s = migrate_get_current(); MigrationParams params; @@ -520,6 +521,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk, params.blk = blk; params.shared = inc; params.postcopy = postcopy; + params.nobg = nobg; if (s->state == MIG_STATE_ACTIVE) { error_set(errp, QERR_MIGRATION_ACTIVE); diff --git a/migration.h b/migration.h index 9b3c03b..6724c19 100644 --- a/migration.h +++ b/migration.h @@ -25,6 +25,7 @@ struct MigrationParams { bool blk; bool shared; bool postcopy; + bool nobg; }; typedef struct MigrationState MigrationState; diff --git a/qapi-schema.json b/qapi-schema.json index c969e5a..70d0577 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'} } + '*postcopy': 'bool', '*nobg': 'bool'} } # @xen-save-devices-state: # diff --git a/qmp-commands.hx b/qmp-commands.hx index ece7a7e..defbeba 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,uri:s", + .args_type = "detach:-d,blk:-b,inc:-i,postcopy:-p,nobg:-n,uri:s", .mhandler.cmd_new = qmp_marshal_input_migrate, }, @@ -533,6 +533,7 @@ Arguments: - "blk": block migration, full disk copy (json-bool, optional) - "inc": incremental disk copy (json-bool, optional) - "postcopy": postcopy migration (json-bool, optional) +- "nobg": postcopy without background transfer (json-bool, optional) - "uri": Destination URI (json-string) Example: diff --git a/savevm.c b/savevm.c index 675f9a5..0a3acd8 100644 --- a/savevm.c +++ b/savevm.c @@ -1839,6 +1839,7 @@ static int qemu_savevm_state(QEMUFile *f) .blk = 0, .shared = 0, .postcopy = 0, + .nobg = 0, }; if (qemu_savevm_state_blocked(NULL)) { -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html