qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 0/5] chardev, virtio-console: flow control, error ha


From: Amit Shah
Subject: [Qemu-devel] [PATCH 0/5] chardev, virtio-console: flow control, error handling
Date: Mon, 5 Apr 2010 18:15:33 +0530

Hello,

(This series is based on the previous series that I've sent out for
virtio-serial).

This patch series adds fixes for the chardev interface to let callers
of qemu_chr_write() know how many bytes were sent and how many are
unsent in case of errors.

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.

There are two fixes for that case:
- Poll for POLLOUT instead of directly attempting write(), which helps
  relax the CPU (and we become greener).
- 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. This is done when POLLOUT doesn't get
  set in a 10-ms timeout that's specified to poll.

Using these changes, the virtio-console code is modified to handle
slow remote connections by letting the virtio-serial-bus code know of
the traffic jam and throttle the port.

I've tested this with my auto-virtserial testsuite to check for data
sent from guest to a host socket. Throttling works fine.

Comments?

Amit Shah (5):
  char: Let the caller know how many bytes were written in case of
    incomplete writes
  char: unix write: Add some sleep to ease off spinning in a tight loop
  char: unix: For files that are nonblocking, report -EAGAIN to calling
    functions
  virtio-console: Factor out common init between console and generic
    ports
  virtio-console: Throttle virtio-serial-bus if we can't consume any
    more guest data

 console.c           |   10 ++--
 gdbstub.c           |   15 +++--
 hw/bt-hci-csr.c     |    8 ++--
 hw/debugcon.c       |    5 +-
 hw/msmouse.c        |    5 +-
 hw/parallel.c       |    5 ++-
 hw/serial.c         |    4 +-
 hw/usb-serial.c     |    4 +-
 hw/virtio-console.c |  146 ++++++++++++++++++++++++++++++++++++++++++++------
 monitor.c           |    4 +-
 net/socket.c        |    7 ++-
 qemu-char.c         |  125 ++++++++++++++++++++++++++++++--------------
 qemu-char.h         |    7 ++-
 qemu_socket.h       |    2 +-
 slirp/slirp.c       |   12 +++--
 15 files changed, 268 insertions(+), 91 deletions(-)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]