[PULL 12/16] migration: Add zero-copy-send parameter for QMP/HMP for Linux
From: Leonardo Bras Add property that allows zero-copy migration of memory pages on the sending side, and also includes a helper function migrate_use_zero_copy_send() to check if it's enabled. No code is introduced to actually do the migration, but it allow future implementations to enable/disable this feature. On non-Linux builds this parameter is compiled-out. Signed-off-by: Leonardo Bras Reviewed-by: Peter Xu Reviewed-by: Daniel P. Berrangé Reviewed-by: Juan Quintela Acked-by: Markus Armbruster Message-Id: <20220507015759.840466-4-leob...@redhat.com> Signed-off-by: Dr. David Alan Gilbert dgilbert: Removed accidental skibootism --- migration/migration.c | 32 migration/migration.h | 5 + migration/socket.c| 11 +-- monitor/hmp-cmds.c| 6 ++ qapi/migration.json | 24 5 files changed, 76 insertions(+), 2 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 5a31b23bd6..3e91f4b5e2 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -910,6 +910,10 @@ 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; @@ -1567,6 +1571,11 @@ 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; } @@ -1679,6 +1688,11 @@ 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); @@ -2563,6 +2577,17 @@ int migrate_multifd_zstd_level(void) return s->parameters.multifd_zstd_level; } +#ifdef CONFIG_LINUX +bool migrate_use_zero_copy_send(void) +{ +MigrationState *s; + +s = migrate_get_current(); + +return s->parameters.zero_copy_send; +} +#endif + int migrate_use_xbzrle(void) { MigrationState *s; @@ -4206,6 +4231,10 @@ 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), @@ -4303,6 +4332,9 @@ 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; diff --git a/migration/migration.h b/migration/migration.h index a863032b71..e8f2941a55 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -375,6 +375,11 @@ MultiFDCompression migrate_multifd_compression(void); int migrate_multifd_zlib_level(void); int migrate_multifd_zstd_level(void); +#ifdef CONFIG_LINUX +bool migrate_use_zero_copy_send(void); +#else +#define migrate_use_zero_copy_send() (false) +#endif int migrate_use_xbzrle(void); uint64_t migrate_xbzrle_cache_size(void); bool migrate_colo_enabled(void); diff --git a/migration/socket.c b/migration/socket.c index 05705a32d8..3754d8f72c 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -74,9 +74,16 @@ static void socket_outgoing_migration(QIOTask *task, if (qio_task_propagate_error(task, )) { trace_migration_socket_outgoing_error(error_get_pretty(err)); -} else { -trace_migration_socket_outgoing_connected(data->hostname); + goto out; } + +trace_migration_socket_outgoing_connected(data->hostname); + +if
Re: [PULL 12/16] migration: Add zero-copy-send parameter for QMP/HMP for Linux
* Leonardo Bras Soares Passos (leob...@redhat.com) wrote: > On Mon, May 9, 2022 at 4:45 PM Richard Henderson > wrote: > > > > On 5/9/22 10:02, Dr. David Alan Gilbert (git) wrote: > > > diff --git a/roms/skiboot b/roms/skiboot > > > index 24a7eb3596..820d43c0a7 16 > > > --- a/roms/skiboot > > > +++ b/roms/skiboot > > > @@ -1 +1 @@ > > > -Subproject commit 24a7eb35966d93455520bc2debdd7954314b638b > > > +Subproject commit 820d43c0a7751e75a8830561f35535dfffd522bd > > > > This is an error, probably in rebasing. > > Yeah, that's odd. Should not be there. > > David, could you please remove that? Yes, new version coming soon. Dave > Thanks! > > > > > > > r~ > > > -- Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK
Re: [PULL 12/16] migration: Add zero-copy-send parameter for QMP/HMP for Linux
On Mon, May 9, 2022 at 4:45 PM Richard Henderson wrote: > > On 5/9/22 10:02, Dr. David Alan Gilbert (git) wrote: > > diff --git a/roms/skiboot b/roms/skiboot > > index 24a7eb3596..820d43c0a7 16 > > --- a/roms/skiboot > > +++ b/roms/skiboot > > @@ -1 +1 @@ > > -Subproject commit 24a7eb35966d93455520bc2debdd7954314b638b > > +Subproject commit 820d43c0a7751e75a8830561f35535dfffd522bd > > This is an error, probably in rebasing. Yeah, that's odd. Should not be there. David, could you please remove that? Thanks! > > > r~ >
Re: [PULL 12/16] migration: Add zero-copy-send parameter for QMP/HMP for Linux
On 5/9/22 10:02, Dr. David Alan Gilbert (git) wrote: diff --git a/roms/skiboot b/roms/skiboot index 24a7eb3596..820d43c0a7 16 --- a/roms/skiboot +++ b/roms/skiboot @@ -1 +1 @@ -Subproject commit 24a7eb35966d93455520bc2debdd7954314b638b +Subproject commit 820d43c0a7751e75a8830561f35535dfffd522bd This is an error, probably in rebasing. r~
[PULL 12/16] migration: Add zero-copy-send parameter for QMP/HMP for Linux
From: Leonardo Bras Add property that allows zero-copy migration of memory pages on the sending side, and also includes a helper function migrate_use_zero_copy_send() to check if it's enabled. No code is introduced to actually do the migration, but it allow future implementations to enable/disable this feature. On non-Linux builds this parameter is compiled-out. Signed-off-by: Leonardo Bras Reviewed-by: Peter Xu Reviewed-by: Daniel P. Berrangé Reviewed-by: Juan Quintela Acked-by: Markus Armbruster Message-Id: <20220507015759.840466-4-leob...@redhat.com> Signed-off-by: Dr. David Alan Gilbert --- migration/migration.c | 32 migration/migration.h | 5 + migration/socket.c| 11 +-- monitor/hmp-cmds.c| 6 ++ qapi/migration.json | 24 roms/skiboot | 2 +- 6 files changed, 77 insertions(+), 3 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 5a31b23bd6..3e91f4b5e2 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -910,6 +910,10 @@ 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; @@ -1567,6 +1571,11 @@ 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; } @@ -1679,6 +1688,11 @@ 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); @@ -2563,6 +2577,17 @@ int migrate_multifd_zstd_level(void) return s->parameters.multifd_zstd_level; } +#ifdef CONFIG_LINUX +bool migrate_use_zero_copy_send(void) +{ +MigrationState *s; + +s = migrate_get_current(); + +return s->parameters.zero_copy_send; +} +#endif + int migrate_use_xbzrle(void) { MigrationState *s; @@ -4206,6 +4231,10 @@ 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), @@ -4303,6 +4332,9 @@ 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; diff --git a/migration/migration.h b/migration/migration.h index a863032b71..e8f2941a55 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -375,6 +375,11 @@ MultiFDCompression migrate_multifd_compression(void); int migrate_multifd_zlib_level(void); int migrate_multifd_zstd_level(void); +#ifdef CONFIG_LINUX +bool migrate_use_zero_copy_send(void); +#else +#define migrate_use_zero_copy_send() (false) +#endif int migrate_use_xbzrle(void); uint64_t migrate_xbzrle_cache_size(void); bool migrate_colo_enabled(void); diff --git a/migration/socket.c b/migration/socket.c index 05705a32d8..3754d8f72c 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -74,9 +74,16 @@ static void socket_outgoing_migration(QIOTask *task, if (qio_task_propagate_error(task, )) { trace_migration_socket_outgoing_error(error_get_pretty(err)); -} else { -trace_migration_socket_outgoing_connected(data->hostname); + goto out; } + +trace_migration_socket_outgoing_connected(data->hostname); + +if