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

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