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

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