@@ -344,6 +344,9 @@ void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict)
monitor_printf(mon, "%s: %s\n",
MigrationParameter_str(MIGRATION_PARAMETER_MULTIFD_COMPRESSION),
MultiFDCompression_str(params->multifd_compression));
+ monitor_printf(mon, "%s: %s\n",
+ MigrationParameter_str(MIGRATION_PARAMETER_MULTIFD_ZERO_PAGE),
+ params->multifd_zero_page ? "on" : "off");
monitor_printf(mon, "%s: %" PRIu64 " bytes\n",
MigrationParameter_str(MIGRATION_PARAMETER_XBZRLE_CACHE_SIZE),
params->xbzrle_cache_size);
@@ -634,6 +637,10 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
p->has_multifd_zstd_level = true;
visit_type_uint8(v, param, &p->multifd_zstd_level, &err);
break;
+ case MIGRATION_PARAMETER_MULTIFD_ZERO_PAGE:
+ p->has_multifd_zero_page = true;
+ visit_type_bool(v, param, &p->multifd_zero_page, &err);
+ break;
case MIGRATION_PARAMETER_XBZRLE_CACHE_SIZE:
p->has_xbzrle_cache_size = true;
if (!visit_type_size(v, param, &cache_size, &err)) {
@@ -179,6 +179,8 @@ Property migration_properties[] = {
DEFINE_PROP_MIG_MODE("mode", MigrationState,
parameters.mode,
MIG_MODE_NORMAL),
+ DEFINE_PROP_BOOL("multifd-zero-page", MigrationState,
+ parameters.multifd_zero_page, true),
/* Migration capabilities */
DEFINE_PROP_MIG_CAP("x-xbzrle", MIGRATION_CAPABILITY_XBZRLE),
@@ -903,6 +905,13 @@ uint64_t migrate_xbzrle_cache_size(void)
return s->parameters.xbzrle_cache_size;
}
+bool migrate_multifd_zero_page(void)
+{
+ MigrationState *s = migrate_get_current();
+
+ return s->parameters.multifd_zero_page;
+}
+
/* parameter setters */
void migrate_set_block_incremental(bool value)
@@ -1013,6 +1022,8 @@ MigrationParameters *qmp_query_migrate_parameters(Error **errp)
params->vcpu_dirty_limit = s->parameters.vcpu_dirty_limit;
params->has_mode = true;
params->mode = s->parameters.mode;
+ params->has_multifd_zero_page = true;
+ params->multifd_zero_page = s->parameters.multifd_zero_page;
return params;
}
@@ -1049,6 +1060,7 @@ void migrate_params_init(MigrationParameters *params)
params->has_x_vcpu_dirty_limit_period = true;
params->has_vcpu_dirty_limit = true;
params->has_mode = true;
+ params->has_multifd_zero_page = true;
}
/*
@@ -1350,6 +1362,10 @@ static void migrate_params_test_apply(MigrateSetParameters *params,
if (params->has_mode) {
dest->mode = params->mode;
}
+
+ if (params->has_multifd_zero_page) {
+ dest->multifd_zero_page = params->multifd_zero_page;
+ }
}
static void migrate_params_apply(MigrateSetParameters *params, Error **errp)
@@ -1494,6 +1510,10 @@ static void migrate_params_apply(MigrateSetParameters *params, Error **errp)
if (params->has_mode) {
s->parameters.mode = params->mode;
}
+
+ if (params->has_multifd_zero_page) {
+ s->parameters.multifd_zero_page = params->multifd_zero_page;
+ }
}
void qmp_migrate_set_parameters(MigrateSetParameters *params, Error **errp)
@@ -93,6 +93,7 @@ const char *migrate_tls_authz(void);
const char *migrate_tls_creds(void);
const char *migrate_tls_hostname(void);
uint64_t migrate_xbzrle_cache_size(void);
+bool migrate_multifd_zero_page(void);
/* parameters setters */
@@ -874,6 +874,11 @@
# @mode: Migration mode. See description in @MigMode. Default is 'normal'.
# (Since 8.2)
#
+# @multifd-zero-page: Multifd zero page checking. If the parameter is true,
+# zero page checking is done on the multifd sender thread. If the parameter
+# is false, zero page checking is done on the migration main thread. Default
+# is set to true. (Since 9.0)
+#
# Features:
#
# @deprecated: Member @block-incremental is deprecated. Use
@@ -907,7 +912,8 @@
'block-bitmap-mapping',
{ 'name': 'x-vcpu-dirty-limit-period', 'features': ['unstable'] },
'vcpu-dirty-limit',
- 'mode'] }
+ 'mode',
+ 'multifd-zero-page'] }
##
# @MigrateSetParameters:
@@ -1062,6 +1068,11 @@
# @mode: Migration mode. See description in @MigMode. Default is 'normal'.
# (Since 8.2)
#
+# @multifd-zero-page: Multifd zero page checking. If the parameter is true,
+# zero page checking is done on the multifd sender thread. If the parameter
+# is false, zero page checking is done on the migration main thread. Default
+# is set to true. (Since 9.0)
+#
# Features:
#
# @deprecated: Member @block-incremental is deprecated. Use
@@ -1115,7 +1126,8 @@
'*x-vcpu-dirty-limit-period': { 'type': 'uint64',
'features': [ 'unstable' ] },
'*vcpu-dirty-limit': 'uint64',
- '*mode': 'MigMode'} }
+ '*mode': 'MigMode',
+ '*multifd-zero-page': 'bool'} }
##
# @migrate-set-parameters:
@@ -1290,6 +1302,11 @@
# @mode: Migration mode. See description in @MigMode. Default is 'normal'.
# (Since 8.2)
#
+# @multifd-zero-page: Multifd zero page checking. If the parameter is true,
+# zero page checking is done on the multifd sender thread. If the parameter
+# is false, zero page checking is done on the migration main thread. Default
+# is set to true. (Since 9.0)
+#
# Features:
#
# @deprecated: Member @block-incremental is deprecated. Use
@@ -1340,7 +1357,8 @@
'*x-vcpu-dirty-limit-period': { 'type': 'uint64',
'features': [ 'unstable' ] },
'*vcpu-dirty-limit': 'uint64',
- '*mode': 'MigMode'} }
+ '*mode': 'MigMode',
+ '*multifd-zero-page': 'bool'} }
##
# @query-migrate-parameters:
This new parameter controls where the zero page checking is running. If this parameter is set to true, zero page checking is done in the multifd sender threads. If this parameter is set to false, zero page checking is done in the migration main thread. Signed-off-by: Hao Xiang <hao.xiang@bytedance.com> --- migration/migration-hmp-cmds.c | 7 +++++++ migration/options.c | 20 ++++++++++++++++++++ migration/options.h | 1 + qapi/migration.json | 24 +++++++++++++++++++++--- 4 files changed, 49 insertions(+), 3 deletions(-)