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


Reply via email to