Description of problem:
KVM guest hangs after opening the virtio-console port, when data already in virtioconsole buffer.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Start qemu-kvm with commandline
qemu-kvm -device virtio-serial -drive file=/data/Virtual/fedora-Vconsole.img,if=virtio,boot=on,serial=s,cache=writeback -m 512 -chardev socket,path=/tmp/aaa,id=aaa,server,nowait -device virtconsole,chardev=aaa,name=org.fedoraproject.console.aaa -enable-kvm -monitor stdio -chardev socket,path=/tmp/b,id=b,server,nowait -device virtconsole,chardev=b,name=org.fedoraproject.console.b
2. send 10KB to port /tmp/b
3. in guest open (/dev/hvc1)
Guest hangs in infinite loops (cpu usage 100% never end)
On guest side open console /dev/hvc1 and recieve data.
I test same stuff using virtserialport with positive results.
1) Start guest
2) First send data from host (socket /tmp/data) to serial port to guest (/dev/vport0p1).
3) after data are sent open port with 'cat /dev/vport0p1'
cat listens on port, old data are truncated and new are correctly received.
Works for me with Linus' git kernel in the guest. Most likely looks like a guest kernel issue. I'll update when I have more data or a fix.
I believe this is the same issue as I discussed with Amit on irc this is a feature ^W bug on how the virtio_console driver in the guest handles writes when no one is listening on the host side.
The problem is this "beauty" in virtio_console.c: send_buf()
* Wait till the host acknowledges it pushed out the data we
* sent. This is done for ports in blocking mode or for data
* from the hvc_console; the tty operations are performed with
* spinlocks held so we can't sleep here.
while (!virtqueue_get_buf(out_vq, &len))
I see a number of possible (partial) solutions here:
1) the code says it is using cpu_relux rather then sleep, because the tty functions are called with a spinlock held. but fops-write is not called with any spinlock held, I believe. How about a parameter to send_buf, called "may_sleep" and then use sleep rather then relax if may_sleep is true?
2) The waiting is done for: "This is done for ports in blocking mode or for data from the hvc_console". I wonder why the waiting is done in blocking mode too, I guess this is some sort of workaround for the missing waitqueue wakeups, see bug 643750, with those waitqueue wakeups added I would think / expect the waiting for the host acknowledge is only needed for tty usage, and that we could skip the wait entirely (making 1 mute) when called from fops_write ?
This message is a reminder that Fedora 13 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 13. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora
'version' of '13'.
Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version prior to Fedora 13's end of life.
Bug Reporter: Thank you for reporting this issue and we are sorry that
we may not be able to fix it before Fedora 13 is end of life. If you
would still like to see this bug fixed and are able to reproduce it
against a later version of Fedora please change the 'version' of this
bug to the applicable version. If you are unable to change the version,
please add a comment here and someone will do it for you.
Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.
The process we are following is described here:
Fedora 13 changed to end-of-life (EOL) status on 2011-06-25. Fedora 13 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.
If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version.
Thank you for reporting this bug and we are sorry it could not be fixed.