Blame SOURCES/kvm-migration-introduce-decompress-error-check.patch

357786
From 79faa485281ca351111a0461bbffe10a17f30c64 Mon Sep 17 00:00:00 2001
357786
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
357786
Date: Fri, 22 Jun 2018 19:00:02 +0200
357786
Subject: [PATCH 23/57] migration: introduce decompress-error-check
357786
357786
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
357786
Message-id: <20180622190005.21297-16-dgilbert@redhat.com>
357786
Patchwork-id: 81013
357786
O-Subject: [RHEL7.6 qemu-kvm-rhev PATCH 15/18] migration: introduce decompress-error-check
357786
Bugzilla: 1584139
357786
RH-Acked-by: Juan Quintela <quintela@redhat.com>
357786
RH-Acked-by: Peter Xu <peterx@redhat.com>
357786
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
357786
357786
From: Xiao Guangrong <xiaoguangrong@tencent.com>
357786
357786
QEMU 3.0 enables strict check for compression & decompression to
357786
make the migration more robust, that depends on the source to fix
357786
the internal design which triggers the unexpected error conditions
357786
357786
To make it work for migrating old version QEMU to 2.13 QEMU, we
357786
introduce this parameter to disable the error check on the
357786
destination which is the default behavior of the machine type
357786
which is older than 2.13, alternately, the strict check can be
357786
enabled explicitly as followings:
357786
      -M pc-q35-2.11 -global migration.decompress-error-check=true
357786
357786
Signed-off-by: Xiao Guangrong <xiaoguangrong@tencent.com>
357786
Reviewed-by: Juan Quintela <quintela@redhat.com>
357786
Signed-off-by: Juan Quintela <quintela@redhat.com>
357786
(cherry picked from commit f548222c24342ca74689de7794f9006b43f86a54)
357786
  added compat entry to HW_COMPAT_RHEL7_5
357786
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
357786
357786
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
357786
---
357786
 hw/arm/virt.c         | 4 ++++
357786
 hw/i386/pc_piix.c     | 1 +
357786
 hw/i386/pc_q35.c      | 1 +
357786
 include/hw/compat.h   | 5 +++++
357786
 migration/migration.c | 4 ++++
357786
 migration/migration.h | 8 ++++++++
357786
 migration/ram.c       | 2 +-
357786
 7 files changed, 24 insertions(+), 1 deletion(-)
357786
357786
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
357786
index a4d0f52..751a93c 100644
357786
--- a/hw/arm/virt.c
357786
+++ b/hw/arm/virt.c
357786
@@ -1607,6 +1607,9 @@ static void machvirt_machine_init(void)
357786
 }
357786
 type_init(machvirt_machine_init);
357786
 
357786
+#define VIRT_COMPAT_2_12 \
357786
+    HW_COMPAT_2_12
357786
+
357786
 static void virt_2_12_instance_init(Object *obj)
357786
 {
357786
     VirtMachineState *vms = VIRT_MACHINE(obj);
357786
@@ -1669,6 +1672,7 @@ static void virt_2_12_instance_init(Object *obj)
357786
 
357786
 static void virt_machine_2_12_options(MachineClass *mc)
357786
 {
357786
+    SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_12);
357786
 }
357786
 DEFINE_VIRT_MACHINE_AS_LATEST(2, 12)
357786
 
357786
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
357786
index 7b87ef6..9991650 100644
357786
--- a/hw/i386/pc_piix.c
357786
+++ b/hw/i386/pc_piix.c
357786
@@ -432,6 +432,7 @@ static void pc_i440fx_2_12_machine_options(MachineClass *m)
357786
     pc_i440fx_machine_options(m);
357786
     m->alias = "pc";
357786
     m->is_default = 1;
357786
+    SET_MACHINE_COMPAT(m, PC_COMPAT_2_12);
357786
 }
357786
 
