mirror of
https://github.com/qemu/qemu.git
synced 2024-11-24 19:33:39 +08:00
qapi/migration: Introduce vcpu-dirty-limit parameters
Introduce "vcpu-dirty-limit" migration parameter used to limit dirty page rate during live migration. "vcpu-dirty-limit" and "x-vcpu-dirty-limit-period" are two dirty-limit-related migration parameters, which can be set before and during live migration by qmp migrate-set-parameters. This two parameters are used to help implement the dirty page rate limit algo of migration. Signed-off-by: Hyman Huang(黄勇) <yong.huang@smartx.com> Acked-by: Peter Xu <peterx@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Message-Id: <168618975839.6361.17407633874747688653-3@git.sr.ht> Signed-off-by: Juan Quintela <quintela@redhat.com>
This commit is contained in:
parent
4d80785719
commit
09f9ec9913
@ -368,6 +368,10 @@ void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict)
|
||||
monitor_printf(mon, "%s: %" PRIu64 " ms\n",
|
||||
MigrationParameter_str(MIGRATION_PARAMETER_X_VCPU_DIRTY_LIMIT_PERIOD),
|
||||
params->x_vcpu_dirty_limit_period);
|
||||
|
||||
monitor_printf(mon, "%s: %" PRIu64 " MB/s\n",
|
||||
MigrationParameter_str(MIGRATION_PARAMETER_VCPU_DIRTY_LIMIT),
|
||||
params->vcpu_dirty_limit);
|
||||
}
|
||||
|
||||
qapi_free_MigrationParameters(params);
|
||||
@ -628,6 +632,10 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
|
||||
p->has_x_vcpu_dirty_limit_period = true;
|
||||
visit_type_size(v, param, &p->x_vcpu_dirty_limit_period, &err);
|
||||
break;
|
||||
case MIGRATION_PARAMETER_VCPU_DIRTY_LIMIT:
|
||||
p->has_vcpu_dirty_limit = true;
|
||||
visit_type_size(v, param, &p->vcpu_dirty_limit, &err);
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
|
@ -81,6 +81,7 @@
|
||||
DEFINE_PROP_BOOL(name, MigrationState, capabilities[x], false)
|
||||
|
||||
#define DEFAULT_MIGRATE_VCPU_DIRTY_LIMIT_PERIOD 1000 /* milliseconds */
|
||||
#define DEFAULT_MIGRATE_VCPU_DIRTY_LIMIT 1 /* MB/s */
|
||||
|
||||
Property migration_properties[] = {
|
||||
DEFINE_PROP_BOOL("store-global-state", MigrationState,
|
||||
@ -168,6 +169,9 @@ Property migration_properties[] = {
|
||||
DEFINE_PROP_UINT64("x-vcpu-dirty-limit-period", MigrationState,
|
||||
parameters.x_vcpu_dirty_limit_period,
|
||||
DEFAULT_MIGRATE_VCPU_DIRTY_LIMIT_PERIOD),
|
||||
DEFINE_PROP_UINT64("vcpu-dirty-limit", MigrationState,
|
||||
parameters.vcpu_dirty_limit,
|
||||
DEFAULT_MIGRATE_VCPU_DIRTY_LIMIT),
|
||||
|
||||
/* Migration capabilities */
|
||||
DEFINE_PROP_MIG_CAP("x-xbzrle", MIGRATION_CAPABILITY_XBZRLE),
|
||||
@ -915,6 +919,8 @@ MigrationParameters *qmp_query_migrate_parameters(Error **errp)
|
||||
|
||||
params->has_x_vcpu_dirty_limit_period = true;
|
||||
params->x_vcpu_dirty_limit_period = s->parameters.x_vcpu_dirty_limit_period;
|
||||
params->has_vcpu_dirty_limit = true;
|
||||
params->vcpu_dirty_limit = s->parameters.vcpu_dirty_limit;
|
||||
|
||||
return params;
|
||||
}
|
||||
@ -949,6 +955,7 @@ void migrate_params_init(MigrationParameters *params)
|
||||
params->has_announce_rounds = true;
|
||||
params->has_announce_step = true;
|
||||
params->has_x_vcpu_dirty_limit_period = true;
|
||||
params->has_vcpu_dirty_limit = true;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1118,6 +1125,14 @@ bool migrate_params_check(MigrationParameters *params, Error **errp)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (params->has_vcpu_dirty_limit &&
|
||||
(params->vcpu_dirty_limit < 1)) {
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||
"vcpu_dirty_limit",
|
||||
"is invalid, it must greater then 1 MB/s");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1222,6 +1237,9 @@ static void migrate_params_test_apply(MigrateSetParameters *params,
|
||||
dest->x_vcpu_dirty_limit_period =
|
||||
params->x_vcpu_dirty_limit_period;
|
||||
}
|
||||
if (params->has_vcpu_dirty_limit) {
|
||||
dest->vcpu_dirty_limit = params->vcpu_dirty_limit;
|
||||
}
|
||||
}
|
||||
|
||||
static void migrate_params_apply(MigrateSetParameters *params, Error **errp)
|
||||
@ -1345,6 +1363,9 @@ static void migrate_params_apply(MigrateSetParameters *params, Error **errp)
|
||||
s->parameters.x_vcpu_dirty_limit_period =
|
||||
params->x_vcpu_dirty_limit_period;
|
||||
}
|
||||
if (params->has_vcpu_dirty_limit) {
|
||||
s->parameters.vcpu_dirty_limit = params->vcpu_dirty_limit;
|
||||
}
|
||||
}
|
||||
|
||||
void qmp_migrate_set_parameters(MigrateSetParameters *params, Error **errp)
|
||||
|
@ -793,6 +793,9 @@
|
||||
# live migration. Should be in the range 1 to 1000ms,
|
||||
# defaults to 1000ms. (Since 8.1)
|
||||
#
|
||||
# @vcpu-dirty-limit: Dirtyrate limit (MB/s) during live migration.
|
||||
# Defaults to 1. (Since 8.1)
|
||||
#
|
||||
# Features:
|
||||
#
|
||||
# @unstable: Members @x-checkpoint-delay and @x-vcpu-dirty-limit-period
|
||||
@ -816,7 +819,8 @@
|
||||
'max-cpu-throttle', 'multifd-compression',
|
||||
'multifd-zlib-level', 'multifd-zstd-level',
|
||||
'block-bitmap-mapping',
|
||||
{ 'name': 'x-vcpu-dirty-limit-period', 'features': ['unstable'] } ] }
|
||||
{ 'name': 'x-vcpu-dirty-limit-period', 'features': ['unstable'] },
|
||||
'vcpu-dirty-limit'] }
|
||||
|
||||
##
|
||||
# @MigrateSetParameters:
|
||||
@ -955,6 +959,9 @@
|
||||
# live migration. Should be in the range 1 to 1000ms,
|
||||
# defaults to 1000ms. (Since 8.1)
|
||||
#
|
||||
# @vcpu-dirty-limit: Dirtyrate limit (MB/s) during live migration.
|
||||
# Defaults to 1. (Since 8.1)
|
||||
#
|
||||
# Features:
|
||||
#
|
||||
# @unstable: Members @x-checkpoint-delay and @x-vcpu-dirty-limit-period
|
||||
@ -995,7 +1002,8 @@
|
||||
'*multifd-zstd-level': 'uint8',
|
||||
'*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ],
|
||||
'*x-vcpu-dirty-limit-period': { 'type': 'uint64',
|
||||
'features': [ 'unstable' ] } } }
|
||||
'features': [ 'unstable' ] },
|
||||
'*vcpu-dirty-limit': 'uint64'} }
|
||||
|
||||
##
|
||||
# @migrate-set-parameters:
|
||||
@ -1154,6 +1162,9 @@
|
||||
# live migration. Should be in the range 1 to 1000ms,
|
||||
# defaults to 1000ms. (Since 8.1)
|
||||
#
|
||||
# @vcpu-dirty-limit: Dirtyrate limit (MB/s) during live migration.
|
||||
# Defaults to 1. (Since 8.1)
|
||||
#
|
||||
# Features:
|
||||
#
|
||||
# @unstable: Members @x-checkpoint-delay and @x-vcpu-dirty-limit-period
|
||||
@ -1191,7 +1202,8 @@
|
||||
'*multifd-zstd-level': 'uint8',
|
||||
'*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ],
|
||||
'*x-vcpu-dirty-limit-period': { 'type': 'uint64',
|
||||
'features': [ 'unstable' ] } } }
|
||||
'features': [ 'unstable' ] },
|
||||
'*vcpu-dirty-limit': 'uint64'} }
|
||||
|
||||
##
|
||||
# @query-migrate-parameters:
|
||||
|
Loading…
Reference in New Issue
Block a user