|
From: | Gerd Hoffmann |
Subject: | [Qemu-devel] Re: [PATCH 0/5] chardev, virtio-console: flow control, error handling |
Date: | Tue, 06 Apr 2010 09:36:17 +0200 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.8) Gecko/20100301 Fedora/3.0.3-1.fc12 Thunderbird/3.0.3 |
Hi,
In case of EAGAIN, the unix_write() function just kept spinning while attempting to write to the chardev till it succeeded. This resulted in a stuck VM in case a chardev had opened connection but wasn't reading anything from qemu.
It spins only for non-blocking file handles. In blocking mode the write syscall just goes sleep until it can write out data (or gets a signal).
There are two fixes for that case: - Poll for POLLOUT instead of directly attempting write(), which helps relax the CPU (and we become greener).
No need to do that, see above. Having a poll() call in unix_write() is wrong IMHO.
- If the file that we're writing to is nonblocking, return -EAGAIN to the caller of qemu_chr_write() so that appropriate actions can be taken higher up in the stack.
Good. cheers, Gerd
[Prev in Thread] | Current Thread | [Next in Thread] |