I have a problem which I am currently experiencing with QEMU 2.3.1 that is used 
in my environment where virtio-serial devices are not working properly. I will 
detail the problem below, but I should say that in investigating the problem 
further I tried the QEMU 2.5 release in Ubuntu 16.04 where the bug 
unfortunately still existed. I then tried building QEMU 2.6 which recently came 
out and it appears that the bug has been fixed in that release. The problem I 
currently have now is that I don't just want to jump to using QEMU 2.6 as QEMU 
2.3.1 is rather stable aside from this problem. I would like to backport 
whatever patch fixed this problem, but in searching the git log I found nothing 
obvious. I am wondering if anyone happens to be familiar with this problem, 
what the fix for it is, and if it is possible to backport the fix to QEMU 2.3.1.

The following is a description of the bug:

1. Using virt-manager or some other means, install you favorite Linux 
distribution that has virtio-serial support in the kernel.
2. Add the following to the libvirt XML for the guest that you created:

    <channel type='pty'>
      <target type='virtio' name='test'/>
      <address type='virtio-serial' controller='0' bus='0' port='3'/>
    </channel>

3. Start up the guest and while it is booting do a virsh dumpxml to determine 
the /dev/pty/? device attached to the host side of the channel.
4. In a terminal on the host, execute the command "cat /dev/pty/?" to capture 
output.
5. In a terminal on the guest, execute the command "echo test1 > 
/dev/virtio-ports/test".
6. Observe that the message "test1" is displayed on the host side.
7. Press CTRL-C in the terminal on the host to kill the "cat" command.
8. In the terminal on the guest, execute the command "echo test2 > 
/dev/virtio-ports/test".
9. In a terminal on the host, execute the command "cat /dev/pty/?" to capture 
output again.
10. Observe that "test2" is not displayed in the output on the host side.
11. In the terminal on the guest, execute the command "echo test3 > 
/dev/virtio-ports/test".
12. Observe that "test3" is also not displayed in the output on the host side.

If you skip the step where "test2" is sent when the host side is closed then 
you will see "test3" displayed successfully. It seems that if any write occurs 
on the guest side while the host side has been closed, then it breaks the 
virtio-serial channel in a manner that nothing else can ever be read again. The 
only way to get it working again is to completely shutdown the guest and 
restart it. The operating system running inside the guest does not appear to 
matter as this happens with Ubuntu, Windows, CentOS, etc, so this seems to be a 
problem with qemu-kvm.

Thanks.

Nat Meo

Reply via email to