|
|
586cba |
From 7e2a037f3f349c21201152cecce32d8c8ff0bea0 Mon Sep 17 00:00:00 2001
|
|
|
586cba |
From: Leonardo Bras <leobras@redhat.com>
|
|
|
586cba |
Date: Mon, 20 Jun 2022 02:39:45 -0300
|
|
|
586cba |
Subject: [PATCH 17/18] migration: Change zero_copy_send from migration
|
|
|
586cba |
parameter to migration capability
|
|
|
586cba |
MIME-Version: 1.0
|
|
|
586cba |
Content-Type: text/plain; charset=UTF-8
|
|
|
586cba |
Content-Transfer-Encoding: 8bit
|
|
|
586cba |
|
|
|
586cba |
RH-Author: Leonardo BrĂ¡s <leobras@redhat.com>
|
|
|
586cba |
RH-MergeRequest: 95: MSG_ZEROCOPY + Multifd
|
|
|
586cba |
RH-Commit: [11/11] e4a955607947896a49398ac8400241a0adac51a1 (LeoBras/centos-qemu-kvm)
|
|
|
586cba |
RH-Bugzilla: 1968509
|
|
|
586cba |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
586cba |
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
586cba |
RH-Acked-by: Peter Xu <peterx@redhat.com>
|
|
|
586cba |
|
|
|
586cba |
When originally implemented, zero_copy_send was designed as a Migration
|
|
|
586cba |
paramenter.
|
|
|
586cba |
|
|
|
586cba |
But taking into account how is that supposed to work, and how
|
|
|
586cba |
the difference between a capability and a parameter, it only makes sense
|
|
|
586cba |
that zero-copy-send would work better as a capability.
|
|
|
586cba |
|
|
|
586cba |
Taking into account how recently the change got merged, it was decided
|
|
|
586cba |
that it's still time to make it right, and convert zero_copy_send into
|
|
|
586cba |
a Migration capability.
|
|
|
586cba |
|
|
|
586cba |
Signed-off-by: Leonardo Bras <leobras@redhat.com>
|
|
|
586cba |
Reviewed-by: Juan Quintela <quintela@redhat.com>
|
|
|
586cba |
Acked-by: Markus Armbruster <armbru@redhat.com>
|
|
|
586cba |
Acked-by: Peter Xu <peterx@redhat.com>
|
|
|
586cba |
Signed-off-by: Juan Quintela <quintela@redhat.com>
|
|
|
586cba |
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
586cba |
dgilbert: always define the capability, even on non-Linux but error if
|
|
|
586cba |
set; avoids build problems with the capability
|
|
|
586cba |
(cherry picked from commit 1abaec9a1b2c23f7aa94709a422128d9e42c3e0b)
|
|
|
586cba |
Signed-off-by: Leonardo Bras <leobras@redhat.com>
|
|
|
586cba |
---
|
|
|
586cba |
migration/migration.c | 58 +++++++++++++++++++------------------------
|
|
|
586cba |
monitor/hmp-cmds.c | 6 -----
|
|
|
586cba |
qapi/migration.json | 33 +++++++-----------------
|
|
|
586cba |
3 files changed, 34 insertions(+), 63 deletions(-)
|
|
|
586cba |
|
|
|
586cba |
diff --git a/migration/migration.c b/migration/migration.c
|
|
|
586cba |
index 102236fba0..2a141bfaf3 100644
|
|
|
586cba |
--- a/migration/migration.c
|
|
|
586cba |
+++ b/migration/migration.c
|
|
|
586cba |
@@ -163,7 +163,8 @@ INITIALIZE_MIGRATE_CAPS_SET(check_caps_background_snapshot,
|
|
|
586cba |
MIGRATION_CAPABILITY_COMPRESS,
|
|
|
586cba |
MIGRATION_CAPABILITY_XBZRLE,
|
|
|
586cba |
MIGRATION_CAPABILITY_X_COLO,
|
|
|
586cba |
- MIGRATION_CAPABILITY_VALIDATE_UUID);
|
|
|
586cba |
+ MIGRATION_CAPABILITY_VALIDATE_UUID,
|
|
|
586cba |
+ MIGRATION_CAPABILITY_ZERO_COPY_SEND);
|
|
|
586cba |
|
|
|
586cba |
/* When we add fault tolerance, we could have several
|
|
|
586cba |
migrations at once. For now we don't need to add
|
|
|
586cba |
@@ -899,10 +900,6 @@ MigrationParameters *qmp_query_migrate_parameters(Error **errp)
|
|
|
586cba |
params->multifd_zlib_level = s->parameters.multifd_zlib_level;
|
|
|
586cba |
params->has_multifd_zstd_level = true;
|
|
|
586cba |
params->multifd_zstd_level = s->parameters.multifd_zstd_level;
|
|
|
586cba |
-#ifdef CONFIG_LINUX
|
|
|
586cba |
- params->has_zero_copy_send = true;
|
|
|
586cba |
- params->zero_copy_send = s->parameters.zero_copy_send;
|
|
|
586cba |
-#endif
|
|
|
586cba |
params->has_xbzrle_cache_size = true;
|
|
|
586cba |
params->xbzrle_cache_size = s->parameters.xbzrle_cache_size;
|
|
|
586cba |
params->has_max_postcopy_bandwidth = true;
|
|
|
586cba |
@@ -1263,6 +1260,24 @@ static bool migrate_caps_check(bool *cap_list,
|
|
|
586cba |
}
|
|
|
586cba |
}
|
|
|
586cba |
|
|
|
586cba |
+#ifdef CONFIG_LINUX
|
|
|
586cba |
+ if (cap_list[MIGRATION_CAPABILITY_ZERO_COPY_SEND] &&
|
|
|
586cba |
+ (!cap_list[MIGRATION_CAPABILITY_MULTIFD] ||
|
|
|
586cba |
+ migrate_use_compression() ||
|
|
|
586cba |
+ migrate_use_tls())) {
|
|
|
586cba |
+ error_setg(errp,
|
|
|
586cba |
+ "Zero copy only available for non-compressed non-TLS multifd migration");
|
|
|
586cba |
+ return false;
|
|
|
586cba |
+ }
|
|
|
586cba |
+#else
|
|
|
586cba |
+ if (cap_list[MIGRATION_CAPABILITY_ZERO_COPY_SEND]) {
|
|
|
586cba |
+ error_setg(errp,
|
|
|
586cba |
+ "Zero copy currently only available on Linux");
|
|
|
586cba |
+ return false;
|
|
|
586cba |
+ }
|
|
|
586cba |
+#endif
|
|
|
586cba |
+
|
|
|
586cba |
+
|
|
|
586cba |
/* incoming side only */
|
|
|
586cba |
if (runstate_check(RUN_STATE_INMIGRATE) &&
|
|
|
586cba |
!migrate_multifd_is_allowed() &&
|
|
|
586cba |
@@ -1485,16 +1500,6 @@ static bool migrate_params_check(MigrationParameters *params, Error **errp)
|
|
|
586cba |
error_prepend(errp, "Invalid mapping given for block-bitmap-mapping: ");
|
|
|
586cba |
return false;
|
|
|
586cba |
}
|
|
|
586cba |
-#ifdef CONFIG_LINUX
|
|
|
586cba |
- if (params->zero_copy_send &&
|
|
|
586cba |
- (!migrate_use_multifd() ||
|
|
|
586cba |
- params->multifd_compression != MULTIFD_COMPRESSION_NONE ||
|
|
|
586cba |
- (params->tls_creds && *params->tls_creds))) {
|
|
|
586cba |
- error_setg(errp,
|
|
|
586cba |
- "Zero copy only available for non-compressed non-TLS multifd migration");
|
|
|
586cba |
- return false;
|
|
|
586cba |
- }
|
|
|
586cba |
-#endif
|
|
|
586cba |
return true;
|
|
|
586cba |
}
|
|
|
586cba |
|
|
|
586cba |
@@ -1568,11 +1573,6 @@ static void migrate_params_test_apply(MigrateSetParameters *params,
|
|
|
586cba |
if (params->has_multifd_compression) {
|
|
|
586cba |
dest->multifd_compression = params->multifd_compression;
|
|
|
586cba |
}
|
|
|
586cba |
-#ifdef CONFIG_LINUX
|
|
|
586cba |
- if (params->has_zero_copy_send) {
|
|
|
586cba |
- dest->zero_copy_send = params->zero_copy_send;
|
|
|
586cba |
- }
|
|
|
586cba |
-#endif
|
|
|
586cba |
if (params->has_xbzrle_cache_size) {
|
|
|
586cba |
dest->xbzrle_cache_size = params->xbzrle_cache_size;
|
|
|
586cba |
}
|
|
|
586cba |
@@ -1685,11 +1685,6 @@ static void migrate_params_apply(MigrateSetParameters *params, Error **errp)
|
|
|
586cba |
if (params->has_multifd_compression) {
|
|
|
586cba |
s->parameters.multifd_compression = params->multifd_compression;
|
|
|
586cba |
}
|
|
|
586cba |
-#ifdef CONFIG_LINUX
|
|
|
586cba |
- if (params->has_zero_copy_send) {
|
|
|
586cba |
- s->parameters.zero_copy_send = params->zero_copy_send;
|
|
|
586cba |
- }
|
|
|
586cba |
-#endif
|
|
|
586cba |
if (params->has_xbzrle_cache_size) {
|
|
|
586cba |
s->parameters.xbzrle_cache_size = params->xbzrle_cache_size;
|
|
|
586cba |
xbzrle_cache_resize(params->xbzrle_cache_size, errp);
|
|
|
586cba |
@@ -2587,7 +2582,7 @@ bool migrate_use_zero_copy_send(void)
|
|
|
586cba |
|
|
|
586cba |
s = migrate_get_current();
|
|
|
586cba |
|
|
|
586cba |
- return s->parameters.zero_copy_send;
|
|
|
586cba |
+ return s->enabled_capabilities[MIGRATION_CAPABILITY_ZERO_COPY_SEND];
|
|
|
586cba |
}
|
|
|
586cba |
#endif
|
|
|
586cba |
|
|
|
586cba |
@@ -4243,10 +4238,6 @@ static Property migration_properties[] = {
|
|
|
586cba |
DEFINE_PROP_UINT8("multifd-zstd-level", MigrationState,
|
|
|
586cba |
parameters.multifd_zstd_level,
|
|
|
586cba |
DEFAULT_MIGRATE_MULTIFD_ZSTD_LEVEL),
|
|
|
586cba |
-#ifdef CONFIG_LINUX
|
|
|
586cba |
- DEFINE_PROP_BOOL("zero_copy_send", MigrationState,
|
|
|
586cba |
- parameters.zero_copy_send, false),
|
|
|
586cba |
-#endif
|
|
|
586cba |
DEFINE_PROP_SIZE("xbzrle-cache-size", MigrationState,
|
|
|
586cba |
parameters.xbzrle_cache_size,
|
|
|
586cba |
DEFAULT_MIGRATE_XBZRLE_CACHE_SIZE),
|
|
|
586cba |
@@ -4284,6 +4275,10 @@ static Property migration_properties[] = {
|
|
|
586cba |
DEFINE_PROP_MIG_CAP("x-multifd", MIGRATION_CAPABILITY_MULTIFD),
|
|
|
586cba |
DEFINE_PROP_MIG_CAP("x-background-snapshot",
|
|
|
586cba |
MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT),
|
|
|
586cba |
+#ifdef CONFIG_LINUX
|
|
|
586cba |
+ DEFINE_PROP_MIG_CAP("x-zero-copy-send",
|
|
|
586cba |
+ MIGRATION_CAPABILITY_ZERO_COPY_SEND),
|
|
|
586cba |
+#endif
|
|
|
586cba |
|
|
|
586cba |
DEFINE_PROP_END_OF_LIST(),
|
|
|
586cba |
};
|
|
|
586cba |
@@ -4344,9 +4339,6 @@ static void migration_instance_init(Object *obj)
|
|
|
586cba |
params->has_multifd_compression = true;
|
|
|
586cba |
params->has_multifd_zlib_level = true;
|
|
|
586cba |
params->has_multifd_zstd_level = true;
|
|
|
586cba |
-#ifdef CONFIG_LINUX
|
|
|
586cba |
- params->has_zero_copy_send = true;
|
|
|
586cba |
-#endif
|
|
|
586cba |
params->has_xbzrle_cache_size = true;
|
|
|
586cba |
params->has_max_postcopy_bandwidth = true;
|
|
|
586cba |
params->has_max_cpu_throttle = true;
|
|
|
586cba |
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
|
|
|
586cba |
index 55b48d3733..634968498b 100644
|
|
|
586cba |
--- a/monitor/hmp-cmds.c
|
|
|
586cba |
+++ b/monitor/hmp-cmds.c
|
|
|
586cba |
@@ -1309,12 +1309,6 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
|
|
|
586cba |
p->has_multifd_zstd_level = true;
|
|
|
586cba |
visit_type_uint8(v, param, &p->multifd_zstd_level, &err;;
|
|
|
586cba |
break;
|
|
|
586cba |
-#ifdef CONFIG_LINUX
|
|
|
586cba |
- case MIGRATION_PARAMETER_ZERO_COPY_SEND:
|
|
|
586cba |
- p->has_zero_copy_send = true;
|
|
|
586cba |
- visit_type_bool(v, param, &p->zero_copy_send, &err;;
|
|
|
586cba |
- break;
|
|
|
586cba |
-#endif
|
|
|
586cba |
case MIGRATION_PARAMETER_XBZRLE_CACHE_SIZE:
|
|
|
586cba |
p->has_xbzrle_cache_size = true;
|
|
|
586cba |
if (!visit_type_size(v, param, &cache_size, &err)) {
|
|
|
586cba |
diff --git a/qapi/migration.json b/qapi/migration.json
|
|
|
586cba |
index 4d833ecdd6..5105790cd0 100644
|
|
|
586cba |
--- a/qapi/migration.json
|
|
|
586cba |
+++ b/qapi/migration.json
|
|
|
586cba |
@@ -463,6 +463,13 @@
|
|
|
586cba |
# procedure starts. The VM RAM is saved with running VM.
|
|
|
586cba |
# (since 6.0)
|
|
|
586cba |
#
|
|
|
586cba |
+# @zero-copy-send: Controls behavior on sending memory pages on migration.
|
|
|
586cba |
+# When true, enables a zero-copy mechanism for sending
|
|
|
586cba |
+# memory pages, if host supports it.
|
|
|
586cba |
+# Requires that QEMU be permitted to use locked memory
|
|
|
586cba |
+# for guest RAM pages.
|
|
|
586cba |
+# (since 7.1)
|
|
|
586cba |
+#
|
|
|
586cba |
# Features:
|
|
|
586cba |
# @unstable: Members @x-colo and @x-ignore-shared are experimental.
|
|
|
586cba |
#
|
|
|
586cba |
@@ -476,7 +483,8 @@
|
|
|
586cba |
'block', 'return-path', 'pause-before-switchover', 'multifd',
|
|
|
586cba |
'dirty-bitmaps', 'postcopy-blocktime', 'late-block-activate',
|
|
|
586cba |
{ 'name': 'x-ignore-shared', 'features': [ 'unstable' ] },
|
|
|
586cba |
- 'validate-uuid', 'background-snapshot'] }
|
|
|
586cba |
+ 'validate-uuid', 'background-snapshot',
|
|
|
586cba |
+ 'zero-copy-send'] }
|
|
|
586cba |
|
|
|
586cba |
##
|
|
|
586cba |
# @MigrationCapabilityStatus:
|
|
|
586cba |
@@ -741,12 +749,6 @@
|
|
|
586cba |
# will consume more CPU.
|
|
|
586cba |
# Defaults to 1. (Since 5.0)
|
|
|
586cba |
#
|
|
|
586cba |
-# @zero-copy-send: Controls behavior on sending memory pages on migration.
|
|
|
586cba |
-# When true, enables a zero-copy mechanism for sending
|
|
|
586cba |
-# memory pages, if host supports it.
|
|
|
586cba |
-# Requires that QEMU be permitted to use locked memory
|
|
|
586cba |
-# for guest RAM pages.
|
|
|
586cba |
-# Defaults to false. (Since 7.1)
|
|
|
586cba |
#
|
|
|
586cba |
# @block-bitmap-mapping: Maps block nodes and bitmaps on them to
|
|
|
586cba |
# aliases for the purpose of dirty bitmap migration. Such
|
|
|
586cba |
@@ -787,7 +789,6 @@
|
|
|
586cba |
'xbzrle-cache-size', 'max-postcopy-bandwidth',
|
|
|
586cba |
'max-cpu-throttle', 'multifd-compression',
|
|
|
586cba |
'multifd-zlib-level' ,'multifd-zstd-level',
|
|
|
586cba |
- { 'name': 'zero-copy-send', 'if' : 'CONFIG_LINUX'},
|
|
|
586cba |
'block-bitmap-mapping' ] }
|
|
|
586cba |
|
|
|
586cba |
##
|
|
|
586cba |
@@ -914,13 +915,6 @@
|
|
|
586cba |
# will consume more CPU.
|
|
|
586cba |
# Defaults to 1. (Since 5.0)
|
|
|
586cba |
#
|
|
|
586cba |
-# @zero-copy-send: Controls behavior on sending memory pages on migration.
|
|
|
586cba |
-# When true, enables a zero-copy mechanism for sending
|
|
|
586cba |
-# memory pages, if host supports it.
|
|
|
586cba |
-# Requires that QEMU be permitted to use locked memory
|
|
|
586cba |
-# for guest RAM pages.
|
|
|
586cba |
-# Defaults to false. (Since 7.1)
|
|
|
586cba |
-#
|
|
|
586cba |
# @block-bitmap-mapping: Maps block nodes and bitmaps on them to
|
|
|
586cba |
# aliases for the purpose of dirty bitmap migration. Such
|
|
|
586cba |
# aliases may for example be the corresponding names on the
|
|
|
586cba |
@@ -975,7 +969,6 @@
|
|
|
586cba |
'*multifd-compression': 'MultiFDCompression',
|
|
|
586cba |
'*multifd-zlib-level': 'uint8',
|
|
|
586cba |
'*multifd-zstd-level': 'uint8',
|
|
|
586cba |
- '*zero-copy-send': { 'type': 'bool', 'if': 'CONFIG_LINUX' },
|
|
|
586cba |
'*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ] } }
|
|
|
586cba |
|
|
|
586cba |
##
|
|
|
586cba |
@@ -1122,13 +1115,6 @@
|
|
|
586cba |
# will consume more CPU.
|
|
|
586cba |
# Defaults to 1. (Since 5.0)
|
|
|
586cba |
#
|
|
|
586cba |
-# @zero-copy-send: Controls behavior on sending memory pages on migration.
|
|
|
586cba |
-# When true, enables a zero-copy mechanism for sending
|
|
|
586cba |
-# memory pages, if host supports it.
|
|
|
586cba |
-# Requires that QEMU be permitted to use locked memory
|
|
|
586cba |
-# for guest RAM pages.
|
|
|
586cba |
-# Defaults to false. (Since 7.1)
|
|
|
586cba |
-#
|
|
|
586cba |
# @block-bitmap-mapping: Maps block nodes and bitmaps on them to
|
|
|
586cba |
# aliases for the purpose of dirty bitmap migration. Such
|
|
|
586cba |
# aliases may for example be the corresponding names on the
|
|
|
586cba |
@@ -1181,7 +1167,6 @@
|
|
|
586cba |
'*multifd-compression': 'MultiFDCompression',
|
|
|
586cba |
'*multifd-zlib-level': 'uint8',
|
|
|
586cba |
'*multifd-zstd-level': 'uint8',
|
|
|
586cba |
- '*zero-copy-send': { 'type': 'bool', 'if': 'CONFIG_LINUX' },
|
|
|
586cba |
'*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ] } }
|
|
|
586cba |
|
|
|
586cba |
##
|
|
|
586cba |
--
|
|
|
586cba |
2.35.3
|
|
|
586cba |
|