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

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