[PATCH 2/5] qapi/migration: Introduce compress-with-iaa migration parameter

Yuan Liu posted 5 patches 1 year, 1 month ago
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Thomas Huth <thuth@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Juan Quintela <quintela@redhat.com>, Peter Xu <peterx@redhat.com>, Fabiano Rosas <farosas@suse.de>, Leonardo Bras <leobras@redhat.com>, Eric Blake <eblake@redhat.com>, Markus Armbruster <armbru@redhat.com>
There is a newer version of this series
[PATCH 2/5] qapi/migration: Introduce compress-with-iaa migration parameter
Posted by Yuan Liu 1 year, 1 month ago
Introduce the compress-with-iaa=on/off option to enable or disable live
migration data (de)compression with the In-Memory Analytics Accelerator
(IAA).

The data (de)compression with IAA feature is based on the migration
compression capability, which is enabled by setting
migrate_set_capability compress on. If the migration compression
capability is enabled and the IAA compression parameter is set, IAA will
be used instead of CPU for data (de)compression.

Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Reviewed-by: Nanhai Zou <nanhai.zou@intel.com>
---
 migration/migration-hmp-cmds.c |  8 ++++++++
 migration/options.c            | 20 ++++++++++++++++++++
 migration/options.h            |  1 +
 qapi/migration.json            |  4 +++-
 4 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c
index c115ef2d23..38e441bb37 100644
--- a/migration/migration-hmp-cmds.c
+++ b/migration/migration-hmp-cmds.c
@@ -281,6 +281,10 @@ void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict)
         monitor_printf(mon, "%s: %u\n",
             MigrationParameter_str(MIGRATION_PARAMETER_COMPRESS_THREADS),
             params->compress_threads);
