Blame SOURCES/kvm-serial-always-transmit-send-receive-buffers-on-migra.patch

9bac43
From b1163e497bdb3d6f04593940b6ec7842ec35c8ff Mon Sep 17 00:00:00 2001
9bac43
From: Paolo Bonzini <pbonzini@redhat.com>
9bac43
Date: Thu, 11 Jan 2018 13:56:44 +0100
9bac43
Subject: [PATCH 01/21] serial: always transmit send/receive buffers on
9bac43
 migration
9bac43
9bac43
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
9bac43
Message-id: <20180111135644.16253-1-pbonzini@redhat.com>
9bac43
Patchwork-id: 78551
9bac43
O-Subject: [RHEL7.5 qemu-kvm-rhev PATCH v2] serial: always transmit send/receive buffers on migration
9bac43
Bugzilla: 1459945
9bac43
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
9bac43
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
9bac43
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
9bac43
9bac43
When subsections were added in qemu 2.3, they were all disabled
9bac43
for machine types that require pre-2.3 compatibility.  The commit
9bac43
message says "disabling these subsections on older machine types should
9bac43
leave it no worse than existing qemu", but actually migrating from
9bac43
new QEMU to new QEMU (but with old machine type) will detect an
9bac43
inconsistent migration state and fail the migration:
9bac43
9bac43
   qemu-system-x86_64: inconsistent state in serial device (tsr not empty, tsr_retry=0
9bac43
   qemu-system-x86_64: Failed to load serial:state
9bac43
   qemu-system-x86_64: error while loading state for instance 0x0 of device 'serial'
9bac43
9bac43
In fact, this shows that migration from new source to old destination
9bac43
might have also eaten the data in the FIFO or transmit/receive buffers.
9bac43
9bac43
It's actually pretty easy to trigger the failure by connecting a console
9bac43
to a hung-up reader (not a *disconnected* reader!).  The fix is to
9bac43
handle the subsections the same as we did in the qemu-kvm BZ1452067.
9bac43
The data registers are migrated, which may indeed cause some more migrations
9bac43
to fail to old qemu-kvm-rhev, but it will fix migration to new qemu-kvm-rhev.
9bac43
Some subsections are still keyed on migrate_pre_2_2; from the commit message
9bac43
of downstream commit 7d2e8f9662feb64c0b15b6fd53e06e3c56921f27:
9bac43
9bac43
    thr_ipending can be reconstructed fairly
9bac43
    reliably by serial_post_load.  The others are features that are
9bac43
    unlikely to be used in RHEL, respectively receive timeout (Linux
9bac43
    does not even have the UART_IIR_CTI symbol in the driver) and
9bac43
    physical serial ports connected to a modem
9bac43
9bac43
I consider this okay because nobody has yet complained about it for
9bac43
qemu-kvm.  It's also safer because the failure avoids serial data loss
9bac43
on migration.  This is consistent with the intended use of subsections.
9bac43
9bac43
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9bac43
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9bac43
---
9bac43
 hw/char/serial.c | 12 ------------
9bac43
 1 file changed, 12 deletions(-)
9bac43
9bac43
diff --git a/hw/char/serial.c b/hw/char/serial.c
9bac43
index fe4f41d..d82f7eb 100644
9bac43
--- a/hw/char/serial.c
9bac43
+++ b/hw/char/serial.c
9bac43
@@ -720,10 +720,6 @@ static const VMStateDescription vmstate_serial_thr_ipending = {
9bac43
 static bool serial_tsr_needed(void *opaque)
9bac43
 {
9bac43
     SerialState *s = (SerialState *)opaque;
9bac43
-    if (migrate_pre_2_2) {
9bac43
-        return false;
9bac43
-    }
9bac43
-
9bac43
     return s->tsr_retry != 0;
9bac43
 }
9bac43
 
9bac43
@@ -743,10 +739,6 @@ static const VMStateDescription vmstate_serial_tsr = {
9bac43
 static bool serial_recv_fifo_needed(void *opaque)
9bac43
 {
9bac43
     SerialState *s = (SerialState *)opaque;
9bac43
-    if (migrate_pre_2_2) {
9bac43
-        return false;
9bac43
-    }
9bac43
-
9bac43
     return !fifo8_is_empty(&s->recv_fifo);
9bac43
 
9bac43
 }
9bac43
@@ -765,10 +757,6 @@ static const VMStateDescription vmstate_serial_recv_fifo = {
9bac43
 static bool serial_xmit_fifo_needed(void *opaque)
9bac43
 {
9bac43
     SerialState *s = (SerialState *)opaque;
9bac43
-    if (migrate_pre_2_2) {
9bac43
-        return false;
9bac43
-    }
9bac43
-
9bac43
     return !fifo8_is_empty(&s->xmit_fifo);
9bac43
 }
9bac43
 
9bac43
-- 
9bac43
1.8.3.1
9bac43