Message ID | 20200129115655.10414-2-quintela@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Multifd Migration Compression | expand |
Juan Quintela <quintela@redhat.com> writes: > This will store the compression method to use. We start with none. > > Signed-off-by: Juan Quintela <quintela@redhat.com> > Reviewed-by: Markus Armbruster <armbru@redhat.com> I don't remember giving my R-by. I gave my Acked-by for [PATCH v2 06/10] migration: Add multifd-compress parameter Message-ID: <87d0cku5hq.fsf@dusky.pond.sub.org> https://lists.nongnu.org/archive/html/qemu-devel/2019-12/msg04153.html If I did give my R-by for a later revision, let me know. One small suggestion below. > Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> [...] > diff --git a/qapi/migration.json b/qapi/migration.json > index b7348d0c8b..96a126751c 100644 > --- a/qapi/migration.json > +++ b/qapi/migration.json > @@ -488,6 +488,19 @@ > ## > { 'command': 'query-migrate-capabilities', 'returns': ['MigrationCapabilityStatus']} > > +## > +# @MultiFDMethod: > +# > +# An enumeration of multifd compression. Suggest "compression methods." > +# > +# @none: no compression. > +# > +# Since: 5.0 > +# > +## > +{ 'enum': 'MultiFDMethod', > + 'data': [ 'none' ] } > + > ## > # @MigrationParameter: > # > @@ -586,6 +599,9 @@ > # @max-cpu-throttle: maximum cpu throttle percentage. > # Defaults to 99. (Since 3.1) > # > +# @multifd-method: Which compression method to use. > +# Defaults to none. (Since 5.0) > +# > # Since: 2.4 > ## > { 'enum': 'MigrationParameter', > @@ -598,7 +614,7 @@ > 'downtime-limit', 'x-checkpoint-delay', 'block-incremental', > 'multifd-channels', > 'xbzrle-cache-size', 'max-postcopy-bandwidth', > - 'max-cpu-throttle' ] } > + 'max-cpu-throttle', 'multifd-method' ] } > > ## > # @MigrateSetParameters: > @@ -688,6 +704,9 @@ > # @max-cpu-throttle: maximum cpu throttle percentage. > # The default value is 99. (Since 3.1) > # > +# @multifd-method: Which compression method to use. > +# Defaults to none. (Since 5.0) > +# > # Since: 2.4 > ## > # TODO either fuse back into MigrationParameters, or make > @@ -713,7 +732,8 @@ > '*multifd-channels': 'int', > '*xbzrle-cache-size': 'size', > '*max-postcopy-bandwidth': 'size', > - '*max-cpu-throttle': 'int' } } > + '*max-cpu-throttle': 'int', > + '*multifd-method': 'MultiFDMethod' } } > > ## > # @migrate-set-parameters: > @@ -823,6 +843,9 @@ > # Defaults to 99. > # (Since 3.1) > # > +# @multifd-method: Which compression method to use. > +# Defaults to none. (Since 5.0) > +# > # Since: 2.4 > ## > { 'struct': 'MigrationParameters', > @@ -846,7 +869,8 @@ > '*multifd-channels': 'uint8', > '*xbzrle-cache-size': 'size', > '*max-postcopy-bandwidth': 'size', > - '*max-cpu-throttle':'uint8'} } > + '*max-cpu-throttle': 'uint8', > + '*multifd-method': 'MultiFDMethod' } } > > ## > # @query-migrate-parameters: [...]
Markus Armbruster <armbru@redhat.com> wrote: > Juan Quintela <quintela@redhat.com> writes: > >> This will store the compression method to use. We start with none. >> >> Signed-off-by: Juan Quintela <quintela@redhat.com> >> Reviewed-by: Markus Armbruster <armbru@redhat.com> > > I don't remember giving my R-by. I gave my Acked-by for > [PATCH v2 06/10] migration: Add multifd-compress parameter > Message-ID: <87d0cku5hq.fsf@dusky.pond.sub.org> > https://lists.nongnu.org/archive/html/qemu-devel/2019-12/msg04153.html > If I did give my R-by for a later revision, let me know. Hi Ouch, I *thought* that you got confused. It happens to me all the time. Apologies. So, how I should I put that Acked-by: in the commit? > One small suggestion below. Thanks. >> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> > [...] >> diff --git a/qapi/migration.json b/qapi/migration.json >> index b7348d0c8b..96a126751c 100644 >> --- a/qapi/migration.json >> +++ b/qapi/migration.json >> @@ -488,6 +488,19 @@ >> ## >> { 'command': 'query-migrate-capabilities', 'returns': >> ['MigrationCapabilityStatus']} >> >> +## >> +# @MultiFDMethod: >> +# >> +# An enumeration of multifd compression. > > Suggest "compression methods." will do. Sorry again for the missunderstanding. Later, Juan.
Juan Quintela <quintela@redhat.com> writes: > Markus Armbruster <armbru@redhat.com> wrote: >> Juan Quintela <quintela@redhat.com> writes: >> >>> This will store the compression method to use. We start with none. >>> >>> Signed-off-by: Juan Quintela <quintela@redhat.com> >>> Reviewed-by: Markus Armbruster <armbru@redhat.com> >> >> I don't remember giving my R-by. I gave my Acked-by for >> [PATCH v2 06/10] migration: Add multifd-compress parameter >> Message-ID: <87d0cku5hq.fsf@dusky.pond.sub.org> >> https://lists.nongnu.org/archive/html/qemu-devel/2019-12/msg04153.html > >> If I did give my R-by for a later revision, let me know. > > Hi > > Ouch, I *thought* that you got confused. It happens to me all the time. > Apologies. > So, how I should I put that Acked-by: in the commit? Replace Reviewed-by: Markus Armbruster <armbru@redhat.com> by Acked-by: Markus Armbruster <armbru@redhat.com> >> One small suggestion below. > > Thanks. > >>> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> >> [...] >>> diff --git a/qapi/migration.json b/qapi/migration.json >>> index b7348d0c8b..96a126751c 100644 >>> --- a/qapi/migration.json >>> +++ b/qapi/migration.json >>> @@ -488,6 +488,19 @@ >>> ## >>> { 'command': 'query-migrate-capabilities', 'returns': >>> ['MigrationCapabilityStatus']} >>> >>> +## >>> +# @MultiFDMethod: >>> +# >>> +# An enumeration of multifd compression. >> >> Suggest "compression methods." > > will do. > > Sorry again for the missunderstanding. No harm, no foul :)
On Wed, Jan 29, 2020 at 12:56:48PM +0100, Juan Quintela wrote: > This will store the compression method to use. We start with none. > > Signed-off-by: Juan Quintela <quintela@redhat.com> > Reviewed-by: Markus Armbruster <armbru@redhat.com> > Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> > --- > hw/core/qdev-properties.c | 13 +++++++++++++ > include/hw/qdev-properties.h | 3 +++ > migration/migration.c | 13 +++++++++++++ > monitor/hmp-cmds.c | 13 +++++++++++++ > qapi/migration.json | 30 +++++++++++++++++++++++++++--- > tests/qtest/migration-test.c | 14 ++++++++++---- > 6 files changed, 79 insertions(+), 7 deletions(-) > > diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c > index 7f93bfeb88..4442844d37 100644 > --- a/hw/core/qdev-properties.c > +++ b/hw/core/qdev-properties.c > @@ -8,6 +8,7 @@ > @@ -488,6 +488,19 @@ > ## > { 'command': 'query-migrate-capabilities', 'returns': ['MigrationCapabilityStatus']} > > +## > +# @MultiFDMethod: > +# > +# An enumeration of multifd compression. > +# > +# @none: no compression. > +# > +# Since: 5.0 > +# > +## > +{ 'enum': 'MultiFDMethod', > + 'data': [ 'none' ] } I feel like "MultiFDMethod" is better called "MultiFDCompression" > + > ## > # @MigrationParameter: > # > @@ -586,6 +599,9 @@ > # @max-cpu-throttle: maximum cpu throttle percentage. > # Defaults to 99. (Since 3.1) > # > +# @multifd-method: Which compression method to use. > +# Defaults to none. (Since 5.0) > +# > # Since: 2.4 > ## > { 'enum': 'MigrationParameter', > @@ -598,7 +614,7 @@ > 'downtime-limit', 'x-checkpoint-delay', 'block-incremental', > 'multifd-channels', > 'xbzrle-cache-size', 'max-postcopy-bandwidth', > - 'max-cpu-throttle' ] } > + 'max-cpu-throttle', 'multifd-method' ] } > > ## > # @MigrateSetParameters: > @@ -688,6 +704,9 @@ > # @max-cpu-throttle: maximum cpu throttle percentage. > # The default value is 99. (Since 3.1) > # > +# @multifd-method: Which compression method to use. > +# Defaults to none. (Since 5.0) > +# > # Since: 2.4 > ## > # TODO either fuse back into MigrationParameters, or make > @@ -713,7 +732,8 @@ > '*multifd-channels': 'int', > '*xbzrle-cache-size': 'size', > '*max-postcopy-bandwidth': 'size', > - '*max-cpu-throttle': 'int' } } > + '*max-cpu-throttle': 'int', > + '*multifd-method': 'MultiFDMethod' } } Regards, Daniel
Daniel P. Berrangé <berrange@redhat.com> wrote: > On Wed, Jan 29, 2020 at 12:56:48PM +0100, Juan Quintela wrote: >> This will store the compression method to use. We start with none. >> >> Signed-off-by: Juan Quintela <quintela@redhat.com> >> Reviewed-by: Markus Armbruster <armbru@redhat.com> >> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> >> --- >> hw/core/qdev-properties.c | 13 +++++++++++++ >> include/hw/qdev-properties.h | 3 +++ >> migration/migration.c | 13 +++++++++++++ >> monitor/hmp-cmds.c | 13 +++++++++++++ >> qapi/migration.json | 30 +++++++++++++++++++++++++++--- >> tests/qtest/migration-test.c | 14 ++++++++++---- >> 6 files changed, 79 insertions(+), 7 deletions(-) >> >> diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c >> index 7f93bfeb88..4442844d37 100644 >> --- a/hw/core/qdev-properties.c >> +++ b/hw/core/qdev-properties.c >> @@ -8,6 +8,7 @@ > >> @@ -488,6 +488,19 @@ >> ## >> { 'command': 'query-migrate-capabilities', 'returns': ['MigrationCapabilityStatus']} >> >> +## >> +# @MultiFDMethod: >> +# >> +# An enumeration of multifd compression. >> +# >> +# @none: no compression. >> +# >> +# Since: 5.0 >> +# >> +## >> +{ 'enum': 'MultiFDMethod', >> + 'data': [ 'none' ] } > > I feel like "MultiFDMethod" is better called "MultiFDCompression" Changed. Thanks, Juan.
diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 7f93bfeb88..4442844d37 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -8,6 +8,7 @@ #include "qapi/qmp/qerror.h" #include "qemu/ctype.h" #include "qemu/error-report.h" +#include "qapi/qapi-types-migration.h" #include "hw/block/block.h" #include "net/hub.h" #include "qapi/visitor.h" @@ -639,6 +640,18 @@ const PropertyInfo qdev_prop_fdc_drive_type = { .set_default_value = set_default_value_enum, }; +/* --- MultiFDMethod --- */ + +const PropertyInfo qdev_prop_multifd_method = { + .name = "MultiFDMethod", + .description = "multifd_method values, " + "none", + .enum_table = &MultiFDMethod_lookup, + .get = get_enum, + .set = set_enum, + .set_default_value = set_default_value_enum, +}; + /* --- pci address --- */ /* diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 906e697c58..6871b075a6 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -20,6 +20,7 @@ extern const PropertyInfo qdev_prop_chr; extern const PropertyInfo qdev_prop_tpm; extern const PropertyInfo qdev_prop_macaddr; extern const PropertyInfo qdev_prop_on_off_auto; +extern const PropertyInfo qdev_prop_multifd_method; extern const PropertyInfo qdev_prop_losttickpolicy; extern const PropertyInfo qdev_prop_blockdev_on_error; extern const PropertyInfo qdev_prop_bios_chs_trans; @@ -184,6 +185,8 @@ extern const PropertyInfo qdev_prop_pcie_link_width; DEFINE_PROP(_n, _s, _f, qdev_prop_macaddr, MACAddr) #define DEFINE_PROP_ON_OFF_AUTO(_n, _s, _f, _d) \ DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_on_off_auto, OnOffAuto) +#define DEFINE_PROP_MULTIFD_METHOD(_n, _s, _f, _d) \ + DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_multifd_method, MultiFDMethod) #define DEFINE_PROP_LOSTTICKPOLICY(_n, _s, _f, _d) \ DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_losttickpolicy, \ LostTickPolicy) diff --git a/migration/migration.c b/migration/migration.c index 3a21a4686c..cd72bb6e9a 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -88,6 +88,7 @@ /* The delay time (in ms) between two COLO checkpoints */ #define DEFAULT_MIGRATE_X_CHECKPOINT_DELAY (200 * 100) #define DEFAULT_MIGRATE_MULTIFD_CHANNELS 2 +#define DEFAULT_MIGRATE_MULTIFD_METHOD MULTIFD_METHOD_NONE /* Background transfer rate for postcopy, 0 means unlimited, note * that page requests can still exceed this limit. @@ -798,6 +799,8 @@ MigrationParameters *qmp_query_migrate_parameters(Error **errp) params->block_incremental = s->parameters.block_incremental; params->has_multifd_channels = true; params->multifd_channels = s->parameters.multifd_channels; + params->has_multifd_method = true; + params->multifd_method = s->parameters.multifd_method; params->has_xbzrle_cache_size = true; params->xbzrle_cache_size = s->parameters.xbzrle_cache_size; params->has_max_postcopy_bandwidth = true; @@ -1315,6 +1318,9 @@ static void migrate_params_test_apply(MigrateSetParameters *params, if (params->has_multifd_channels) { dest->multifd_channels = params->multifd_channels; } + if (params->has_multifd_method) { + dest->multifd_method = params->multifd_method; + } if (params->has_xbzrle_cache_size) { dest->xbzrle_cache_size = params->xbzrle_cache_size; } @@ -1411,6 +1417,9 @@ static void migrate_params_apply(MigrateSetParameters *params, Error **errp) if (params->has_multifd_channels) { s->parameters.multifd_channels = params->multifd_channels; } + if (params->has_multifd_method) { + s->parameters.multifd_method = params->multifd_method; + } if (params->has_xbzrle_cache_size) { s->parameters.xbzrle_cache_size = params->xbzrle_cache_size; xbzrle_cache_resize(params->xbzrle_cache_size, errp); @@ -3515,6 +3524,9 @@ static Property migration_properties[] = { DEFINE_PROP_UINT8("multifd-channels", MigrationState, parameters.multifd_channels, DEFAULT_MIGRATE_MULTIFD_CHANNELS), + DEFINE_PROP_MULTIFD_METHOD("multifd-method", MigrationState, + parameters.multifd_method, + DEFAULT_MIGRATE_MULTIFD_METHOD), DEFINE_PROP_SIZE("xbzrle-cache-size", MigrationState, parameters.xbzrle_cache_size, DEFAULT_MIGRATE_XBZRLE_CACHE_SIZE), @@ -3605,6 +3617,7 @@ static void migration_instance_init(Object *obj) params->has_x_checkpoint_delay = true; params->has_block_incremental = true; params->has_multifd_channels = true; + params->has_multifd_method = true; params->has_xbzrle_cache_size = true; params->has_max_postcopy_bandwidth = true; params->has_max_cpu_throttle = true; diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index d0e0af893a..16f01d4244 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -39,6 +39,7 @@ #include "qapi/qapi-commands-tpm.h" #include "qapi/qapi-commands-ui.h" #include "qapi/qapi-visit-net.h" +#include "qapi/qapi-visit-migration.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qerror.h" #include "qapi/string-input-visitor.h" @@ -447,6 +448,9 @@ void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict) monitor_printf(mon, "%s: %u\n", MigrationParameter_str(MIGRATION_PARAMETER_MULTIFD_CHANNELS), params->multifd_channels); + monitor_printf(mon, "%s: %s\n", + MigrationParameter_str(MIGRATION_PARAMETER_MULTIFD_METHOD), + MultiFDMethod_str(params->multifd_method)); monitor_printf(mon, "%s: %" PRIu64 "\n", MigrationParameter_str(MIGRATION_PARAMETER_XBZRLE_CACHE_SIZE), params->xbzrle_cache_size); @@ -1738,6 +1742,7 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict) MigrateSetParameters *p = g_new0(MigrateSetParameters, 1); uint64_t valuebw = 0; uint64_t cache_size; + MultiFDMethod compress_type; Error *err = NULL; int val, ret; @@ -1823,6 +1828,14 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict) p->has_multifd_channels = true; visit_type_int(v, param, &p->multifd_channels, &err); break; + case MIGRATION_PARAMETER_MULTIFD_METHOD: + p->has_multifd_method = true; + visit_type_MultiFDMethod(v, param, &compress_type, &err); + if (err) { + break; + } + p->multifd_method = compress_type; + break; case MIGRATION_PARAMETER_XBZRLE_CACHE_SIZE: p->has_xbzrle_cache_size = true; visit_type_size(v, param, &cache_size, &err); diff --git a/qapi/migration.json b/qapi/migration.json index b7348d0c8b..96a126751c 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -488,6 +488,19 @@ ## { 'command': 'query-migrate-capabilities', 'returns': ['MigrationCapabilityStatus']} +## +# @MultiFDMethod: +# +# An enumeration of multifd compression. +# +# @none: no compression. +# +# Since: 5.0 +# +## +{ 'enum': 'MultiFDMethod', + 'data': [ 'none' ] } + ## # @MigrationParameter: # @@ -586,6 +599,9 @@ # @max-cpu-throttle: maximum cpu throttle percentage. # Defaults to 99. (Since 3.1) # +# @multifd-method: Which compression method to use. +# Defaults to none. (Since 5.0) +# # Since: 2.4 ## { 'enum': 'MigrationParameter', @@ -598,7 +614,7 @@ 'downtime-limit', 'x-checkpoint-delay', 'block-incremental', 'multifd-channels', 'xbzrle-cache-size', 'max-postcopy-bandwidth', - 'max-cpu-throttle' ] } + 'max-cpu-throttle', 'multifd-method' ] } ## # @MigrateSetParameters: @@ -688,6 +704,9 @@ # @max-cpu-throttle: maximum cpu throttle percentage. # The default value is 99. (Since 3.1) # +# @multifd-method: Which compression method to use. +# Defaults to none. (Since 5.0) +# # Since: 2.4 ## # TODO either fuse back into MigrationParameters, or make @@ -713,7 +732,8 @@ '*multifd-channels': 'int', '*xbzrle-cache-size': 'size', '*max-postcopy-bandwidth': 'size', - '*max-cpu-throttle': 'int' } } + '*max-cpu-throttle': 'int', + '*multifd-method': 'MultiFDMethod' } } ## # @migrate-set-parameters: @@ -823,6 +843,9 @@ # Defaults to 99. # (Since 3.1) # +# @multifd-method: Which compression method to use. +# Defaults to none. (Since 5.0) +# # Since: 2.4 ## { 'struct': 'MigrationParameters', @@ -846,7 +869,8 @@ '*multifd-channels': 'uint8', '*xbzrle-cache-size': 'size', '*max-postcopy-bandwidth': 'size', - '*max-cpu-throttle':'uint8'} } + '*max-cpu-throttle': 'uint8', + '*multifd-method': 'MultiFDMethod' } } ## # @query-migrate-parameters: diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index cf27ebbc9d..d2f9ef38f5 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -378,7 +378,6 @@ static void migrate_check_parameter_str(QTestState *who, const char *parameter, g_free(result); } -__attribute__((unused)) static void migrate_set_parameter_str(QTestState *who, const char *parameter, const char *value) { @@ -1251,7 +1250,7 @@ static void test_migrate_auto_converge(void) test_migrate_end(from, to, true); } -static void test_multifd_tcp(void) +static void test_multifd_tcp(const char *method) { MigrateStart *args = migrate_start_new(); QTestState *from, *to; @@ -1275,6 +1274,9 @@ static void test_multifd_tcp(void) migrate_set_parameter_int(from, "multifd-channels", 16); migrate_set_parameter_int(to, "multifd-channels", 16); + migrate_set_parameter_str(from, "multifd-method", method); + migrate_set_parameter_str(to, "multifd-method", method); + migrate_set_capability(from, "multifd", "true"); migrate_set_capability(to, "multifd", "true"); @@ -1306,6 +1308,11 @@ static void test_multifd_tcp(void) g_free(uri); } +static void test_multifd_tcp_none(void) +{ + test_multifd_tcp("none"); +} + /* * This test does: * source target @@ -1317,7 +1324,6 @@ static void test_multifd_tcp(void) * * And see that it works */ - static void test_multifd_tcp_cancel(void) { MigrateStart *args = migrate_start_new(); @@ -1467,7 +1473,7 @@ int main(int argc, char **argv) test_validate_uuid_dst_not_set); qtest_add_func("/migration/auto_converge", test_migrate_auto_converge); - qtest_add_func("/migration/multifd/tcp", test_multifd_tcp); + qtest_add_func("/migration/multifd/tcp/none", test_multifd_tcp_none); qtest_add_func("/migration/multifd/tcp/cancel", test_multifd_tcp_cancel); ret = g_test_run();