Re: [Qemu-devel] [PATCH v3 5/8] migration: Add multifd-compress parameter
Wei Yang wrote: > On Wed, May 15, 2019 at 02:15:41PM +0200, Juan Quintela wrote: >>diff --git a/qapi/migration.json b/qapi/migration.json >>index 9cfbaf8c6c..8ec1944b7a 100644 >>--- a/qapi/migration.json >>+++ b/qapi/migration.json >>@@ -482,6 +482,19 @@ >> # TODO either fuse back into MigrationParameters, or make >>@@ -707,7 +726,8 @@ >> '*multifd-channels': 'int', >> '*xbzrle-cache-size': 'size', >> '*max-postcopy-bandwidth': 'size', >>- '*max-cpu-throttle': 'int' } } >>+ '*max-cpu-throttle': 'int', > > A tab at the beginning, it would be better to fix this :-) The wonders of magit+emacs, I didn't saw this one. Fixed. Thanks, Juan.
Re: [Qemu-devel] [PATCH v3 5/8] migration: Add multifd-compress parameter
Wei Yang wrote: > On Wed, May 15, 2019 at 02:15:41PM +0200, Juan Quintela wrote: >>Signed-off-by: Juan Quintela >>@@ -1821,6 +1826,18 @@ 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_COMPRESS: >>+p->has_multifd_compress = true; >>+visit_type_MultifdCompress(v, param, &compress_type, &err); >>+if (err) { >>+break; >>+} >>+if (compress_type < 0 || compress_type >= MULTIFD_COMPRESS__MAX) { > > A warning during build: > > hmp.c:1835:27: warning: comparison of unsigned enum expression < 0 is > always false [-Wtautological-compare] > if (compress_type < 0 || compress_type >= MULTIFD_COMPRESS__MAX) { Fixed, see Markus reason for dropping this bit. /me wonders why this didn't failed my compilation Thanks, Juan.
Re: [Qemu-devel] [PATCH v3 5/8] migration: Add multifd-compress parameter
Wei Yang wrote: > On Wed, May 15, 2019 at 02:15:41PM +0200, Juan Quintela wrote: >>Signed-off-by: Juan Quintela >>diff --git a/tests/migration-test.c b/tests/migration-test.c >>index 65d5e256a7..8a1ccc2516 100644 >>--- a/tests/migration-test.c >>+++ b/tests/migration-test.c > > Well, may I suggest to split the test into another one? In next patch, I get another multifd method. Think of this patch as a "rename", more than something different. Thanks, Juan.
Re: [Qemu-devel] [PATCH v3 5/8] migration: Add multifd-compress parameter
Markus Armbruster wrote: > Juan Quintela writes: >> +case MIGRATION_PARAMETER_MULTIFD_COMPRESS: >> +p->has_multifd_compress = true; >> +visit_type_MultifdCompress(v, param, &compress_type, &err); >> +if (err) { >> +break; >> +} >> +if (compress_type < 0 || compress_type >= MULTIFD_COMPRESS__MAX) { >> +error_setg(&err, "Invalid multifd_compress option %s", >> valuestr); >> +break; >> +} > > This should never happen. If you want to check anyway, make it an > assertion. > > Just in case you don't believe me, or are curious: > > visit_type_MultifdCompress() wraps around visit_type_enum(), passing it > &MultifdCompress_lookup. > > Since @v is an input visitor, visit_type_enum() wraps around > input_type_enum(). > > input_type_enum() computes the value to store in @compress_type with > qapi_enum_parse(). > > To get here, visit_type_MultifdCompress() must have succeeded, > i.e. visit_type_enum(), input_type_enum() and qapi_enum_parse() all > succeded. > > On success, qapi_enum_parse() returns one of the values in > MultifdCompress_lookup, i.e. a member of enum MultifdCompress other than > MULTIFD_COMPRESS__MAX. Fixed, thanks. >> @@ -3353,6 +3362,9 @@ void migration_global_dump(Monitor *mon) >> #define DEFINE_PROP_MIG_CAP(name, x) \ >> DEFINE_PROP_BOOL(name, MigrationState, enabled_capabilities[x], false) >> >> +#define DEFINE_PROP_MULTIFD_COMPRESS(_n, _s, _f, _d) \ >> +DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_multifd_compress, >> MultifdCompress) >> + > > Did you forget to move this? It appears that yes. I tried to move the other part out of qdev-properties, failed. And then forgot to move this bit. Thanks. Later, Juan.
Re: [Qemu-devel] [PATCH v3 5/8] migration: Add multifd-compress parameter
On Wed, May 15, 2019 at 02:15:41PM +0200, Juan Quintela wrote: >diff --git a/qapi/migration.json b/qapi/migration.json >index 9cfbaf8c6c..8ec1944b7a 100644 >--- a/qapi/migration.json >+++ b/qapi/migration.json >@@ -482,6 +482,19 @@ > ## > { 'command': 'query-migrate-capabilities', 'returns': > ['MigrationCapabilityStatus']} > >+## >+# @MultifdCompress: >+# >+# An enumeration of multifd compression. >+# >+# @none: no compression. >+# >+# Since: 4.1 >+# >+## >+{ 'enum': 'MultifdCompress', >+ 'data': [ 'none' ] } >+ > ## > # @MigrationParameter: > # >@@ -580,6 +593,9 @@ > # @max-cpu-throttle: maximum cpu throttle percentage. > #Defaults to 99. (Since 3.1) > # >+# @multifd-compress: Which compression method to use. >+#Defaults to none. (Since 4.1) >+# > # Since: 2.4 > ## > { 'enum': 'MigrationParameter', >@@ -592,7 +608,7 @@ >'downtime-limit', 'x-checkpoint-delay', 'block-incremental', >'multifd-channels', >'xbzrle-cache-size', 'max-postcopy-bandwidth', >- 'max-cpu-throttle' ] } >+ 'max-cpu-throttle', 'multifd-compress' ] } > > ## > # @MigrateSetParameters: >@@ -682,6 +698,9 @@ > # @max-cpu-throttle: maximum cpu throttle percentage. > #The default value is 99. (Since 3.1) > # >+# @multifd-compress: Which compression method to use. >+#Defaults to none. (Since 4.1) >+# > # Since: 2.4 > ## > # TODO either fuse back into MigrationParameters, or make >@@ -707,7 +726,8 @@ > '*multifd-channels': 'int', > '*xbzrle-cache-size': 'size', > '*max-postcopy-bandwidth': 'size', >- '*max-cpu-throttle': 'int' } } >+ '*max-cpu-throttle': 'int', A tab at the beginning, it would be better to fix this :-) >+'*multifd-compress': 'MultifdCompress' } } > > ## > # @migrate-set-parameters: >@@ -817,6 +837,9 @@ > #Defaults to 99. > # (Since 3.1) > # >+# @multifd-compress: Which compression method to use. >+#Defaults to none. (Since 4.1) >+# > # Since: 2.4 > ## > { 'struct': 'MigrationParameters', >@@ -840,7 +863,8 @@ > '*multifd-channels': 'uint8', > '*xbzrle-cache-size': 'size', > '*max-postcopy-bandwidth': 'size', >-'*max-cpu-throttle':'uint8'} } >+'*max-cpu-throttle': 'uint8', >+'*multifd-compress': 'MultifdCompress' } } > > ## > # @query-migrate-parameters: -- Wei Yang Help you, Help me
Re: [Qemu-devel] [PATCH v3 5/8] migration: Add multifd-compress parameter
On Wed, May 15, 2019 at 02:15:41PM +0200, Juan Quintela wrote: >Signed-off-by: Juan Quintela > >--- >Rename it to NONE >Fix typos (dave) >--- > hmp.c| 17 + > hw/core/qdev-properties.c| 13 + > include/hw/qdev-properties.h | 1 + > migration/migration.c| 16 > qapi/migration.json | 30 +++--- > tests/migration-test.c | 13 ++--- > 6 files changed, 84 insertions(+), 6 deletions(-) > >diff --git a/hmp.c b/hmp.c >index 56a3ed7375..5732c34249 100644 >--- a/hmp.c >+++ b/hmp.c >@@ -38,6 +38,7 @@ > #include "qapi/qapi-commands-run-state.h" > #include "qapi/qapi-commands-tpm.h" > #include "qapi/qapi-commands-ui.h" >+#include "qapi/qapi-visit-migration.h" > #include "qapi/qmp/qdict.h" > #include "qapi/qmp/qerror.h" > #include "qapi/string-input-visitor.h" >@@ -435,6 +436,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_COMPRESS), >+MultifdCompress_str(params->multifd_compress)); > monitor_printf(mon, "%s: %" PRIu64 "\n", > MigrationParameter_str(MIGRATION_PARAMETER_XBZRLE_CACHE_SIZE), > params->xbzrle_cache_size); >@@ -1736,6 +1740,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; >+MultifdCompress compress_type; > Error *err = NULL; > int val, ret; > >@@ -1821,6 +1826,18 @@ 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_COMPRESS: >+p->has_multifd_compress = true; >+visit_type_MultifdCompress(v, param, &compress_type, &err); >+if (err) { >+break; >+} >+if (compress_type < 0 || compress_type >= MULTIFD_COMPRESS__MAX) { A warning during build: hmp.c:1835:27: warning: comparison of unsigned enum expression < 0 is always false [-Wtautological-compare] if (compress_type < 0 || compress_type >= MULTIFD_COMPRESS__MAX) { -- Wei Yang Help you, Help me
Re: [Qemu-devel] [PATCH v3 5/8] migration: Add multifd-compress parameter
On Wed, May 15, 2019 at 02:15:41PM +0200, Juan Quintela wrote: >Signed-off-by: Juan Quintela > >--- >Rename it to NONE >Fix typos (dave) >--- > hmp.c| 17 + > hw/core/qdev-properties.c| 13 + > include/hw/qdev-properties.h | 1 + > migration/migration.c| 16 > qapi/migration.json | 30 +++--- > tests/migration-test.c | 13 ++--- > 6 files changed, 84 insertions(+), 6 deletions(-) > >diff --git a/hmp.c b/hmp.c >index 56a3ed7375..5732c34249 100644 >--- a/hmp.c >+++ b/hmp.c >@@ -38,6 +38,7 @@ > #include "qapi/qapi-commands-run-state.h" > #include "qapi/qapi-commands-tpm.h" > #include "qapi/qapi-commands-ui.h" >+#include "qapi/qapi-visit-migration.h" > #include "qapi/qmp/qdict.h" > #include "qapi/qmp/qerror.h" > #include "qapi/string-input-visitor.h" >@@ -435,6 +436,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_COMPRESS), >+MultifdCompress_str(params->multifd_compress)); > monitor_printf(mon, "%s: %" PRIu64 "\n", > MigrationParameter_str(MIGRATION_PARAMETER_XBZRLE_CACHE_SIZE), > params->xbzrle_cache_size); >@@ -1736,6 +1740,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; >+MultifdCompress compress_type; > Error *err = NULL; > int val, ret; > >@@ -1821,6 +1826,18 @@ 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_COMPRESS: >+p->has_multifd_compress = true; >+visit_type_MultifdCompress(v, param, &compress_type, &err); >+if (err) { >+break; >+} >+if (compress_type < 0 || compress_type >= MULTIFD_COMPRESS__MAX) { >+error_setg(&err, "Invalid multifd_compress option %s", valuestr); >+break; >+} >+p->multifd_compress = 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/hw/core/qdev-properties.c b/hw/core/qdev-properties.c >index 5da1439a8b..ebeeb5c88d 100644 >--- a/hw/core/qdev-properties.c >+++ b/hw/core/qdev-properties.c >@@ -5,6 +5,7 @@ > #include "hw/pci/pci.h" > #include "qapi/qmp/qerror.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" >@@ -645,6 +646,18 @@ const PropertyInfo qdev_prop_fdc_drive_type = { > .set_default_value = set_default_value_enum, > }; > >+/* --- MultifdCompress --- */ >+ >+const PropertyInfo qdev_prop_multifd_compress = { >+.name = "MultifdCompress", >+.description = "multifd_compress values, " >+ "none", >+.enum_table = &MultifdCompress_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 b6758c852e..ac452d8f2c 100644 >--- a/include/hw/qdev-properties.h >+++ b/include/hw/qdev-properties.h >@@ -23,6 +23,7 @@ extern const PropertyInfo qdev_prop_tpm; > extern const PropertyInfo qdev_prop_ptr; > extern const PropertyInfo qdev_prop_macaddr; > extern const PropertyInfo qdev_prop_on_off_auto; >+extern const PropertyInfo qdev_prop_multifd_compress; > extern const PropertyInfo qdev_prop_losttickpolicy; > extern const PropertyInfo qdev_prop_blockdev_on_error; > extern const PropertyInfo qdev_prop_bios_chs_trans; >diff --git a/migration/migration.c b/migration/migration.c >index 609e0df5d0..d6f8ef342a 100644 >--- a/migration/migration.c >+++ b/migration/migration.c >@@ -82,6 +82,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_COMPRESS MULTIFD_COMPRESS_NONE > > /* Background transfer rate for postcopy, 0 means unlimited, note > * that page requests can still exceed this limit. >@@ -769,6 +770,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_compress = true; >+params->multifd_compress = s->paramete
Re: [Qemu-devel] [PATCH v3 5/8] migration: Add multifd-compress parameter
Juan Quintela writes: > Signed-off-by: Juan Quintela > > --- > Rename it to NONE > Fix typos (dave) > --- > hmp.c| 17 + > hw/core/qdev-properties.c| 13 + > include/hw/qdev-properties.h | 1 + > migration/migration.c| 16 > qapi/migration.json | 30 +++--- > tests/migration-test.c | 13 ++--- > 6 files changed, 84 insertions(+), 6 deletions(-) > > diff --git a/hmp.c b/hmp.c > index 56a3ed7375..5732c34249 100644 > --- a/hmp.c > +++ b/hmp.c > @@ -38,6 +38,7 @@ > #include "qapi/qapi-commands-run-state.h" > #include "qapi/qapi-commands-tpm.h" > #include "qapi/qapi-commands-ui.h" > +#include "qapi/qapi-visit-migration.h" > #include "qapi/qmp/qdict.h" > #include "qapi/qmp/qerror.h" > #include "qapi/string-input-visitor.h" > @@ -435,6 +436,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_COMPRESS), > +MultifdCompress_str(params->multifd_compress)); > monitor_printf(mon, "%s: %" PRIu64 "\n", > MigrationParameter_str(MIGRATION_PARAMETER_XBZRLE_CACHE_SIZE), > params->xbzrle_cache_size); > @@ -1736,6 +1740,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; > +MultifdCompress compress_type; > Error *err = NULL; > int val, ret; > > @@ -1821,6 +1826,18 @@ 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_COMPRESS: > +p->has_multifd_compress = true; > +visit_type_MultifdCompress(v, param, &compress_type, &err); > +if (err) { > +break; > +} > +if (compress_type < 0 || compress_type >= MULTIFD_COMPRESS__MAX) { > +error_setg(&err, "Invalid multifd_compress option %s", valuestr); > +break; > +} This should never happen. If you want to check anyway, make it an assertion. Just in case you don't believe me, or are curious: visit_type_MultifdCompress() wraps around visit_type_enum(), passing it &MultifdCompress_lookup. Since @v is an input visitor, visit_type_enum() wraps around input_type_enum(). input_type_enum() computes the value to store in @compress_type with qapi_enum_parse(). To get here, visit_type_MultifdCompress() must have succeeded, i.e. visit_type_enum(), input_type_enum() and qapi_enum_parse() all succeded. On success, qapi_enum_parse() returns one of the values in MultifdCompress_lookup, i.e. a member of enum MultifdCompress other than MULTIFD_COMPRESS__MAX. > +p->multifd_compress = 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/hw/core/qdev-properties.c b/hw/core/qdev-properties.c > index 5da1439a8b..ebeeb5c88d 100644 > --- a/hw/core/qdev-properties.c > +++ b/hw/core/qdev-properties.c > @@ -5,6 +5,7 @@ > #include "hw/pci/pci.h" > #include "qapi/qmp/qerror.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" > @@ -645,6 +646,18 @@ const PropertyInfo qdev_prop_fdc_drive_type = { > .set_default_value = set_default_value_enum, > }; > > +/* --- MultifdCompress --- */ > + > +const PropertyInfo qdev_prop_multifd_compress = { > +.name = "MultifdCompress", > +.description = "multifd_compress values, " > + "none", This looks weird now, but it'll make sense when PATCH 7 adds the second value. > +.enum_table = &MultifdCompress_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 b6758c852e..ac452d8f2c 100644 > --- a/include/hw/qdev-properties.h > +++ b/include/hw/qdev-properties.h > @@ -23,6 +23,7 @@ extern const PropertyInfo qdev_prop_tpm; > extern const PropertyInfo qdev_prop_ptr; > extern const PropertyInfo qdev_prop_macaddr; > extern const PropertyInfo qdev_prop_on_off_auto; > +extern const PropertyInfo qdev_prop_multifd_compress; > extern const PropertyInfo qdev_prop_losttickpolicy; > extern const PropertyInfo qdev_prop_blockdev_on_error; > extern const PropertyInfo qdev_prop_bios_chs_trans; > diff --git a/migration/mi