357786
 DEFINE_I440FX_MACHINE(v2_12, "pc-i440fx-2.12", NULL,
357786
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
357786
index 1805f55..a4387e0 100644
357786
--- a/hw/i386/pc_q35.c
357786
+++ b/hw/i386/pc_q35.c
357786
@@ -313,6 +313,7 @@ static void pc_q35_2_12_machine_options(MachineClass *m)
357786
 {
357786
     pc_q35_machine_options(m);
357786
     m->alias = "q35";
357786
+    SET_MACHINE_COMPAT(m, PC_COMPAT_2_12);
357786
 }
357786
 
357786
 DEFINE_Q35_MACHINE(v2_12, "pc-q35-2.12", NULL,
357786
diff --git a/include/hw/compat.h b/include/hw/compat.h
357786
index 9e659e9..5802e61 100644
357786
--- a/include/hw/compat.h
357786
+++ b/include/hw/compat.h
357786
@@ -480,6 +480,11 @@
357786
         .driver   = "cirrus-vga",\
357786
         .property = "vgamem_mb",\
357786
         .value    = "16",\
357786
+    },{ /* HW_COMPAT_RHEL7_5 */ \
357786
+        .driver   = "migration",\
357786
+        .property = "decompress-error-check",\
357786
+        .value    = "off",\
357786
     },
357786
 
357786
+
357786
 #endif /* HW_COMPAT_H */
357786
diff --git a/migration/migration.c b/migration/migration.c
357786
index 43d8a64..b6294f6 100644
357786
--- a/migration/migration.c
357786
+++ b/migration/migration.c
357786
@@ -2483,6 +2483,8 @@ void migration_global_dump(Monitor *mon)
357786
                    ms->send_configuration ? "on" : "off");
357786
     monitor_printf(mon, "send-section-footer: %s\n",
357786
                    ms->send_section_footer ? "on" : "off");
357786
+    monitor_printf(mon, "decompress-error-check: %s\n",
357786
+                   ms->decompress_error_check ? "on" : "off");
357786
 }
357786
 
357786
 #define DEFINE_PROP_MIG_CAP(name, x)             \
357786
@@ -2496,6 +2498,8 @@ static Property migration_properties[] = {
357786
                      send_configuration, true),
357786
     DEFINE_PROP_BOOL("send-section-footer", MigrationState,
357786
                      send_section_footer, true),
357786
+    DEFINE_PROP_BOOL("decompress-error-check", MigrationState,
357786
+                      decompress_error_check, true),
357786
 
357786
     /* Migration parameters */
357786
     DEFINE_PROP_UINT8("x-compress-level", MigrationState,
357786
diff --git a/migration/migration.h b/migration/migration.h
357786
index 06833d7..a9c5c7f 100644
357786
--- a/migration/migration.h
357786
+++ b/migration/migration.h
357786
@@ -182,6 +182,14 @@ struct MigrationState
357786
     bool send_configuration;
357786
     /* Whether we send section footer during migration */
357786
     bool send_section_footer;
357786
+
357786
+    /*
357786
+     * Whether we abort the migration if decompression errors are
357786
+     * detected at the destination. It is left at false for qemu
357786
+     * older than 3.0, since only newer qemu sends streams that
357786
+     * do not trigger spurious decompression errors.
357786
+     */
357786
+    bool decompress_error_check;
357786
 };
357786
 
357786
 void migrate_set_state(int *state, int old_state, int new_state);
357786
diff --git a/migration/ram.c b/migration/ram.c
357786
index c982201..bd563b5 100644
357786
--- a/migration/ram.c
357786
+++ b/migration/ram.c
357786
@@ -2582,7 +2582,7 @@ static void *do_data_decompress(void *opaque)
357786
 
357786
             ret = qemu_uncompress_data(&param->stream, des, pagesize,
357786
                                        param->compbuf, len);
357786
-            if (ret < 0) {
357786
+            if (ret < 0 && migrate_get_current()->decompress_error_check) {
357786
                 error_report("decompress data failed");
357786
                 qemu_file_set_error(decomp_file, ret);
357786
             }
357786
-- 
357786
1.8.3.1
357786