mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
migration: Change zero_copy_send from migration parameter to migration capability
When originally implemented, zero_copy_send was designed as a Migration paramenter. But taking into account how is that supposed to work, and how the difference between a capability and a parameter, it only makes sense that zero-copy-send would work better as a capability. Taking into account how recently the change got merged, it was decided that it's still time to make it right, and convert zero_copy_send into a Migration capability. Signed-off-by: Leonardo Bras <leobras@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Acked-by: Markus Armbruster <armbru@redhat.com> Acked-by: Peter Xu <peterx@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> dgilbert: always define the capability, even on non-Linux but error if set; avoids build problems with the capability
This commit is contained in:
parent
4f5a09714c
commit
1abaec9a1b
3 changed files with 34 additions and 63 deletions
|
@ -163,7 +163,8 @@ INITIALIZE_MIGRATE_CAPS_SET(check_caps_background_snapshot,
|
|||
MIGRATION_CAPABILITY_COMPRESS,
|
||||
MIGRATION_CAPABILITY_XBZRLE,
|
||||
MIGRATION_CAPABILITY_X_COLO,
|
||||
MIGRATION_CAPABILITY_VALIDATE_UUID);
|
||||
MIGRATION_CAPABILITY_VALIDATE_UUID,
|
||||
MIGRATION_CAPABILITY_ZERO_COPY_SEND);
|
||||
|
||||
/* When we add fault tolerance, we could have several
|
||||
migrations at once. For now we don't need to add
|
||||
|
@ -910,10 +911,6 @@ MigrationParameters *qmp_query_migrate_parameters(Error **errp)
|
|||
params->multifd_zlib_level = s->parameters.multifd_zlib_level;
|
||||
params->has_multifd_zstd_level = true;
|
||||
params->multifd_zstd_level = s->parameters.multifd_zstd_level;
|
||||
#ifdef CONFIG_LINUX
|
||||
params->has_zero_copy_send = true;
|
||||
params->zero_copy_send = s->parameters.zero_copy_send;
|
||||
#endif
|
||||
params->has_xbzrle_cache_size = true;
|
||||
params->xbzrle_cache_size = s->parameters.xbzrle_cache_size;
|
||||
params->has_max_postcopy_bandwidth = true;
|
||||
|
@ -1275,6 +1272,24 @@ static bool migrate_caps_check(bool *cap_list,
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_LINUX
|
||||
if (cap_list[MIGRATION_CAPABILITY_ZERO_COPY_SEND] &&
|
||||
(!cap_list[MIGRATION_CAPABILITY_MULTIFD] ||
|
||||
migrate_use_compression() ||
|
||||
migrate_use_tls())) {
|
||||
error_setg(errp,
|
||||
"Zero copy only available for non-compressed non-TLS multifd migration");
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
if (cap_list[MIGRATION_CAPABILITY_ZERO_COPY_SEND]) {
|
||||
error_setg(errp,
|
||||
"Zero copy currently only available on Linux");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* incoming side only */
|
||||
if (runstate_check(RUN_STATE_INMIGRATE) &&
|
||||
!migrate_multi_channels_is_allowed() &&
|
||||
|
@ -1497,16 +1512,6 @@ static bool migrate_params_check(MigrationParameters *params, Error **errp)
|
|||
error_prepend(errp, "Invalid mapping given for block-bitmap-mapping: ");
|
||||
return false;
|
||||
}
|
||||
#ifdef CONFIG_LINUX
|
||||
if (params->zero_copy_send &&
|
||||
(!migrate_use_multifd() ||
|
||||
params->multifd_compression != MULTIFD_COMPRESSION_NONE ||
|
||||
(params->tls_creds && *params->tls_creds))) {
|
||||
error_setg(errp,
|
||||
"Zero copy only available for non-compressed non-TLS multifd migration");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1580,11 +1585,6 @@ static void migrate_params_test_apply(MigrateSetParameters *params,
|
|||
if (params->has_multifd_compression) {
|
||||
dest->multifd_compression = params->multifd_compression;
|
||||
}
|
||||
#ifdef CONFIG_LINUX
|
||||
if (params->has_zero_copy_send) {
|
||||
dest->zero_copy_send = params->zero_copy_send;
|
||||
}
|
||||
#endif
|
||||
if (params->has_xbzrle_cache_size) {
|
||||
dest->xbzrle_cache_size = params->xbzrle_cache_size;
|
||||
}
|
||||
|
@ -1697,11 +1697,6 @@ static void migrate_params_apply(MigrateSetParameters *params, Error **errp)
|
|||
if (params->has_multifd_compression) {
|
||||
s->parameters.multifd_compression = params->multifd_compression;
|
||||
}
|
||||
#ifdef CONFIG_LINUX
|
||||
if (params->has_zero_copy_send) {
|
||||
s->parameters.zero_copy_send = params->zero_copy_send;
|
||||
}
|
||||
#endif
|
||||
if (params->has_xbzrle_cache_size) {
|
||||
s->parameters.xbzrle_cache_size = params->xbzrle_cache_size;
|
||||
xbzrle_cache_resize(params->xbzrle_cache_size, errp);
|
||||
|
@ -2593,7 +2588,7 @@ bool migrate_use_zero_copy_send(void)
|
|||
|
||||
s = migrate_get_current();
|
||||
|
||||
return s->parameters.zero_copy_send;
|
||||
return s->enabled_capabilities[MIGRATION_CAPABILITY_ZERO_COPY_SEND];
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -4249,10 +4244,6 @@ static Property migration_properties[] = {
|
|||
DEFINE_PROP_UINT8("multifd-zstd-level", MigrationState,
|
||||
parameters.multifd_zstd_level,
|
||||
DEFAULT_MIGRATE_MULTIFD_ZSTD_LEVEL),
|
||||
#ifdef CONFIG_LINUX
|
||||
DEFINE_PROP_BOOL("zero_copy_send", MigrationState,
|
||||
parameters.zero_copy_send, false),
|
||||
#endif
|
||||
DEFINE_PROP_SIZE("xbzrle-cache-size", MigrationState,
|
||||
parameters.xbzrle_cache_size,
|
||||
DEFAULT_MIGRATE_XBZRLE_CACHE_SIZE),
|
||||
|
@ -4290,6 +4281,10 @@ static Property migration_properties[] = {
|
|||
DEFINE_PROP_MIG_CAP("x-multifd", MIGRATION_CAPABILITY_MULTIFD),
|
||||
DEFINE_PROP_MIG_CAP("x-background-snapshot",
|
||||
MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT),
|
||||
#ifdef CONFIG_LINUX
|
||||
DEFINE_PROP_MIG_CAP("x-zero-copy-send",
|
||||
MIGRATION_CAPABILITY_ZERO_COPY_SEND),
|
||||
#endif
|
||||
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
};
|
||||
|
@ -4350,9 +4345,6 @@ static void migration_instance_init(Object *obj)
|
|||
params->has_multifd_compression = true;
|
||||
params->has_multifd_zlib_level = true;
|
||||
params->has_multifd_zstd_level = true;
|
||||
#ifdef CONFIG_LINUX
|
||||
params->has_zero_copy_send = true;
|
||||
#endif
|
||||
params->has_xbzrle_cache_size = true;
|
||||
params->has_max_postcopy_bandwidth = true;
|
||||
params->has_max_cpu_throttle = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue