Skip to contentSkip to conversation

Use rightc parames (was Make xbzrle_cache_size a migration parameter)

PATCH In review Juan Quintela 2 participants 3 messages Nov 22, 2017 – Nov 28, 2017

lore
Share & tools
lore
#0 lore raw

v4 cover Use rightc parames (was Make xbzrle_cache_size a migration parameter)

Hi

On v4:
- Markus agreed that the change on sizes are right, so resend without RFC.

Rest of patches already in, please review.

Later, Juan.

On v3:
- rebase on top of last migration pull requset
- improve comments (dave suggestion)
- always return 0 in case of error
- checked with ovirt/openstack/libvirt people that making value a power of two is not a problem.
- should I drop the last patch, or sent it?

Please revieww.

[v2]

- rebase
- fix comments about power of 2 instead of multiple of two
- minor typo on error message
- use Error * when setting values

After asking people of libvirt/ovirt/openstack, it appears that there is no problem about restricting cache_size to real values. We give back one error and they had to handle errors already.

Please review, Juan.

[v1]

I started looking at xbzrle_cache_size and saw that it was not a parameter. How difficult could it be? HaHa

- x-multifd-page-count and x-multifd-channels were not o migrate_test_apply

- page_cache.c has parameters that were not used (max_item_age)

- page cache types were random. Move almost all to int/size_t as appropiate

- error handling was split in three functions:
xbzrle_cache_resize
cache_init
qmp_set_cache_size
Make some sense of it and use Error*

- We pass one value to qmp_migrate_cache_size it asigned pow2log() of that value, and cache_init() used a power of two. Make sure that the value passed is right.

- Now I am able to make xbzrle_cache_size a parameter!!!!

- Now that I have arrived here, I tried to make the json types for migartion parameters the real ones instead of everything is an int64. I will be happy if libvirt people checked this.

Please review, Juan.

Juan Quintela (1):
migration: Use proper types in json

 hmp.c                 | 22 +++++++++++-----------
 migration/migration.c | 49 ++++++++++++++++++++-----------------------------
 qapi/migration.json   | 22 +++++++++++-----------
 3 files changed, 42 insertions(+), 51 deletions(-)
Signature · 1 line
2.13.6
#1 lore raw

PATCH v4 1/1 migration: Use proper types in json

We use int for everything (int64_t), and then we check that value is between 0 and 255. Change it to the valid types.

This change only happens for HMP. QMP always use bytes and similars.

---
 hmp.c                 | 22 +++++++++++-----------
 migration/migration.c | 49 ++++++++++++++++++++-----------------------------
 qapi/migration.json   | 22 +++++++++++-----------
 3 files changed, 42 insertions(+), 51 deletions(-)