+        assert(params->has_compress_with_iaa);
+        monitor_printf(mon, "%s: %s\n",
+            MigrationParameter_str(MIGRATION_PARAMETER_COMPRESS_WITH_IAA),
+            params->compress_with_iaa ? "on" : "off");
         assert(params->has_compress_wait_thread);
         monitor_printf(mon, "%s: %s\n",
             MigrationParameter_str(MIGRATION_PARAMETER_COMPRESS_WAIT_THREAD),
@@ -517,6 +521,10 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
         p->has_compress_threads = true;
         visit_type_uint8(v, param, &p->compress_threads, &err);
         break;
+    case MIGRATION_PARAMETER_COMPRESS_WITH_IAA:
+        p->has_compress_with_iaa = true;
+        visit_type_bool(v, param, &p->compress_with_iaa, &err);
+        break;
     case MIGRATION_PARAMETER_COMPRESS_WAIT_THREAD:
         p->has_compress_wait_thread = true;
         visit_type_bool(v, param, &p->compress_wait_thread, &err);
diff --git a/migration/options.c b/migration/options.c
index 1d1e1321b0..06d4b36b77 100644
--- a/migration/options.c
+++ b/migration/options.c
@@ -107,6 +107,8 @@ Property migration_properties[] = {
     DEFINE_PROP_UINT8("x-compress-threads", MigrationState,
                       parameters.compress_threads,
                       DEFAULT_MIGRATE_COMPRESS_THREAD_COUNT),
+    DEFINE_PROP_BOOL("x-compress-with-iaa", MigrationState,
+                      parameters.compress_with_iaa, false),
     DEFINE_PROP_BOOL("x-compress-wait-thread", MigrationState,
                       parameters.compress_wait_thread, true),
     DEFINE_PROP_UINT8("x-decompress-threads", MigrationState,
@@ -724,6 +726,13 @@ int migrate_compress_threads(void)
     return s->parameters.compress_threads;
 }
 
+bool migrate_compress_with_iaa(void)
+{
+    MigrationState *s = migrate_get_current();
+
+    return s->parameters.compress_with_iaa;
+}
+
 int migrate_compress_wait_thread(void)
 {
     MigrationState *s = migrate_get_current();
@@ -899,6 +908,8 @@ MigrationParameters *qmp_query_migrate_parameters(Error **errp)
     params->compress_level = s->parameters.compress_level;
     params->has_compress_threads = true;
     params->compress_threads = s->parameters.compress_threads;
+    params->has_compress_with_iaa = true;
+    params->compress_with_iaa = s->parameters.compress_with_iaa;
     params->has_compress_wait_thread = true;
     params->compress_wait_thread = s->parameters.compress_wait_thread;
     params->has_decompress_threads = true;
@@ -969,6 +980,7 @@ void migrate_params_init(MigrationParameters *params)
     /* Set has_* up only for parameter checks */
     params->has_compress_level = true;
     params->has_compress_threads = true;
+    params->has_compress_with_iaa = true;
     params->has_compress_wait_thread = true;
     params->has_decompress_threads = true;
     params->has_throttle_trigger_threshold = true;
@@ -1195,6 +1207,10 @@ static void migrate_params_test_apply(MigrateSetParameters *params,
         dest->decompress_threads = params->decompress_threads;
     }
 
+    if (params->has_compress_with_iaa) {
+        dest->compress_with_iaa = params->compress_with_iaa;
+    }
+
     if (params->has_throttle_trigger_threshold) {
         dest->throttle_trigger_threshold = params->throttle_trigger_threshold;
     }
@@ -1300,6 +1316,10 @@ static void migrate_params_apply(MigrateSetParameters *params, Error **errp)
         s->parameters.decompress_threads = params->decompress_threads;
     }
 
+    if (params->has_compress_with_iaa) {
+        s->parameters.compress_with_iaa = params->compress_with_iaa;
+    }
+
     if (params->has_throttle_trigger_threshold) {
         s->parameters.throttle_trigger_threshold = params->throttle_trigger_threshold;
     }
diff --git a/migration/options.h b/migration/options.h
index 045e2a41a2..926d723d0e 100644
--- a/migration/options.h
+++ b/migration/options.h
@@ -77,6 +77,7 @@ uint8_t migrate_cpu_throttle_increment(void);
 uint8_t migrate_cpu_throttle_initial(void);
 bool migrate_cpu_throttle_tailslow(void);
 int migrate_decompress_threads(void);
+bool migrate_compress_with_iaa(void);
 uint64_t migrate_downtime_limit(void);
 uint8_t migrate_max_cpu_throttle(void);
 uint64_t migrate_max_bandwidth(void);
diff --git a/qapi/migration.json b/qapi/migration.json
index 8843e74b59..8edc622dd9 100644
--- a/qapi/migration.json
+++ b/qapi/migration.json
@@ -835,7 +835,7 @@
 { 'enum': 'MigrationParameter',
   'data': ['announce-initial', 'announce-max',
            'announce-rounds', 'announce-step',
-           'compress-level', 'compress-threads', 'decompress-threads',
+           'compress-level', 'compress-threads', 'compress-with-iaa', 'decompress-threads',
            'compress-wait-thread', 'throttle-trigger-threshold',
            'cpu-throttle-initial', 'cpu-throttle-increment',
            'cpu-throttle-tailslow',
@@ -1008,6 +1008,7 @@
             '*announce-step': 'size',
             '*compress-level': 'uint8',
             '*compress-threads': 'uint8',
+            '*compress-with-iaa': 'bool',
             '*compress-wait-thread': 'bool',
             '*decompress-threads': 'uint8',
             '*throttle-trigger-threshold': 'uint8',
@@ -1208,6 +1209,7 @@
             '*announce-step': 'size',
             '*compress-level': 'uint8',
             '*compress-threads': 'uint8',
+            '*compress-with-iaa': 'bool',
             '*compress-wait-thread': 'bool',
             '*decompress-threads': 'uint8',
             '*throttle-trigger-threshold': 'uint8',
-- 
2.39.3
Re: [PATCH 2/5] qapi/migration: Introduce compress-with-iaa migration parameter
Posted by Peter Xu 1 year, 1 month ago
On Thu, Oct 19, 2023 at 06:12:21AM +0800, Yuan Liu wrote:
> diff --git a/qapi/migration.json b/qapi/migration.json
> index 8843e74b59..8edc622dd9 100644
> --- a/qapi/migration.json
> +++ b/qapi/migration.json
> @@ -835,7 +835,7 @@
>  { 'enum': 'MigrationParameter',
>    'data': ['announce-initial', 'announce-max',
>             'announce-rounds', 'announce-step',
> -           'compress-level', 'compress-threads', 'decompress-threads',
> +           'compress-level', 'compress-threads', 'compress-with-iaa', 'decompress-threads',
>             'compress-wait-thread', 'throttle-trigger-threshold',
>             'cpu-throttle-initial', 'cpu-throttle-increment',
>             'cpu-throttle-tailslow',
> @@ -1008,6 +1008,7 @@
>              '*announce-step': 'size',
>              '*compress-level': 'uint8',
>              '*compress-threads': 'uint8',
> +            '*compress-with-iaa': 'bool',
>              '*compress-wait-thread': 'bool',
>              '*decompress-threads': 'uint8',
>              '*throttle-trigger-threshold': 'uint8',
> @@ -1208,6 +1209,7 @@
>              '*announce-step': 'size',
>              '*compress-level': 'uint8',
>              '*compress-threads': 'uint8',
> +            '*compress-with-iaa': 'bool',
>              '*compress-wait-thread': 'bool',
>              '*decompress-threads': 'uint8',
>              '*throttle-trigger-threshold': 'uint8',

Please add comments for the new fields too in qapi/, thanks.

-- 
Peter Xu
Re: [PATCH 2/5] qapi/migration: Introduce compress-with-iaa migration parameter
Posted by Juan Quintela 1 year, 1 month ago
Yuan Liu <yuan1.liu@intel.com> wrote:
> Introduce the compress-with-iaa=on/off option to enable or disable live
> migration data (de)compression with the In-Memory Analytics Accelerator
> (IAA).
>
> The data (de)compression with IAA feature is based on the migration
> compression capability, which is enabled by setting
> migrate_set_capability compress on. If the migration compression
> capability is enabled and the IAA compression parameter is set, IAA will
> be used instead of CPU for data (de)compression.
>
> Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
> Reviewed-by: Nanhai Zou <nanhai.zou@intel.com>

> @@ -724,6 +726,13 @@ int migrate_compress_threads(void)
>      return s->parameters.compress_threads;
>  }
>  
> +bool migrate_compress_with_iaa(void)
> +{
> +    MigrationState *s = migrate_get_current();
> +
> +    return s->parameters.compress_with_iaa;
> +}
> +

This should be in migration/options.c



> @@ -77,6 +77,7 @@ uint8_t migrate_cpu_throttle_increment(void);
>  uint8_t migrate_cpu_throttle_initial(void);
>  bool migrate_cpu_throttle_tailslow(void);
>  int migrate_decompress_threads(void);
> +bool migrate_compress_with_iaa(void);
>  uint64_t migrate_downtime_limit(void);
>  uint8_t migrate_max_cpu_throttle(void);
>  uint64_t migrate_max_bandwidth(void);

This list of functions is sorted.  The same in the migration/options.c.