Live Migration Acceleration with IAA Compression
v2 cover Live Migration Acceleration with IAA Compression
Hi,
I am writing to submit a code change aimed at enhancing live migration acceleration by leveraging the compression capability of the Intel In-Memory Analytics Accelerator (IAA).
The implementation of the IAA (de)compression code is based on Intel Query Processing Library (QPL), an open-source software project designed for IAA high-level software programming. https://github.com/intel/qpl
In the previous version, there was some discussion about whether to introduce a new compression algorithm for IAA. Because the compression algorithm of IAA hardware is based on deflate, and QPL already supports Zlib, so in this version, I implemented IAA as an accelerator for the Zlib compression method. However, due to some reasons, QPL is currently not compatible with the existing Zlib method that Zlib compressed data can be decompressed by QPl and vice versa, I am still working on resolving compatibility issues.
I have some concerns about the existing Zlib compression
1. Will you consider supporting one channel to support multi-stream compression? Of course, this may lead to a reduction in compression ratio, but it will allow the hardware to process each stream concurrently. We can have each stream process multiple pages, reducing the loss of compression ratio. For example, 128 pages are divided into 16 streams for independent compression.
2. Will you consider using QPL/IAA as an independent compression algorithm instead of an accelerator? In this way, we can better utilize hardware performance and some features, such as IAA's canned mode, which can be dynamically generated by some statistics of data. A huffman table to improve the compression ratio.
Test condition:
1. Host CPUs are based on Sapphire Rapids, and frequency locked to 3.4G
2. VM type, 16 vCPU and 64G memory
3. The Idle workload means no workload is running in the VM
4. The Redis workload means YCSB workloadb + Redis Server are running in the VM, about 20G or more memory will be used.
5. Source side migartion configuration commands
a. migrate_set_capability multifd on
b. migrate_set_parameter multifd-channels 2/4/8
c. migrate_set_parameter downtime-limit 300
d. migrate_set_parameter multifd-compression zlib
e. migrate_set_parameter multifd-compression-accel none/qpl f. migrate_set_parameter max-bandwidth 100G
6. Desitination side migration configuration commands
a. migrate_set_capability multifd on
b. migrate_set_parameter multifd-channels 2/4/8
c. migrate_set_parameter multifd-compression zlib
d. migrate_set_parameter multifd-compression-accel none/qpl e. migrate_set_parameter max-bandwidth 100G
Early migration result, each result is the average of three tests
+--------+-------------+--------+--------+---------+----+-----+ | | The number |total |downtime|network |pages per | | | of channels |time(ms)|(ms) |bandwidth|second | | | and mode | | |(mbps) | | | +-------------+-----------------+---------+----------+ | | 2 chl, Zlib | 20647 | 22 | 195 | 137767 | | +-------------+--------+--------+---------+----------+ | Idle | 2 chl, IAA | 17022 | 36 | 286 | 460289 | |workload+-------------+--------+--------+---------+----------+ | | 4 chl, Zlib | 18835 | 29 | 241 | 299028 | | +-------------+--------+--------+---------+----------+ | | 4 chl, IAA | 16280 | 32 | 298 | 652456 | | +-------------+--------+--------+---------+----------+ | | 8 chl, Zlib | 17379 | 32 | 275 | 470591 | | +-------------+--------+--------+---------+----------+ | | 8 chl, IAA | 15551 | 46 | 313 | 1315784 | +--------+-------------+--------+--------+---------+----------+
+--------+-------------+--------+--------+---------+----+-----+ | | The number |total |downtime|network |pages per | | | of channels |time(ms)|(ms) |bandwidth|second | | | and mode | | |(mbps) | | | +-------------+-----------------+---------+----------+ | | 2 chl, Zlib | 100% failure, timeout is 120s | | +-------------+--------+--------+---------+----------+ | Redis | 2 chl, IAA | 62737 | 115 | 4547 | 387911 | |workload+-------------+--------+--------+---------+----------+ | | 4 chl, Zlib | 30% failure, timeout is 120s | | +-------------+--------+--------+---------+----------+ | | 4 chl, IAA | 54645 | 177 | 5382 | 656865 | | +-------------+--------+--------+---------+----------+ | | 8 chl, Zlib | 93488 | 74 | 1264 | 129486 | | +-------------+--------+--------+---------+----------+ | | 8 chl, IAA | 24367 | 303 | 6901 | 964380 | +--------+-------------+--------+--------+---------+----------+
v2:
- add support for multifd compression accelerator
- add support for the QPL accelerator in the multifd compression accelerator
- fixed the issue that QPL was compiled into the migration module by default
Yuan Liu (4):
migration: Introduce multifd-compression-accel parameter
multifd: Implement multifd compression accelerator
configure: add qpl option
multifd: Introduce QPL compression accelerator
hw/core/qdev-properties-system.c | 11 + include/hw/qdev-properties-system.h | 4 + meson.build | 7 + meson_options.txt | 2 + migration/meson.build | 1 + migration/migration-hmp-cmds.c | 10 + migration/multifd-qpl.c | 326 ++++++++++++++++++++++++++++ migration/multifd.c | 38 +++- migration/multifd.h | 8 + migration/options.c | 24 ++ migration/options.h | 1 + qapi/migration.json | 26 ++- scripts/meson-buildoptions.sh | 3 + 13 files changed, 458 insertions(+), 3 deletions(-) create mode 100644 migration/multifd-qpl.c
--
2.39.3
PATCH v2 1/4 migration: Introduce multifd-compression-accel parameter
Introduce the multifd-compression-accel option to enable or disable live migration data (de)compression accelerator.
The default value of multifd-compression-accel is auto, and the enabling and selection of the accelerator are automatically detected. By setting multifd-compression-accel=none, the acceleration function can be disabled. Similarly, users can explicitly specify a specific accelerator name, such as multifd-compression-accel=qpl.
--- hw/core/qdev-properties-system.c | 11 +++++++++++ include/hw/qdev-properties-system.h | 4 ++++ migration/migration-hmp-cmds.c | 10 ++++++++++ migration/options.c | 24 ++++++++++++++++++++++++ migration/options.h | 1 + qapi/migration.json | 26 +++++++++++++++++++++++++- 6 files changed, 75 insertions(+), 1 deletion(-)
hw/core/qdev-properties-system.c +11 -0
@@ -673,6 +673,17 @@ const PropertyInfo qdev_prop_multifd_compression = { .set_default_value = qdev_propinfo_set_default_value_enum, }; +/* --- MultiFD Compression Accelerator --- */ + +const PropertyInfo qdev_prop_multifd_compression_accel = { + .name ="MultiFDCompressionAccel" , + .description ="MultiFD Compression Accelerator, " +"auto/none/qpl" , + .enum_table = &MultiFDCompressionAccel_lookup, + .get = qdev_propinfo_get_enum, + .set = qdev_propinfo_set_enum, + .set_default_value = qdev_propinfo_set_default_value_enum, +};/* --- Reserved Region --- */ /*
include/hw/qdev-properties-system.h +4 -0
@@ -7,6 +7,7 @@ extern const PropertyInfo qdev_prop_chr;extern const PropertyInfo qdev_prop_macaddr;extern const PropertyInfo qdev_prop_reserved_region;extern const PropertyInfo qdev_prop_multifd_compression; +extern const PropertyInfo qdev_prop_multifd_compression_accel;extern const PropertyInfo qdev_prop_losttickpolicy;extern const PropertyInfo qdev_prop_blockdev_on_error;extern const PropertyInfo qdev_prop_bios_chs_trans;
@@ -41,6 +42,9 @@ extern const PropertyInfo qdev_prop_pcie_link_width;#define DEFINE_PROP_MULTIFD_COMPRESSION (_n, _s, _f, _d) \ DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_multifd_compression, \ MultiFDCompression) +#define DEFINE_PROP_MULTIFD_COMPRESSION_ACCEL (_n, _s, _f, _d) \ + DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_multifd_compression_accel, \ + MultiFDCompressionAccel)#define DEFINE_PROP_LOSTTICKPOLICY (_n, _s, _f, _d) \ DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_losttickpolicy, \ LostTickPolicy)
migration/migration-hmp-cmds.c +10 -0
@@ -344,6 +344,11 @@ void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict)monitor_printf (mon,"%s: %s\n" ,MigrationParameter_str (MIGRATION_PARAMETER_MULTIFD_COMPRESSION ),MultiFDCompression_str (params->multifd_compression)); +assert (params->has_multifd_compression_accel); +monitor_printf (mon,"%s: %s\n" , +MigrationParameter_str ( +MIGRATION_PARAMETER_MULTIFD_COMPRESSION_ACCEL ), +MultiFDCompressionAccel_str (params->multifd_compression_accel));monitor_printf (mon,"%s: %" PRIu64" bytes\n" ,MigrationParameter_str (MIGRATION_PARAMETER_XBZRLE_CACHE_SIZE ), params->xbzrle_cache_size);
@@ -610,6 +615,11 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)visit_type_MultiFDCompression (v, param, &p->multifd_compression, &err);break ; +case MIGRATION_PARAMETER_MULTIFD_COMPRESSION_ACCEL : + p->has_multifd_compression_accel = true; +visit_type_MultiFDCompressionAccel (v, param, + &p->multifd_compression_accel, &err); +break ;case MIGRATION_PARAMETER_MULTIFD_ZLIB_LEVEL : p->has_multifd_zlib_level = true;visit_type_uint8 (v, param, &p->multifd_zlib_level, &err);
migration/options.c +24 -0
@@ -59,6 +59,8 @@#define DEFAULT_MIGRATE_X_CHECKPOINT_DELAY (200 * 100)#define DEFAULT_MIGRATE_MULTIFD_CHANNELS 2#define DEFAULT_MIGRATE_MULTIFD_COMPRESSION MULTIFD_COMPRESSION_NONE +/* By default use the accelerator for multifd compression */ +#define DEFAULT_MIGRATE_MULTIFD_COMPRESSION_ACCEL MULTIFD_COMPRESSION_ACCEL_AUTO/* 0: means nocompress, 1: best speed, ... 9: best compress ratio */ #define DEFAULT_MIGRATE_MULTIFD_ZLIB_LEVEL 1/* 0: means nocompress, 1: best speed, ... 20: best compress ratio */
@@ -139,6 +141,9 @@ Property migration_properties[] = {DEFINE_PROP_MULTIFD_COMPRESSION ("multifd-compression" , MigrationState, parameters.multifd_compression,DEFAULT_MIGRATE_MULTIFD_COMPRESSION ), +DEFINE_PROP_MULTIFD_COMPRESSION_ACCEL ("multifd-compression-accel" , + MigrationState, parameters.multifd_compression_accel, +DEFAULT_MIGRATE_MULTIFD_COMPRESSION_ACCEL ),DEFINE_PROP_UINT8 ("multifd-zlib-level" , MigrationState, parameters.multifd_zlib_level, DEFAULT_MIGRATE_MULTIFD_ZLIB_LEVEL),
@@ -818,6 +823,15 @@ MultiFDCompression migrate_multifd_compression(void)return s->parameters.multifd_compression; } +MultiFDCompressionAccel migrate_multifd_compression_accel (void ) +{ +MigrationState *s =migrate_get_current (); + +assert (s->parameters.multifd_compression_accel < +MULTIFD_COMPRESSION_ACCEL__MAX ); +return s->parameters.multifd_compression_accel; +} +int migrate_multifd_zlib_level (void ) {MigrationState *s =migrate_get_current ();
@@ -945,6 +959,8 @@ MigrationParameters *qmp_query_migrate_parameters(Error **errp) params->multifd_channels = s->parameters.multifd_channels; params->has_multifd_compression = true; params->multifd_compression = s->parameters.multifd_compression; + params->has_multifd_compression_accel = true; + params->multifd_compression_accel = s->parameters.multifd_compression_accel; params->has_multifd_zlib_level = true; params->multifd_zlib_level = s->parameters.multifd_zlib_level; params->has_multifd_zstd_level = true;
@@ -999,6 +1015,7 @@ void migrate_params_init(MigrationParameters *params) params->has_block_incremental = true; params->has_multifd_channels = true; params->has_multifd_compression = true; + params->has_multifd_compression_accel = true; params->has_multifd_zlib_level = true; params->has_multifd_zstd_level = true; params->has_xbzrle_cache_size = true;
@@ -1273,6 +1290,9 @@ static void migrate_params_test_apply(MigrateSetParameters *params,if (params->has_multifd_compression) { dest->multifd_compression = params->multifd_compression; } +if (params->has_multifd_compression_accel) { + dest->multifd_compression_accel = params->multifd_compression_accel; + }if (params->has_xbzrle_cache_size) { dest->xbzrle_cache_size = params->xbzrle_cache_size; }
@@ -1394,6 +1414,10 @@ static void migrate_params_apply(MigrateSetParameters *params, Error **errp)if (params->has_multifd_compression) { s->parameters.multifd_compression = params->multifd_compression; } +if (params->has_multifd_compression_accel) { + s->parameters.multifd_compression_accel = + params->multifd_compression_accel; + }if (params->has_xbzrle_cache_size) { s->parameters.xbzrle_cache_size = params->xbzrle_cache_size;xbzrle_cache_resize (params->xbzrle_cache_size, errp);
migration/options.h +1 -0
@@ -85,6 +85,7 @@ uint64_t migrate_avail_switchover_bandwidth(void);uint64_t migrate_max_postcopy_bandwidth (void );int migrate_multifd_channels (void );MultiFDCompression migrate_multifd_compression (void ); +MultiFDCompressionAccel migrate_multifd_compression_accel (void );int migrate_multifd_zlib_level (void );int migrate_multifd_zstd_level (void );uint8_t migrate_throttle_trigger_threshold (void );
qapi/migration.json +25 -1
@@ -616,6 +616,22 @@ { 'name': 'zstd', 'if': 'CONFIG_ZSTD' } ] } ## +# @MultiFDCompressionAccel: +# +# An enumeration of multifd compression accelerator. +# +# @auto: automatically determined if accelerator is available. +# +# @none: disable compression accelerator. +# +# @qpl: enable qpl compression accelerator. +# +# Since: 8.2 +## +{ 'enum': 'MultiFDCompressionAccel', + 'data': [ 'auto', 'none', + { 'name': 'qpl', 'if': 'CONFIG_QPL' } ] } +## # @BitmapMigrationBitmapAliasTransform: # # @persistent: If present, the bitmap will be made persistent or
@@ -798,6 +814,9 @@ # @multifd-compression: Which compression method to use. Defaults to # none. (Since 5.0) # +# @multifd-compression-accel: Which compression accelerator to use. Defaults to +# auto. (Since 8.2) +# # @multifd-zlib-level: Set the compression level to be used in live # migration, the compression level is an integer between 0 and 9, # where 0 means no compression, 1 means the best compression
@@ -853,7 +872,7 @@ 'block-incremental', 'multifd-channels', 'xbzrle-cache-size', 'max-postcopy-bandwidth', - 'max-cpu-throttle', 'multifd-compression', + 'max-cpu-throttle', 'multifd-compression', 'multifd-compression-accel', 'multifd-zlib-level', 'multifd-zstd-level', 'block-bitmap-mapping', { 'name': 'x-vcpu-dirty-limit-period', 'features': ['unstable'] },
@@ -974,6 +993,9 @@ # @multifd-compression: Which compression method to use. Defaults to # none. (Since 5.0) # +# @multifd-compression-accel: Which compression acclerator to use. Defaults to +# auto. (Since 8.2) +# # @multifd-zlib-level: Set the compression level to be used in live # migration, the compression level is an integer between 0 and 9, # where 0 means no compression, 1 means the best compression
@@ -1046,6 +1068,7 @@ '*max-postcopy-bandwidth': 'size', '*max-cpu-throttle': 'uint8', '*multifd-compression': 'MultiFDCompression', + '*multifd-compression-accel': 'MultiFDCompressionAccel', '*multifd-zlib-level': 'uint8', '*multifd-zstd-level': 'uint8', '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ],
@@ -1257,6 +1280,7 @@ '*max-postcopy-bandwidth': 'size', '*max-cpu-throttle': 'uint8', '*multifd-compression': 'MultiFDCompression', + '*multifd-compression-accel': 'MultiFDCompressionAccel', '*multifd-zlib-level': 'uint8', '*multifd-zstd-level': 'uint8', '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ],
--
2.39.3
Re: [PATCH v2 1/4] migration: Introduce multifd-compression-accel parameter
Quoted 97 lines · Yuan Liu
Introduce the multifd-compression-accel option to enable or disable live migration data (de)compression accelerator.
The default value of multifd-compression-accel is auto, and the enabling and selection of the accelerator are automatically detected. By setting multifd-compression-accel=none, the acceleration function can be disabled. Similarly, users can explicitly specify a specific accelerator name, such as multifd-compression-accel=qpl.
Signed-off-by Yuan Liu <[email protected]>Reviewed-by Nanhai Zou <[email protected]>--- hw/core/qdev-properties-system.c | 11 +++++++++++ include/hw/qdev-properties-system.h | 4 ++++ migration/migration-hmp-cmds.c | 10 ++++++++++ migration/options.c | 24 ++++++++++++++++++++++++ migration/options.h | 1 + qapi/migration.json | 26 +++++++++++++++++++++++++- 6 files changed, 75 insertions(+), 1 deletion(-)hw/core/qdev-properties-system.c +11
-0@@ -673,6 +673,17 @@ const PropertyInfo qdev_prop_multifd_compression = { .set_default_value = qdev_propinfo_set_default_value_enum, }; +/* --- MultiFD Compression Accelerator --- */ + +const PropertyInfo qdev_prop_multifd_compression_accel = { + .name ="MultiFDCompressionAccel" , + .description ="MultiFD Compression Accelerator, " +"auto/none/qpl" , + .enum_table = &MultiFDCompressionAccel_lookup, + .get = qdev_propinfo_get_enum, + .set = qdev_propinfo_set_enum, + .set_default_value = qdev_propinfo_set_default_value_enum, +};/* --- Reserved Region --- */ /* include/hw/qdev-properties-system.h +4
-0@@ -7,6 +7,7 @@ extern const PropertyInfo qdev_prop_chr;extern const PropertyInfo qdev_prop_macaddr;extern const PropertyInfo qdev_prop_reserved_region;extern const PropertyInfo qdev_prop_multifd_compression; +extern const PropertyInfo qdev_prop_multifd_compression_accel;extern const PropertyInfo qdev_prop_losttickpolicy;extern const PropertyInfo qdev_prop_blockdev_on_error;extern const PropertyInfo qdev_prop_bios_chs_trans;@@ -41,6 +42,9 @@ extern const PropertyInfo qdev_prop_pcie_link_width;#define DEFINE_PROP_MULTIFD_COMPRESSION (_n, _s, _f, _d) \ DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_multifd_compression, \ MultiFDCompression) +#define DEFINE_PROP_MULTIFD_COMPRESSION_ACCEL (_n, _s, _f, _d) \ + DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_multifd_compression_accel, \ + MultiFDCompressionAccel)#define DEFINE_PROP_LOSTTICKPOLICY (_n, _s, _f, _d) \ DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_losttickpolicy, \ LostTickPolicy)migration/migration-hmp-cmds.c +10
-0@@ -344,6 +344,11 @@ void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict)monitor_printf (mon,"%s: %s\n" ,MigrationParameter_str (MIGRATION_PARAMETER_MULTIFD_COMPRESSION ),MultiFDCompression_str (params->multifd_compression)); +assert (params->has_multifd_compression_accel); +monitor_printf (mon,"%s: %s\n" , +MigrationParameter_str ( +MIGRATION_PARAMETER_MULTIFD_COMPRESSION_ACCEL ), +MultiFDCompressionAccel_str (params->multifd_compression_accel));monitor_printf (mon,"%s: %" PRIu64" bytes\n" ,MigrationParameter_str (MIGRATION_PARAMETER_XBZRLE_CACHE_SIZE ), params->xbzrle_cache_size);@@ -610,6 +615,11 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)visit_type_MultiFDCompression (v, param, &p->multifd_compression, &err);break ; +case MIGRATION_PARAMETER_MULTIFD_COMPRESSION_ACCEL : + p->has_multifd_compression_accel = true; +visit_type_MultiFDCompressionAccel (v, param, + &p->multifd_compression_accel, &err); +break ;case MIGRATION_PARAMETER_MULTIFD_ZLIB_LEVEL : p->has_multifd_zlib_level = true;visit_type_uint8 (v, param, &p->multifd_zlib_level, &err);migration/options.c +0
-0
migration/options.c line 63
Quoted 5 lines
migration/options.c +2
-0@@ -59,6 +59,8 @@#define DEFAULT_MIGRATE_X_CHECKPOINT_DELAY (200 * 100)#define DEFAULT_MIGRATE_MULTIFD_CHANNELS 2#define DEFAULT_MIGRATE_MULTIFD_COMPRESSION MULTIFD_COMPRESSION_NONE +/* By default use the accelerator for multifd compression */ +#define DEFAULT_MIGRATE_MULTIFD_COMPRESSION_ACCEL MULTIFD_COMPRESSION_ACCEL_AUTO
The comment is inaccurate. You could add "when available". I'd simply drop the comment.
migration/options.c Property migration_properties[] = { · line 145
Quoted 9 lines
migration/options.c +2
-0/* 0: means nocompress, 1: best speed, ... 9: best compress ratio */ #define DEFAULT_MIGRATE_MULTIFD_ZLIB_LEVEL 1/* 0: means nocompress, 1: best speed, ... 20: best compress ratio */ @@ -139,6 +141,9 @@ Property migration_properties[] = {DEFINE_PROP_MULTIFD_COMPRESSION ("multifd-compression" , MigrationState, parameters.multifd_compression,DEFAULT_MIGRATE_MULTIFD_COMPRESSION ), + DEFINE_PROP_MULTIFD_COMPRESSION_ACCEL("multifd-compression-accel", + MigrationState, parameters.multifd_compression_accel,
Break the line after MigrationState for local consistency, please.
Quoted 75 lines
migration/options.c +20
-0+ DEFAULT_MIGRATE_MULTIFD_COMPRESSION_ACCEL),DEFINE_PROP_UINT8 ("multifd-zlib-level" , MigrationState, parameters.multifd_zlib_level, DEFAULT_MIGRATE_MULTIFD_ZLIB_LEVEL),@@ -818,6 +823,15 @@ MultiFDCompression migrate_multifd_compression(void)return s->parameters.multifd_compression; } +MultiFDCompressionAccel migrate_multifd_compression_accel (void ) +{ +MigrationState *s =migrate_get_current (); + +assert (s->parameters.multifd_compression_accel < +MULTIFD_COMPRESSION_ACCEL__MAX ); +return s->parameters.multifd_compression_accel; +} +int migrate_multifd_zlib_level (void ) {MigrationState *s =migrate_get_current ();@@ -945,6 +959,8 @@ MigrationParameters *qmp_query_migrate_parameters(Error **errp) params->multifd_channels = s->parameters.multifd_channels; params->has_multifd_compression = true; params->multifd_compression = s->parameters.multifd_compression; + params->has_multifd_compression_accel = true; + params->multifd_compression_accel = s->parameters.multifd_compression_accel; params->has_multifd_zlib_level = true; params->multifd_zlib_level = s->parameters.multifd_zlib_level; params->has_multifd_zstd_level = true;@@ -999,6 +1015,7 @@ void migrate_params_init(MigrationParameters *params) params->has_block_incremental = true; params->has_multifd_channels = true; params->has_multifd_compression = true; + params->has_multifd_compression_accel = true; params->has_multifd_zlib_level = true; params->has_multifd_zstd_level = true; params->has_xbzrle_cache_size = true;@@ -1273,6 +1290,9 @@ static void migrate_params_test_apply(MigrateSetParameters *params,if (params->has_multifd_compression) { dest->multifd_compression = params->multifd_compression; } +if (params->has_multifd_compression_accel) { + dest->multifd_compression_accel = params->multifd_compression_accel; + }if (params->has_xbzrle_cache_size) { dest->xbzrle_cache_size = params->xbzrle_cache_size; }@@ -1394,6 +1414,10 @@ static void migrate_params_apply(MigrateSetParameters *params, Error **errp)if (params->has_multifd_compression) { s->parameters.multifd_compression = params->multifd_compression; } +if (params->has_multifd_compression_accel) { + s->parameters.multifd_compression_accel = + params->multifd_compression_accel; + }if (params->has_xbzrle_cache_size) { s->parameters.xbzrle_cache_size = params->xbzrle_cache_size;xbzrle_cache_resize (params->xbzrle_cache_size, errp);migration/options.h +1
-0@@ -85,6 +85,7 @@ uint64_t migrate_avail_switchover_bandwidth(void);uint64_t migrate_max_postcopy_bandwidth (void );int migrate_multifd_channels (void );MultiFDCompression migrate_multifd_compression (void ); +MultiFDCompressionAccel migrate_multifd_compression_accel (void );int migrate_multifd_zlib_level (void );int migrate_multifd_zstd_level (void );uint8_t migrate_throttle_trigger_threshold (void );qapi/migration.json +0
-0
qapi/migration.json line 623
Quoted 8 lines
qapi/migration.json +5
-0@@ -616,6 +616,22 @@ { 'name': 'zstd', 'if': 'CONFIG_ZSTD' } ] } ## +# @MultiFDCompressionAccel: +# +# An enumeration of multifd compression accelerator. +# +# @auto: automatically determined if accelerator is available.
Well, it's always automatically determined. Suggest:
# @auto: if accelerators are available, enable one of them.
Quoted 15 lines
qapi/migration.json +11
-0+# +# @none: disable compression accelerator. +# +# @qpl: enable qpl compression accelerator. +# +# Since: 8.2 +## +{ 'enum': 'MultiFDCompressionAccel', + 'data': [ 'auto', 'none', + { 'name': 'qpl', 'if': 'CONFIG_QPL' } ] } +## # @BitmapMigrationBitmapAliasTransform: # # @persistent: If present, the bitmap will be made persistent or
qapi/migration.json line 818
Quoted 5 lines
qapi/migration.json +2
-0@@ -798,6 +814,9 @@ # @multifd-compression: Which compression method to use. Defaults to # none. (Since 5.0) # +# @multifd-compression-accel: Which compression accelerator to use. Defaults to +# auto. (Since 8.2)
Long line. Better:
# @multifd-compression-accel: Which compression accelerator to use.
# Defaults to auto. (Since 8.2)
qapi/migration.json line 875
Quoted 10 lines
qapi/migration.json +2
-1+# # @multifd-zlib-level: Set the compression level to be used in live # migration, the compression level is an integer between 0 and 9, # where 0 means no compression, 1 means the best compression@@ -853,7 +872,7 @@ 'block-incremental', 'multifd-channels', 'xbzrle-cache-size', 'max-postcopy-bandwidth', - 'max-cpu-throttle', 'multifd-compression', + 'max-cpu-throttle', 'multifd-compression', 'multifd-compression-accel',
Long line. Either
'max-cpu-throttle', 'multifd-compression', 'multifd-compression-accel',
or, if you want to keep compression together
'max-cpu-throttle',
'multifd-compression', 'multifd-compression-accel',or
'max-cpu-throttle',
'multifd-compression',
'multifd-compression-accel',You choose.
qapi/migration.json
Quoted 22 lines
qapi/migration.json +4
-0'multifd-zlib-level', 'multifd-zstd-level', 'block-bitmap-mapping', { 'name': 'x-vcpu-dirty-limit-period', 'features': ['unstable'] },@@ -974,6 +993,9 @@ # @multifd-compression: Which compression method to use. Defaults to # none. (Since 5.0) # +# @multifd-compression-accel: Which compression acclerator to use. Defaults to +# auto. (Since 8.2) +# # @multifd-zlib-level: Set the compression level to be used in live # migration, the compression level is an integer between 0 and 9, # where 0 means no compression, 1 means the best compression@@ -1046,6 +1068,7 @@ '*max-postcopy-bandwidth': 'size', '*max-cpu-throttle': 'uint8', '*multifd-compression': 'MultiFDCompression', + '*multifd-compression-accel': 'MultiFDCompressionAccel', '*multifd-zlib-level': 'uint8', '*multifd-zstd-level': 'uint8', '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ],@@ -1257,6 +1280,7 @@
Missing documentation update. Copy it from MigrateSetParameters, please.
Quoted 9 lines
qapi/migration.json +1
-1'*max-postcopy-bandwidth': 'size', '*max-cpu-throttle': 'uint8', '*multifd-compression': 'MultiFDCompression', + '*multifd-compression-accel': 'MultiFDCompressionAccel', '*multifd-zlib-level': 'uint8', '*multifd-zstd-level': 'uint8', '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ], --2.39.3
RE: [PATCH v2 1/4] migration: Introduce multifd-compression-accel parameter
Quoted 302 lines
-----Original Message-----
From: Markus Armbruster <[email protected]>
Sent: Friday, December 1, 2023 5:17 PM
To: Liu, Yuan1 <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Zou, Nanhai <[email protected]>
Subject: Re: [PATCH v2 1/4] migration: Introduce multifd-compression-accel parameterQuoted 6 lines · Yuan Liu
Introduce the multifd-compression-accel option to enable or disable live migration data (de)compression accelerator.
The default value of multifd-compression-accel is auto, and the enabling and selection of the accelerator are automatically detected. By setting multifd-compression-accel=none, the acceleration function can
be disabled.
hw/core/qdev-properties-system.c const PropertyInfo qdev_prop_multifd_compression =
Quoted 20 lines
Similarly, users can explicitly specify a specific accelerator name, such as multifd-compression-accel=qpl.
Signed-off-by Yuan Liu <[email protected]>Reviewed-by Nanhai Zou <[email protected]>--- hw/core/qdev-properties-system.c | 11 +++++++++++ include/hw/qdev-properties-system.h | 4 ++++ migration/migration-hmp-cmds.c | 10 ++++++++++ migration/options.c | 24 ++++++++++++++++++++++++ migration/options.h | 1 + qapi/migration.json | 26 +++++++++++++++++++++++++- 6 files changed, 75 insertions(+), 1 deletion(-)hw/core/qdev-properties-system.c +0
-0@@ -673,6 +673,17 @@ const PropertyInfo qdev_prop_multifd_compression ={
Quoted 34 lines
hw/core/qdev-properties-system.c +11
-0.set_default_value = qdev_propinfo_set_default_value_enum, }; +/* --- MultiFD Compression Accelerator --- */ + +const PropertyInfo qdev_prop_multifd_compression_accel = { + .name ="MultiFDCompressionAccel" , + .description ="MultiFD Compression Accelerator, " +"auto/none/qpl" , + .enum_table = &MultiFDCompressionAccel_lookup, + .get = qdev_propinfo_get_enum, + .set = qdev_propinfo_set_enum, + .set_default_value = qdev_propinfo_set_default_value_enum, +};/* --- Reserved Region --- */ /* include/hw/qdev-properties-system.h +0
-0@@ -7,6 +7,7 @@ extern const PropertyInfo qdev_prop_chr; extern constPropertyInfo
qdev_prop_macaddr; extern const PropertyInfoqdev_prop_reserved_region; extern const PropertyInfoqdev_prop_multifd_compression;
+extern const PropertyInfoqdev_prop_multifd_compression_accel;
extern const PropertyInfoqdev_prop_losttickpolicy; extern const
PropertyInfoqdev_prop_blockdev_on_error; extern const PropertyInfoqdev_prop_bios_chs_trans; @@ -41,6 +42,9 @@ extern const PropertyInfoqdev_prop_pcie_link_width; #defineDEFINE_PROP_MULTIFD_COMPRESSION(_n, _s, _f, _d) \ DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_multifd_compression, \ MultiFDCompression)include/hw/qdev-properties-system.h
Quoted 2 lines
include/hw/qdev-properties-system.h +2
-0+#define DEFINE_PROP_MULTIFD_COMPRESSION_ACCEL (_n, _s, _f, _d) \ + DEFINE_PROP_SIGNED(_n, _s, _f, _d,
qdev_prop_multifd_compression_accel, \migration/migration-hmp-cmds.c void hmp_info_migrate_parameters(Monitor *mon,
Quoted 9 lines
+ MultiFDCompressionAccel)
#define DEFINE_PROP_LOSTTICKPOLICY(_n, _s, _f, _d) \ DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_losttickpolicy, \ LostTickPolicy) diff --git
a/migration/migration-hmp-cmds.cb/migration/migration-hmp-cmds.cindexa82597f18e..3a278c89d9100644migration/migration-hmp-cmds.c +0
-0@@ -344,6 +344,11 @@ void hmp_info_migrate_parameters(Monitor *mon,const QDict *qdict)
migration/migration-hmp-cmds.c void hmp_info_migrate_parameters(Monitor *mon, · line 345
Quoted 2 lines
migration/migration-hmp-cmds.c +0
-0monitor_printf(mon, "%s: %s\n",
MigrationParameter_str(MIGRATION_PARAMETER_MULTIFD_COMPRESSION),migration/migration-hmp-cmds.c void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict)
Quoted 9 lines
migration/migration-hmp-cmds.c +6
-0MultiFDCompression_str(params->multifd_compression)); +assert (params->has_multifd_compression_accel); +monitor_printf (mon,"%s: %s\n" , +MigrationParameter_str ( +MIGRATION_PARAMETER_MULTIFD_COMPRESSION_ACCEL ), + +MultiFDCompressionAccel_str (params->multifd_compression_accel)); monitor_printf(mon, "%s: %" PRIu64 " bytes\n",
MigrationParameter_str(MIGRATION_PARAMETER_XBZRLE_CACHE_SIZE),Quoted 23 lines
params->xbzrle_cache_size); @@ -610,6 +615,11 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict) visit_type_MultiFDCompression(v, param, &p- multifd_compression, &err); break;migration/migration-hmp-cmds.c +4
-0+case MIGRATION_PARAMETER_MULTIFD_COMPRESSION_ACCEL : + p->has_multifd_compression_accel = true; + visit_type_MultiFDCompressionAccel(v, param, + &p-
multifd_compression_accel, &err);migration/migration-hmp-cmds.c +1
-0+break ;case MIGRATION_PARAMETER_MULTIFD_ZLIB_LEVEL : p->has_multifd_zlib_level = true;visit_type_uint8 (v, param, &p->multifd_zlib_level, &err);migration/options.c index renamed from migration/options.c +0
-0
42fb818956..4c567c49e6100644migration/options.c +0
-0@@ -59,6 +59,8 @@#define DEFAULT_MIGRATE_X_CHECKPOINT_DELAY (200 * 100) #define
DEFAULT_MIGRATE_MULTIFD_CHANNELS2 #defineDEFAULT_MIGRATE_MULTIFD_COMPRESSIONMULTIFD_COMPRESSION_NONEmigration/options.c
Quoted 3 lines
migration/options.c +3
-0+/* By default use the accelerator for multifd compression */ #define +DEFAULT_MIGRATE_MULTIFD_COMPRESSION_ACCEL +MULTIFD_COMPRESSION_ACCEL_AUTO The comment is inaccurate. You could add "when available". I'd simply drop the comment.
migration/options.c Property migration_properties[] = { · line 141
Quoted 5 lines
/* 0: means nocompress, 1: best speed, ... 9: best compress ratio */
#defineDEFAULT_MIGRATE_MULTIFD_ZLIB_LEVEL1
/* 0: means nocompress, 1: best speed, ... 20: best compress ratio */migration/options.c +0
-0@@ -139,6 +141,9 @@ Property migration_properties[] = { DEFINE_PROP_MULTIFD_COMPRESSION("multifd-compression",MigrationState,
migration/options.c Property migration_properties[] = {
Quoted 5 lines
migration/options.c +3
-0parameters.multifd_compression, DEFAULT_MIGRATE_MULTIFD_COMPRESSION), + DEFINE_PROP_MULTIFD_COMPRESSION_ACCEL("multifd-compression-accel", + MigrationState, + parameters.multifd_compression_accel,Break the line after MigrationState for local consistency, please.
migration/options.c MultiFDCompression
Quoted 5 lines
migration/options.c +1
-0+ DEFAULT_MIGRATE_MULTIFD_COMPRESSION_ACCEL),DEFINE_PROP_UINT8 ("multifd-zlib-level" , MigrationState, parameters.multifd_zlib_level, DEFAULT_MIGRATE_MULTIFD_ZLIB_LEVEL),@@ -818,6 +823,15 @@ MultiFDCompression
migrate_multifd_compression(void)migration/options.c static void
Quoted 45 lines
migration/options.c +9
-0return s->parameters.multifd_compression; } +MultiFDCompressionAccel migrate_multifd_compression_accel (void ) +{ +MigrationState *s =migrate_get_current (); + +assert (s->parameters.multifd_compression_accel < +MULTIFD_COMPRESSION_ACCEL__MAX ); +return s->parameters.multifd_compression_accel; +} +int migrate_multifd_zlib_level (void ) { MigrationState *s = migrate_get_current(); @@ -945,6 +959,8 @@MigrationParameters *qmp_query_migrate_parameters(Error **errp)
params->multifd_channels = s->parameters.multifd_channels; params->has_multifd_compression = true; params->multifd_compression = s->parameters.multifd_compression;migration/options.c +3
-0+ params->has_multifd_compression_accel = true; + params->multifd_compression_accel = + s->parameters.multifd_compression_accel; params->has_multifd_zlib_level = true; params->multifd_zlib_level = s->parameters.multifd_zlib_level; params->has_multifd_zstd_level = true; @@ -999,6 +1015,7 @@ void
migrate_params_init(MigrationParameters *params)params->has_block_incremental = true; params->has_multifd_channels = true; params->has_multifd_compression = true; + params->has_multifd_compression_accel = true; params->has_multifd_zlib_level = true; params->has_multifd_zstd_level = true; params->has_xbzrle_cache_size = true; @@ -1273,6 +1290,9 @@ static void migrate_params_test_apply(MigrateSetParameters *params, if (params->has_multifd_compression) { dest->multifd_compression = params->multifd_compression; }migration/options.c +2
-0+if (params->has_multifd_compression_accel) { + dest->multifd_compression_accel = params-
multifd_compression_accel;migration/options.c +1
-0+ }if (params->has_xbzrle_cache_size) { dest->xbzrle_cache_size = params->xbzrle_cache_size; }@@ -1394,6 +1414,10 @@ static void
migrate_params_apply(MigrateSetParameters *params, Error **errp)Quoted 28 lines
migration/options.c +4
-0if (params->has_multifd_compression) { s->parameters.multifd_compression = params- multifd_compression; } +if (params->has_multifd_compression_accel) { + s->parameters.multifd_compression_accel = + params->multifd_compression_accel; + }if (params->has_xbzrle_cache_size) { s->parameters.xbzrle_cache_size = params->xbzrle_cache_size;xbzrle_cache_resize(params->xbzrle_cache_size, errp); diff--git
a/migration/options.hb/migration/options.hindex237f2d6b4a..e59bf4b5c1100644migration/options.h +1
-0@@ -85,6 +85,7 @@ uint64_t migrate_avail_switchover_bandwidth(void);uint64_t migrate_max_postcopy_bandwidth (void );int migrate_multifd_channels (void );MultiFDCompression migrate_multifd_compression (void ); +MultiFDCompressionAccel migrate_multifd_compression_accel (void );int migrate_multifd_zlib_level (void );int
migrate_multifd_zstd_level(void);uint8_tmigrate_throttle_trigger_threshold(void);qapi/migration.json index renamed from qapi/migration.json +0
-0
db3df12d6c..47239328e4100644qapi/migration.json line 623
Quoted 8 lines
qapi/migration.json +5
-0@@ -616,6 +616,22 @@ { 'name': 'zstd', 'if': 'CONFIG_ZSTD' } ] } ## +# @MultiFDCompressionAccel: +# +# An enumeration of multifd compression accelerator. +# +# @auto: automatically determined if accelerator is available.Well, it's always automatically determined. Suggest:
# @auto: if accelerators are available, enable one of them.
Quoted 14 lines
qapi/migration.json +10
-1+# +# @none: disable compression accelerator. +# +# @qpl: enable qpl compression accelerator. +# +# Since: 8.2 +## +{ 'enum': 'MultiFDCompressionAccel', + 'data': [ 'auto', 'none', + { 'name': 'qpl', 'if': 'CONFIG_QPL' } ] } ## # @BitmapMigrationBitmapAliasTransform: # # @persistent: If present, the bitmap will be made persistent or @@ -798,6 +814,9 @@ # @multifd-compression: Which compression method toQuoted 4 lines
use. Defaults to
# none. (Since 5.0)
#
+# @multifd-compression-accel: Which compression accelerator to use.Defaults to
Quoted 1 line
+# auto. (Since 8.2)
Long line. Better:
# @multifd-compression-accel: Which compression accelerator to use.
# Defaults to auto. (Since 8.2)qapi/migration.json line 876
Quoted 11 lines
qapi/migration.json +3
-1+# # @multifd-zlib-level: Set the compression level to be used in live # migration, the compression level is an integer between 0 and 9, # where 0 means no compression, 1 means the best compression@@ -853,7 +872,7 @@ 'block-incremental', 'multifd-channels', 'xbzrle-cache-size', 'max-postcopy-bandwidth', - 'max-cpu-throttle', 'multifd-compression', + 'max-cpu-throttle', 'multifd-compression', + 'multifd-compression-accel',Long line. Either
'max-cpu-throttle', 'multifd-compression', 'multifd-compression-accel',
or, if you want to keep compression together
'max-cpu-throttle', 'multifd-compression', 'multifd-compression-accel',or
'max-cpu-throttle', 'multifd-compression', 'multifd-compression-accel',You choose.
Quoted 8 lines
qapi/migration.json +0
-0'multifd-zlib-level', 'multifd-zstd-level', 'block-bitmap-mapping', { 'name': 'x-vcpu-dirty-limit-period', 'features':['unstable'] }, @@ -974,6 +993,9 @@ # @multifd-compression: Which compression method to use. Defaults to
# none. (Since 5.0)
#
+# @multifd-compression-accel: Which compression acclerator to use.Defaults to
Quoted 16 lines
qapi/migration.json
Quoted 14 lines
qapi/migration.json +3
-0+# auto. (Since 8.2) +# # @multifd-zlib-level: Set the compression level to be used in live # migration, the compression level is an integer between 0 and 9, # where 0 means no compression, 1 means the best compression@@ -1046,6 +1068,7 @@ '*max-postcopy-bandwidth': 'size', '*max-cpu-throttle': 'uint8', '*multifd-compression': 'MultiFDCompression', + '*multifd-compression-accel': 'MultiFDCompressionAccel', '*multifd-zlib-level': 'uint8', '*multifd-zstd-level': 'uint8', '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ],@@ -1257,6 +1280,7 @@Missing documentation update. Copy it from MigrateSetParameters, please.
Sure, I will update a document and all the above suggestions in the next version
PATCH v2 2/4 multifd: Implement multifd compression accelerator
In reply to Yuan Liuwhen starting multifd live migration, if the compression method is enabled, compression method can be accelerated using accelerators.
--- migration/multifd.c | 38 ++++++++++++++++++++++++++++++++++++-- migration/multifd.h | 8 ++++++++ 2 files changed, 44 insertions(+), 2 deletions(-)
migration/multifd.c +36 -2
@@ -165,6 +165,34 @@ static MultiFDMethods multifd_nocomp_ops = {static MultiFDMethods *multifd_ops[MULTIFD_COMPRESSION__MAX ] = { [MULTIFD_COMPRESSION_NONE ] = &multifd_nocomp_ops, }; +static MultiFDAccelMethods *accel_multifd_ops[MULTIFD_COMPRESSION_ACCEL__MAX ]; + +static MultiFDMethods *get_multifd_ops (void ) +{ +MultiFDCompression comp =migrate_multifd_compression (); +MultiFDCompressionAccel accel =migrate_multifd_compression_accel (); + +if (comp ==MULTIFD_COMPRESSION_NONE || + accel ==MULTIFD_COMPRESSION_ACCEL_NONE ) { +return multifd_ops[comp]; + } +if (accel ==MULTIFD_COMPRESSION_ACCEL_AUTO ) { +for (int i =0 ; i <MULTIFD_COMPRESSION_ACCEL__MAX ; i++) { +if (accel_multifd_ops[i] && + accel_multifd_ops[i]->is_supported (comp)) { +return accel_multifd_ops[i]->get_multifd_methods (); + } + } +return multifd_ops[comp]; + } + +/* Check if a specified accelerator is available */ +if (accel_multifd_ops[accel] && + accel_multifd_ops[accel]->is_supported (comp)) { +return accel_multifd_ops[accel]->get_multifd_methods (); + } +return multifd_ops[comp]; +}void multifd_register_ops (int method,MultiFDMethods *ops) {
@@ -172,6 +200,12 @@ void multifd_register_ops(int method, MultiFDMethods *ops) multifd_ops[method] = ops; } +void multifd_register_accel_ops (int accel,MultiFDAccelMethods *ops) +{ +assert (0 < accel && accel <MULTIFD_COMPRESSION_ACCEL__MAX ); + accel_multifd_ops[accel] = ops; +} +static int multifd_send_initial_packet (MultiFDSendParams *p,Error **errp) {MultiFDInit_t msg = {};
@@ -922,7 +956,7 @@ int multifd_save_setup(Error **errp) multifd_send_state->pages =multifd_pages_init (page_count);qemu_sem_init (&multifd_send_state->channels_ready,0 );qatomic_set (&multifd_send_state->exiting,0 ); - multifd_send_state->ops = multifd_ops[migrate_multifd_compression ()]; + multifd_send_state->ops =get_multifd_ops ();for (i =0 ; i < thread_count; i++) {MultiFDSendParams *p = &multifd_send_state->params[i];
@@ -1180,7 +1214,7 @@ int multifd_load_setup(Error **errp) multifd_recv_state->params =g_new0 (MultiFDRecvParams, thread_count);qatomic_set (&multifd_recv_state->count,0 );qemu_sem_init (&multifd_recv_state->sem_sync,0 ); - multifd_recv_state->ops = multifd_ops[migrate_multifd_compression ()]; + multifd_recv_state->ops =get_multifd_ops ();for (i =0 ; i < thread_count; i++) {MultiFDRecvParams *p = &multifd_recv_state->params[i];
migration/multifd.h +8 -0
@@ -206,7 +206,15 @@ typedef struct { int (*recv_pages)(MultiFDRecvParams *p, Error **errp); } MultiFDMethods; +typedef struct { +/* Check if the compression method supports acceleration */ +bool (*is_supported) (MultiFDCompression compression); +/* Get multifd methods of the accelerator */ +MultiFDMethods * (*get_multifd_methods)(void ); +}MultiFDAccelMethods ; +void multifd_register_ops (int method,MultiFDMethods *ops); +void multifd_register_accel_ops (int accel,MultiFDAccelMethods *ops);#endif
--
2.39.3
Re: [PATCH v2 2/4] multifd: Implement multifd compression accelerator
Quoted 5 lines · Yuan Liu
when starting multifd live migration, if the compression method is enabled, compression method can be accelerated using accelerators.
Signed-off-by Yuan Liu <[email protected]>Reviewed-by Nanhai Zou <[email protected]>
Re: [PATCH v2 2/4] multifd: Implement multifd compression accelerator
In reply to Yuan LiuQuoted 31 lines · Yuan Liu
when starting multifd live migration, if the compression method is enabled, compression method can be accelerated using accelerators.
Signed-off-by Yuan Liu <[email protected]>Reviewed-by Nanhai Zou <[email protected]>--- migration/multifd.c | 38 ++++++++++++++++++++++++++++++++++++-- migration/multifd.h | 8 ++++++++ 2 files changed, 44 insertions(+), 2 deletions(-)migration/multifd.c +13
-0@@ -165,6 +165,34 @@ static MultiFDMethods multifd_nocomp_ops = {static MultiFDMethods *multifd_ops[MULTIFD_COMPRESSION__MAX ] = { [MULTIFD_COMPRESSION_NONE ] = &multifd_nocomp_ops, }; +static MultiFDAccelMethods *accel_multifd_ops[MULTIFD_COMPRESSION_ACCEL__MAX ]; + +static MultiFDMethods *get_multifd_ops (void ) +{ +MultiFDCompression comp =migrate_multifd_compression (); +MultiFDCompressionAccel accel =migrate_multifd_compression_accel (); + +if (comp ==MULTIFD_COMPRESSION_NONE || + accel ==MULTIFD_COMPRESSION_ACCEL_NONE ) { +return multifd_ops[comp]; + } +if (accel ==MULTIFD_COMPRESSION_ACCEL_AUTO ) { +for (int i =0 ; i <MULTIFD_COMPRESSION_ACCEL__MAX ; i++) {
migration/multifd.c static MultiFDMethods multifd_nocomp_ops = { · line 190
Quoted 10 lines
migration/multifd.c +10
-0+if (accel_multifd_ops[i] && + accel_multifd_ops[i]->is_supported (comp)) { +return accel_multifd_ops[i]->get_multifd_methods (); + } + } +return multifd_ops[comp]; + } + +/* Check if a specified accelerator is available */ + if (accel_multifd_ops[accel] &&
The CI is complaining that we might reach here with accel=2 when !CONFIG_QPL. It seems the assert at migrate_multifd_compression_accel is not enough.
RE: [PATCH v2 2/4] multifd: Implement multifd compression accelerator
Quoted 49 lines
-----Original Message-----
From: Fabiano Rosas <[email protected]>
Sent: Saturday, December 2, 2023 2:01 AM
To: Liu, Yuan1 <[email protected]>; [email protected]; [email protected]; [email protected]
Cc: [email protected]; Liu, Yuan1 <[email protected]>; Zou, Nanhai <[email protected]>
Subject: Re: [PATCH v2 2/4] multifd: Implement multifd compression acceleratorQuoted 37 lines · Yuan Liu
when starting multifd live migration, if the compression method is enabled, compression method can be accelerated using accelerators.
Signed-off-by Yuan Liu <[email protected]>Reviewed-by Nanhai Zou <[email protected]>--- migration/multifd.c | 38 ++++++++++++++++++++++++++++++++++++-- migration/multifd.h | 8 ++++++++ 2 files changed, 44 insertions(+), 2 deletions(-)migration/multifd.c index renamed from migration/multifd.c +0
-0
1fe53d3b98..7149e67867100644migration/multifd.c +20
-0@@ -165,6 +165,34 @@ static MultiFDMethods multifd_nocomp_ops = {static MultiFDMethods *multifd_ops[MULTIFD_COMPRESSION__MAX ] = { [MULTIFD_COMPRESSION_NONE ] = &multifd_nocomp_ops, }; +static MultiFDAccelMethods +*accel_multifd_ops[MULTIFD_COMPRESSION_ACCEL__MAX ]; + +static MultiFDMethods *get_multifd_ops (void ) { +MultiFDCompression comp =migrate_multifd_compression (); +MultiFDCompressionAccel accel = +migrate_multifd_compression_accel (); + +if (comp ==MULTIFD_COMPRESSION_NONE || + accel ==MULTIFD_COMPRESSION_ACCEL_NONE ) { +return multifd_ops[comp]; + } +if (accel ==MULTIFD_COMPRESSION_ACCEL_AUTO ) { +for (int i =0 ; i <MULTIFD_COMPRESSION_ACCEL__MAX ; i++) { +if (accel_multifd_ops[i] && + accel_multifd_ops[i]->is_supported (comp)) { +return accel_multifd_ops[i]->get_multifd_methods (); + } + } +return multifd_ops[comp];
Quoted 8 lines
migration/multifd.c static MultiFDMethods multifd_nocomp_ops = { · line 190
Quoted 4 lines
migration/multifd.c +4
-0+ } + +/* Check if a specified accelerator is available */ + if (accel_multifd_ops[accel] &&The CI is complaining that we might reach here with accel=2 when !CONFIG_QPL. It seems the assert at
migrate_multifd_compression_accelis not enough.
I will add assert to check both comp and accel next version in the get_multifd_ops function.
PATCH v2 3/4 configure: add qpl option
In reply to Yuan Liuthe Query Processing Library (QPL) is an open-source library that supports data compression and decompression features.
add --enable-qpl and --disable-qpl options to enable and disable the QPL compression accelerator. The QPL compression accelerator can accelerate the Zlib compression algorithm during the live migration.
--- meson.build | 7 +++++++ meson_options.txt | 2 ++ scripts/meson-buildoptions.sh | 3 +++ 3 files changed, 12 insertions(+)
meson.build +7 -0
@@ -1032,6 +1032,11 @@ if not get_option('zstd').auto() or have_block required: get_option('zstd'), method: 'pkg-config') endif +qpl = not_found +if not get_option('qpl').auto() + qpl = dependency('libqpl', required: get_option('qpl'), + method: 'pkg-config') +endif virgl = not_found have_vhost_user_gpu = have_tools and targetos == 'linux' and pixman.found()
@@ -2165,6 +2170,7 @@ config_host_data.set('CONFIG_MALLOC_TRIM', has_malloc_trim) config_host_data.set('CONFIG_STATX', has_statx) config_host_data.set('CONFIG_STATX_MNT_ID', has_statx_mnt_id) config_host_data.set('CONFIG_ZSTD', zstd.found()) +config_host_data.set('CONFIG_QPL', qpl.found()) config_host_data.set('CONFIG_FUSE', fuse.found()) config_host_data.set('CONFIG_FUSE_LSEEK', fuse_lseek.found()) config_host_data.set('CONFIG_SPICE_PROTOCOL', spice_protocol.found())
@@ -4325,6 +4331,7 @@ summary_info += {'snappy support': snappy} summary_info += {'bzip2 support': libbzip2} summary_info += {'lzfse support': liblzfse} summary_info += {'zstd support': zstd} +summary_info += {'Query Processing Library support': qpl} summary_info += {'NUMA host support': numa} summary_info += {'capstone': capstone} summary_info += {'libpmem support': libpmem}
meson_options.txt +2 -0
@@ -255,6 +255,8 @@ option('xkbcommon', type : 'feature', value : 'auto', description: 'xkbcommon support') option('zstd', type : 'feature', value : 'auto', description: 'zstd compression support') +option('qpl', type : 'feature', value : 'auto', + description: 'Query Processing Library support') option('fuse', type: 'feature', value: 'auto', description: 'FUSE block device export') option('fuse_lseek', type : 'feature', value : 'auto',
scripts/meson-buildoptions.sh +3 -0
@@ -220,6 +220,7 @@ meson_options_help() { printf "%s\n" ' Xen PCI passthrough support' printf "%s\n" ' xkbcommon xkbcommon support' printf "%s\n" ' zstd zstd compression support' + printf "%s\n" ' qpl Query Processing Library support' } _meson_option_parse() { case $1 in
@@ -556,6 +557,8 @@ _meson_option_parse() { --disable-xkbcommon) printf "%s" -Dxkbcommon=disabled ;; --enable-zstd) printf "%s" -Dzstd=enabled ;; --disable-zstd) printf "%s" -Dzstd=disabled ;; + --enable-qpl) printf "%s" -Dqpl=enabled ;; + --disable-qpl) printf "%s" -Dqpl=disabled ;; *) return 1 ;; esac }
--
2.39.3
Re: [PATCH v2 3/4] configure: add qpl option
Quoted 20 lines · Yuan Liu
the Query Processing Library (QPL) is an open-source library that supports data compression and decompression features.
add --enable-qpl and --disable-qpl options to enable and disable the QPL compression accelerator. The QPL compression accelerator can accelerate the Zlib compression algorithm during the live migration.
Signed-off-by Yuan Liu <[email protected]>Reviewed-by Nanhai Zou <[email protected]>--- meson.build | 7 +++++++ meson_options.txt | 2 ++ scripts/meson-buildoptions.sh | 3 +++ 3 files changed, 12 insertions(+)meson.build +0
-0
meson.build if not get_option('zstd').auto() or have_block · line 1039
Quoted 8 lines
meson.build +5
-0@@ -1032,6 +1032,11 @@ if not get_option('zstd').auto() or have_block required: get_option('zstd'), method: 'pkg-config') endif +qpl = not_found +if not get_option('qpl').auto() + qpl = dependency('libqpl', required: get_option('qpl'), + method: 'pkg-config') +endif
Hm.. I'm not having success with pkg-config:
../meson.build:1043:10: ERROR: Dependency "libqpl" not found, tried pkgconfig
It seems it doesn't find the static library. I had to use this instead:
qpl = declare_dependency(dependencies: cc.find_library('qpl',
required: get_option('qpl')))What am I missing here?
Quoted 55 lines
meson.build +2
-0virgl = not_found have_vhost_user_gpu = have_tools and targetos == 'linux' and pixman.found()@@ -2165,6 +2170,7 @@ config_host_data.set('CONFIG_MALLOC_TRIM', has_malloc_trim) config_host_data.set('CONFIG_STATX', has_statx) config_host_data.set('CONFIG_STATX_MNT_ID', has_statx_mnt_id) config_host_data.set('CONFIG_ZSTD', zstd.found()) +config_host_data.set('CONFIG_QPL', qpl.found()) config_host_data.set('CONFIG_FUSE', fuse.found()) config_host_data.set('CONFIG_FUSE_LSEEK', fuse_lseek.found()) config_host_data.set('CONFIG_SPICE_PROTOCOL', spice_protocol.found())@@ -4325,6 +4331,7 @@ summary_info += {'snappy support': snappy} summary_info += {'bzip2 support': libbzip2} summary_info += {'lzfse support': liblzfse} summary_info += {'zstd support': zstd} +summary_info += {'Query Processing Library support': qpl} summary_info += {'NUMA host support': numa} summary_info += {'capstone': capstone} summary_info += {'libpmem support': libpmem}meson_options.txt +2
-0@@ -255,6 +255,8 @@ option('xkbcommon', type : 'feature', value : 'auto', description: 'xkbcommon support') option('zstd', type : 'feature', value : 'auto', description: 'zstd compression support') +option('qpl', type : 'feature', value : 'auto', + description: 'Query Processing Library support') option('fuse', type: 'feature', value: 'auto', description: 'FUSE block device export') option('fuse_lseek', type : 'feature', value : 'auto',scripts/meson-buildoptions.sh +3
-1@@ -220,6 +220,7 @@ meson_options_help() { printf "%s\n" ' Xen PCI passthrough support' printf "%s\n" ' xkbcommon xkbcommon support' printf "%s\n" ' zstd zstd compression support' + printf "%s\n" ' qpl Query Processing Library support' } _meson_option_parse() { case $1 in@@ -556,6 +557,8 @@ _meson_option_parse() { --disable-xkbcommon) printf "%s" -Dxkbcommon=disabled ;; --enable-zstd) printf "%s" -Dzstd=enabled ;; --disable-zstd) printf "%s" -Dzstd=disabled ;; + --enable-qpl) printf "%s" -Dqpl=enabled ;; + --disable-qpl) printf "%s" -Dqpl=disabled ;; *) return 1 ;; esac } --2.39.3
RE: [PATCH v2 3/4] configure: add qpl option
Quoted 43 lines
-----Original Message-----
From: Fabiano Rosas <[email protected]>
Sent: Saturday, December 2, 2023 1:45 AM
To: Liu, Yuan1 <[email protected]>; [email protected]; [email protected]; [email protected]
Cc: [email protected]; Liu, Yuan1 <[email protected]>; Zou, Nanhai <[email protected]>
Subject: Re: [PATCH v2 3/4] configure: add qpl optionQuoted 20 lines · Yuan Liu
the Query Processing Library (QPL) is an open-source library that supports data compression and decompression features.
add --enable-qpl and --disable-qpl options to enable and disable the QPL compression accelerator. The QPL compression accelerator can accelerate the Zlib compression algorithm during the live migration.
Signed-off-by Yuan Liu <[email protected]>Reviewed-by Nanhai Zou <[email protected]>--- meson.build | 7 +++++++ meson_options.txt | 2 ++ scripts/meson-buildoptions.sh | 3 +++ 3 files changed, 12 insertions(+)meson.build index 259dc5f308..b4ba30b4fa renamed from meson.build +0
-0100644
meson.build if not get_option('zstd').auto() or have_block · line 1037
Quoted 6 lines
meson.build +4
-0@@ -1032,6 +1032,11 @@ if not get_option('zstd').auto() or have_block required: get_option('zstd'), method: 'pkg-config') endif +qpl = not_found +if not get_option('qpl').auto() + qpl = dependency('libqpl', required: get_option('qpl'), + method: 'pkg-config') endifHm.. I'm not having success with pkg-config:
../meson.build:1043:10: ERROR: Dependency "libqpl" not found, tried pkgconfig
Quoted 6 lines
It seems it doesn't find the static library. I had to use this instead:
qpl = declare_dependency(dependencies: cc.find_library('qpl',
required: get_option('qpl')))What am I missing here?
Sorry about this, the QPL repo(https://github.com/intel/qpl) does not yet support libqpl pkg-config file, we are in the process of adding this functionality and we hope to resolve libqpl's dependencies through pkg-config file. I will explicitly address this issue and provide relevant documentation in the next version.
For the pkg-config test,
1. create /usr/lib64/pkgconfig/libqpl.pc
2. add below lines
prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: libqpl
Description: Intel Query Processing Library
Version: 1.3.0
Libs: -L${libdir} -lqpl -lpthread -laccel-config -ldl -lstdc++
Cflags: -I${includedir}
3. Install the header files to /usr/local/include/qpl and static library to /usr/local/lib64/libqpl.a
Quoted 57 lines
meson_options.txt option('xkbcommon', type : 'feature', value :
Quoted 25 lines
meson.build +0
-0virgl = not_found have_vhost_user_gpu = have_tools and targetos == 'linux' and
pixman.found()@@ -2165,6 +2170,7 @@config_host_data.set('CONFIG_MALLOC_TRIM', has_malloc_trim)config_host_data.set('CONFIG_STATX', has_statx)config_host_data.set('CONFIG_STATX_MNT_ID', has_statx_mnt_id)config_host_data.set('CONFIG_ZSTD', zstd.found())+config_host_data.set('CONFIG_QPL',qpl.found())
config_host_data.set('CONFIG_FUSE', fuse.found())config_host_data.set('CONFIG_FUSE_LSEEK', fuse_lseek.found())config_host_data.set('CONFIG_SPICE_PROTOCOL', spice_protocol.found())meson.build +1
-0@@ -4325,6 +4331,7 @@ summary_info += {'snappy support': snappy} summary_info += {'bzip2 support': libbzip2} summary_info += {'lzfse support': liblzfse} summary_info += {'zstd support': zstd} +summary_info += {'Query Processing Library support': qpl} summary_info += {'NUMA host support': numa} summary_info += {'capstone': capstone} summary_info += {'libpmem support': libpmem}meson_options.txt index renamed from meson_options.txt +0
-0
3c7398f3c6..71cd533985100644meson_options.txt +0
-0@@ -255,6 +255,8 @@ option('xkbcommon', type : 'feature', value :'auto',
Quoted 31 lines
meson_options.txt +2
-0description: 'xkbcommon support') option('zstd', type : 'feature', value : 'auto', description: 'zstd compression support') +option('qpl', type : 'feature', value : 'auto', + description: 'Query Processing Library support') option('fuse', type: 'feature', value: 'auto', description: 'FUSE block device export') option('fuse_lseek',type : 'feature', value : 'auto', diff --git
a/scripts/meson-buildoptions.shb/scripts/meson-buildoptions.shindex7ca4b77eae..0909d1d517100644scripts/meson-buildoptions.sh +3
-1@@ -220,6 +220,7 @@ meson_options_help() { printf "%s\n" ' Xen PCI passthrough support' printf "%s\n" ' xkbcommon xkbcommon support' printf "%s\n" ' zstd zstd compression support' + printf "%s\n" ' qpl Query Processing Library support' } _meson_option_parse() { case $1 in@@ -556,6 +557,8 @@ _meson_option_parse() { --disable-xkbcommon) printf "%s" -Dxkbcommon=disabled ;; --enable-zstd) printf "%s" -Dzstd=enabled ;; --disable-zstd) printf "%s" -Dzstd=disabled ;; + --enable-qpl) printf "%s" -Dqpl=enabled ;; + --disable-qpl) printf "%s" -Dqpl=disabled ;; *) return 1 ;; esac } --2.39.3
RE: [PATCH v2 3/4] configure: add qpl option
Quoted 43 lines · "Liu, Yuan1" <[email protected]> writes:
Quoted 43 lines
-----Original Message-----
From: Fabiano Rosas <[email protected]>
Sent: Saturday, December 2, 2023 1:45 AM
To: Liu, Yuan1 <[email protected]>; [email protected]; [email protected]; [email protected]
Cc: [email protected]; Liu, Yuan1 <[email protected]>; Zou, Nanhai <[email protected]>
Subject: Re: [PATCH v2 3/4] configure: add qpl optionQuoted 20 lines · Yuan Liu
the Query Processing Library (QPL) is an open-source library that supports data compression and decompression features.
add --enable-qpl and --disable-qpl options to enable and disable the QPL compression accelerator. The QPL compression accelerator can accelerate the Zlib compression algorithm during the live migration.
Signed-off-by Yuan Liu <[email protected]>Reviewed-by Nanhai Zou <[email protected]>--- meson.build | 7 +++++++ meson_options.txt | 2 ++ scripts/meson-buildoptions.sh | 3 +++ 3 files changed, 12 insertions(+)meson.build index 259dc5f308..b4ba30b4fa renamed from meson.build +0
-0100644
meson.build if not get_option('zstd').auto() or have_block · line 1037
Quoted 6 lines
meson.build +4
-0@@ -1032,6 +1032,11 @@ if not get_option('zstd').auto() or have_block required: get_option('zstd'), method: 'pkg-config') endif +qpl = not_found +if not get_option('qpl').auto() + qpl = dependency('libqpl', required: get_option('qpl'), + method: 'pkg-config') endifHm.. I'm not having success with pkg-config:
../meson.build:1043:10: ERROR: Dependency "libqpl" not found, tried pkgconfig
Quoted 8 lines
Quoted 6 lines
It seems it doesn't find the static library. I had to use this instead:
qpl = declare_dependency(dependencies: cc.find_library('qpl',
required: get_option('qpl')))What am I missing here?
Sorry about this, the QPL repo(https://github.com/intel/qpl) does not yet support libqpl pkg-config file, we are in the process of adding this functionality and we hope to resolve libqpl's dependencies through pkg-config file. I will explicitly address this issue and provide relevant documentation in the next version.
Ok, just remember to test with a clean setup next time.
Quoted 9 lines
For the pkg-config test,
1. create/usr/lib64/pkgconfig/libqpl.pc
2. add below lines
prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Quoted 4 lines
Name: libqpl
Description: Intel Query Processing Library
Version: 1.3.0
Libs: -L${libdir} -lqpl -lpthread -laccel-config -ldl -lstdc++
We could probably do this with meson directly instead of requiring a pkg-config preliminary setup. My meson-fu is not the best, but something like:
qpl = declare_dependency(dependencies: [
cc.find_library('qpl', required: get_option('qpl')),
cc.find_library('accel-config', required: get_option('qpl')),
...
], link_args: ['-lstdc++', ...])Quoted 3 lines
Cflags: -I${includedir}
3. Install the header files to
/usr/local/include/qpland static library to/usr/local/lib64/libqpl.a
For this part is ok to just point to the official docs.
RE: [PATCH v2 3/4] configure: add qpl option
Quoted 60 lines
-----Original Message-----
From: Fabiano Rosas <[email protected]>
Sent: Monday, December 4, 2023 8:30 PM
To: Liu, Yuan1 <[email protected]>; [email protected]; [email protected]; [email protected]
Cc: [email protected]; Zou, Nanhai <[email protected]>
Subject: RE: [PATCH v2 3/4] configure: add qpl optionQuoted 9 lines · "Liu, Yuan1" <[email protected]> writes:
Quoted 9 lines
-----Original Message-----
From: Fabiano Rosas <[email protected]>
Sent: Saturday, December 2, 2023 1:45 AM
To: Liu, Yuan1 <[email protected]>; [email protected]; [email protected]; [email protected]
Cc: [email protected]; Liu, Yuan1 <[email protected]>; Zou, Nanhai <[email protected]>
Subject: Re: [PATCH v2 3/4] configure: add qpl optionQuoted 8 lines
Quoted 8 lines
Quoted 6 lines · Yuan Liu
the Query Processing Library (QPL) is an open-source library that supports data compression and decompression features.
add --enable-qpl and --disable-qpl options to enable and disable the QPL compression accelerator. The QPL compression accelerator can accelerate the Zlib compression algorithm during the live
migration.
Quoted 32 lines
Quoted 32 lines
Quoted 14 lines
Signed-off-by Yuan Liu <[email protected]>Reviewed-by Nanhai Zou <[email protected]>--- meson.build | 7 +++++++ meson_options.txt | 2 ++ scripts/meson-buildoptions.sh | 3 +++ 3 files changed, 12 insertions(+)meson.build index 259dc5f308..b4ba30b4fa renamed from meson.build +0
-0100644
meson.build if not get_option('zstd').auto() or have_block · line 1037
Quoted 6 lines
meson.build +4
-0@@ -1032,6 +1032,11 @@ if not get_option('zstd').auto() or have_block required: get_option('zstd'), method: 'pkg-config') endif +qpl = not_found +if not get_option('qpl').auto() + qpl = dependency('libqpl', required: get_option('qpl'), + method: 'pkg-config') endifHm.. I'm not having success with pkg-config:
../meson.build:1043:10: ERROR: Dependency "libqpl" not found, tried pkgconfig
It seems it doesn't find the static library. I had to use this instead:
qpl = declare_dependency(dependencies: cc.find_library('qpl',
required: get_option('qpl')))What am I missing here?
Quoted 8 lines
Quoted 1 line
Sorry about this, the QPL repo(https://github.com/intel/qpl) does not
yet support libqpl pkg-config file, we are in the process of adding this functionality and we hope to resolve libqpl's dependencies through pkg- config file.
Quoted 1 line
I will explicitly address this issue and provide relevant documentation
in the next version.
Ok, just remember to test with a clean setup next time.
Sure
Quoted 14 lines
Quoted 9 lines
For the pkg-config test,
1. create/usr/lib64/pkgconfig/libqpl.pc2. add below lines prefix=/usr/local exec_prefix=${prefix} libdir=${exec_prefix}/lib includedir=${prefix}/includeName: libqpl
Description: Intel Query Processing Library
Version: 1.3.0
Libs: -L${libdir} -lqpl -lpthread -laccel-config -ldl -lstdc++We could probably do this with meson directly instead of requiring a pkg- config preliminary setup. My meson-fu is not the best, but something like:
Quoted 5 lines
qpl = declare_dependency(dependencies: [
cc.find_library('qpl', required: get_option('qpl')), cc.find_library('accel-config', required: get_option('qpl')), ... ], link_args: ['-lstdc++', ...])
I will fix this, thank you for the sample code
Quoted 6 lines
Quoted 4 lines
Cflags: -I${includedir}
3. Install the header files to
/usr/local/include/qpland static library to/usr/local/lib64/libqpl.aFor this part is ok to just point to the official docs.
Yes, good idea
PATCH v2 4/4 multifd: Introduce QPL compression accelerator
In reply to Yuan LiuIntel Query Processing Library (QPL) is an open-source library for data compression, it supports the deflate compression algorithm, compatible with Zlib and GZIP.
QPL supports both software compression and hardware compression. Software compression is based on instruction optimization to accelerate data compression, and it can be widely used on Intel CPUs. Hardware compression utilizes the Intel In-Memory Analytics Accelerator (IAA) hardware which is available on Intel Xeon Sapphire Rapids processors.
During multifd live migration, the QPL accelerator can be specified to accelerate the Zlib compression algorithm. QPL can automatically choose software or hardware acceleration based on the platform.
--- migration/meson.build | 1 + migration/multifd-qpl.c | 326 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 327 insertions(+) create mode 100644 migration/multifd-qpl.c
migration/meson.build +1 -0
@@ -40,6 +40,7 @@ if get_option('live_block_migration').allowed() system_ss.add(files('block.c')) endif system_ss.add(when: zstd, if_true: files('multifd-zstd.c')) +system_ss.add(when: qpl, if_true: files('multifd-qpl.c')) specific_ss.add(when: 'CONFIG_SYSTEM_ONLY', if_true: files('ram.c',
migration/multifd-qpl.c new file +326 -0
326 lines not on this page · raw message
--
2.39.3