hmp.c +11 -11
index 27e0fca4ac..1b54c76063 100644
@@ -293,23 +293,23 @@ void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict)
 
     if (params) {
         assert(params->has_compress_level);
-        monitor_printf(mon, "%s: %" PRId64 "\n",
+        monitor_printf(mon, "%s: %u\n",
             MigrationParameter_str(MIGRATION_PARAMETER_COMPRESS_LEVEL),
             params->compress_level);
         assert(params->has_compress_threads);
-        monitor_printf(mon, "%s: %" PRId64 "\n",
+        monitor_printf(mon, "%s: %u\n",
             MigrationParameter_str(MIGRATION_PARAMETER_COMPRESS_THREADS),
             params->compress_threads);
         assert(params->has_decompress_threads);
-        monitor_printf(mon, "%s: %" PRId64 "\n",
+        monitor_printf(mon, "%s: %u\n",
             MigrationParameter_str(MIGRATION_PARAMETER_DECOMPRESS_THREADS),
             params->decompress_threads);
         assert(params->has_cpu_throttle_initial);
-        monitor_printf(mon, "%s: %" PRId64 "\n",
+        monitor_printf(mon, "%s: %u\n",
             MigrationParameter_str(MIGRATION_PARAMETER_CPU_THROTTLE_INITIAL),
             params->cpu_throttle_initial);
         assert(params->has_cpu_throttle_increment);
-        monitor_printf(mon, "%s: %" PRId64 "\n",
+        monitor_printf(mon, "%s: %u\n",
             MigrationParameter_str(MIGRATION_PARAMETER_CPU_THROTTLE_INCREMENT),
             params->cpu_throttle_increment);
         assert(params->has_tls_creds);
@@ -321,28 +321,28 @@ void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict)
             MigrationParameter_str(MIGRATION_PARAMETER_TLS_HOSTNAME),
             params->tls_hostname);
         assert(params->has_max_bandwidth);
-        monitor_printf(mon, "%s: %" PRId64 " bytes/second\n",
+        monitor_printf(mon, "%s: %" PRIu64 " bytes/second\n",
             MigrationParameter_str(MIGRATION_PARAMETER_MAX_BANDWIDTH),
             params->max_bandwidth);
         assert(params->has_downtime_limit);
-        monitor_printf(mon, "%s: %" PRId64 " milliseconds\n",
+        monitor_printf(mon, "%s: %" PRIu64 " milliseconds\n",
             MigrationParameter_str(MIGRATION_PARAMETER_DOWNTIME_LIMIT),
             params->downtime_limit);
         assert(params->has_x_checkpoint_delay);
-        monitor_printf(mon, "%s: %" PRId64 "\n",
+        monitor_printf(mon, "%s: %u\n",
             MigrationParameter_str(MIGRATION_PARAMETER_X_CHECKPOINT_DELAY),
             params->x_checkpoint_delay);
         assert(params->has_block_incremental);
         monitor_printf(mon, "%s: %s\n",
             MigrationParameter_str(MIGRATION_PARAMETER_BLOCK_INCREMENTAL),
             params->block_incremental ? "on" : "off");
-        monitor_printf(mon, "%s: %" PRId64 "\n",
+        monitor_printf(mon, "%s: %u\n",
             MigrationParameter_str(MIGRATION_PARAMETER_X_MULTIFD_CHANNELS),
             params->x_multifd_channels);
-        monitor_printf(mon, "%s: %" PRId64 "\n",
+        monitor_printf(mon, "%s: %u\n",
             MigrationParameter_str(MIGRATION_PARAMETER_X_MULTIFD_PAGE_COUNT),
             params->x_multifd_page_count);
-        monitor_printf(mon, "%s: %" PRId64 "\n",
+        monitor_printf(mon, "%s: %" PRIu64 "\n",
             MigrationParameter_str(MIGRATION_PARAMETER_XBZRLE_CACHE_SIZE),
             params->xbzrle_cache_size);
         monitor_printf(mon, "%s: %s\n",
migration/migration.c +20 -29

113 lines not on this page · raw message

qapi/migration.json +11 -11
index 6b9758ab99..68d0703578 100644
@@ -679,20 +679,20 @@
 # Since: 2.4
 ##
 { 'struct': 'MigrationParameters',
-  'data': { '*compress-level': 'int',
-            '*compress-threads': 'int',
-            '*decompress-threads': 'int',
-            '*cpu-throttle-initial': 'int',
-            '*cpu-throttle-increment': 'int',
+  'data': { '*compress-level': 'uint8',
+            '*compress-threads': 'uint8',
+            '*decompress-threads': 'uint8',
+            '*cpu-throttle-initial': 'uint8',
+            '*cpu-throttle-increment': 'uint8',
             '*tls-creds': 'str',
             '*tls-hostname': 'str',
-            '*max-bandwidth': 'int',
-            '*downtime-limit': 'int',
-            '*x-checkpoint-delay': 'int',
+            '*max-bandwidth': 'size',
+            '*downtime-limit': 'uint64',
+            '*x-checkpoint-delay': 'uint32',
             '*block-incremental': 'bool' ,
-            '*x-multifd-channels': 'int',
-            '*x-multifd-page-count': 'int',
-            '*xbzrle-cache-size': 'size' ,
+            '*x-multifd-channels': 'uint8',
+            '*x-multifd-page-count': 'uint32',
+            '*xbzrle-cache-size': 'size',
             '*uri': 'str'} }
 
 ##
Signature · 1 line
2.13.6
Reviewed-by on v4 1/1
#2 lore raw

Re: [Qemu-devel] [PATCH v4 1/1] migration: Use proper types in json

Quoted 4 lines · Juan Quintela

We use int for everything (int64_t), and then we check that value is between 0 and 255. Change it to the valid types.

This change only happens for HMP. QMP always use bytes and similars.

s/similars/similar/

Quoted 8 lines
---
  hmp.c                 | 22 +++++++++++-----------
  migration/migration.c | 49 ++++++++++++++++++++-----------------------------
  qapi/migration.json   | 22 +++++++++++-----------
  3 files changed, 42 insertions(+), 51 deletions(-)
Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org