Bug 1459945 - migration fails with hungup serial console reader on -M pc-i440fx-rhel7.0.0 and pc-i440fx-rhel7.1.0
migration fails with hungup serial console reader on -M pc-i440fx-rhel7.0.0 a...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev (Show other bugs)
7.4
Unspecified Unspecified
high Severity high
: rc
: ---
Assigned To: Paolo Bonzini
jingzhao
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-06-08 12:03 EDT by Paolo Bonzini
Modified: 2018-04-10 20:25 EDT (History)
19 users (show)

See Also:
Fixed In Version: qemu-kvm-rhev-2.10.0-18.el7
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1452067
Environment:
Last Closed: 2018-04-10 20:23:04 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2018:1104 None None None 2018-04-10 20:25 EDT

  None (edit)
Description Paolo Bonzini 2017-06-08 12:03:06 EDT
See also qemu-kvm bug 1452067.

1) start /usr/libexec/qemu-kvm -drive if=none,id=hd,file=$HOME/f25-64.qcow2 -device virtio-blk,drive=hd -m 256 --enable-kvm -serial pty -monitor stdio -M pc-i440fx-rhel7.0.0

2) start cat for pty opened by first QEMU instance, e.g. "cat /dev/pts/5" if it prints
     char device redirected to /dev/pts/5 (label serial0)

3) start /usr/libexec/qemu-kvm -drive if=none,id=hd,file=$HOME/f25-64.qcow2 -device virtio-blk,drive=hd -m 256 --enable-kvm -serial pty -monitor stdio -M pc-i440fx-rhel7.0.0 -incoming tcp:localhost:12345

4) start cat for pty opened by second QEMU instance

6) type "yes > /dev/ttyS0", endless stream of "y" comes out of cat instance #1

7) type ^Z to stop cat instance #1

8) start migration:
      migrate_set_speed 1G
      migrate tcp:localhost:12345

Expected results:
 endless stream of "y" should come out of cat instance #2

Actual results:
 qemu-system-x86_64: inconsistent state in serial device (tsr not empty, tsr_retry=0
 qemu-system-x86_64: Failed to load serial:state
 qemu-system-x86_64: error while loading state for instance 0x1 of device 'serial'
 qemu-system-x86_64: load of migration failed: Operation not permitted


Originally introduced by:

    commit 17f9a1880e63e32d9fff0cf821ba70ceed861da2
    Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
    Date:   Wed Jun 24 13:39:56 2015 +0200

    Serial: Migration compatibility pre 2.2/7.2
    
    Message-id: <1435153196-26350-3-git-send-email-dgilbert@redhat.com>
    Patchwork-id: 66380
    O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH v3 2/2] Serial: Migration compatibility pre 2.2/7.2
    Bugzilla: 1215087
    RH-Acked-by: Juan Quintela <quintela@redhat.com>
    RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
    RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
    RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
    
    From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
    
    Disable subsections added in qemu 2.3
    
    Newer qemu fixed migration corner cases for serial by adding subsections,
    however if these are generated it will break backwards migration.
    Disabling these subsections on older machine types should leave it no
    worse than existing qemu, from which we're not aware of having any reports
    of problems, and still allow these improvements on new machine types.
    Even when a user isn't actively using a serial port a guest will
    probably initialise it and may send stuff (e.g. a copy of the console 
    messages or the login: prompt).
    
    Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
    Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>

The commit message mentions that "a guest will probably initialise it and may send stuff", but a disconnected console eats data immediately.  Only a hungup reader can cause data to accumulate in the serial port's FIFO.
Comment 4 Miroslav Rezanina 2018-01-23 07:58:51 EST
Fix included in qemu-kvm-rhev-2.10.0-18.el7
Comment 6 huiqingding 2018-01-29 05:14:26 EST
Reproduce this bug using the following version:
qemu-kvm-rhev-2.10.0-17.el7.x86_64
kernel-3.10.0-838.el7.x86_64

1. Boot a rhel7.5 guest with "-machine pc-i440fx-rhel7.0.0":
/usr/libexec/qemu-kvm \
    -name 'avocado-vt-vm1'  \
    -sandbox off  \
    -machine pc-i440fx-rhel7.0.0  \
    -nodefaults  \
    -vga std  \
    -device virtio-serial-pci,id=virtio_serial_pci0,bus=pci.0,addr=03 \
    -device nec-usb-xhci,id=usb1,bus=pci.0 \
    -device virtio-scsi-pci,id=virtio_scsi_pci0,bus=pci.0,addr=05 \
    -drive id=drive_image1,if=none,snapshot=off,format=qcow2,snapshot=off,file=/mnt/rhel7.5.qcow2 \
    -device scsi-hd,id=image1,drive=drive_image1,bus=virtio_scsi_pci0.0 \
    -device virtio-net-pci,mac=9a:7b:7c:7d:7e:90,id=id9HRc5V,vectors=4,netdev=idjlQN53,bus=pci.0,addr=10 \
    -netdev tap,id=idjlQN53,vhost=off,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown \
    -m 4G  \
    -smp 4  \
    -name debug-threads=on \
    -serial pty \
    -device usb-tablet,id=usb-tablet1,bus=usb1.0,port=1  \
    -device usb-kbd,bus=usb1.0,port=2 \
    -device usb-mouse,bus=usb1.0,port=3 \
    -vnc :1 \
    -rtc base=localtime,clock=vm,driftfix=slew  \
    -boot order=cdn,once=c,menu=on,strict=off \
    -monitor stdio \
    -enable-kvm
2. boot the guest with "-incoming tcp:0:5800"
 
3 on src host,start cat for pty opened by src host QEMU instance:
# cat /dev/pts/2

4. on dst host, start cat for pty opened by dst host QEMU instance:
# cat /dev/pts/4

5. inside guest, type "yes > /dev/ttyS0",endless stream of "y" comes out of cat instance on src host
# cat /dev/pts/2
y
y
y
y
....
6. type ^Z to stop cat instance #1

7. on src host, do migration
(qemu) migrate -d tcp:0:5800

after step7, migration is failed, the destination qemu-kvm quits with error:
(qemu) qemu-kvm: inconsistent state in serial device (tsr not empty, tsr_retry=0
qemu-kvm: Failed to load serial:state
qemu-kvm: error while loading state for instance 0x0 of device 'serial'
qemu-kvm: load of migration failed: Operation not permitted
Comment 7 huiqingding 2018-01-29 05:27:23 EST
Verify this bug using version:
qemu-kvm-rhev-2.10.0-17.el7.x86_64
kernel-3.10.0-838.el7.x86_64

Test "-machine pc-i440fx-rhel7.0.0" and "-machine pc-i440fx-rhel7.1.0". The steps are same as comment #6.

After step7, migration can be finished normally and endless stream of "y" comes out of cat instance on dst host
# cat /dev/pts/2
y
y
y
y
....
Comment 8 huiqingding 2018-01-29 05:27:57 EST
Based on comment #7, set this bug to be verified.
Comment 11 errata-xmlrpc 2018-04-10 20:23:04 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2018:1104

Note You need to log in before you can comment on or make changes to this bug.