qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/5] chardev, virtio-console: flow control, error handling
@ 2010-04-05 12:45 Amit Shah
  2010-04-05 12:45 ` [Qemu-devel] [PATCH 1/5] char: Let the caller know how many bytes were written in case of incomplete writes Amit Shah
  2010-04-06  7:36 ` [Qemu-devel] Re: [PATCH 0/5] chardev, virtio-console: flow control, error handling Gerd Hoffmann
  0 siblings, 2 replies; 21+ messages in thread
From: Amit Shah @ 2010-04-05 12:45 UTC (permalink / raw)
  To: qemu list; +Cc: Amit Shah, Gerd Hoffmann, Juan Quintela

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(-)

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2010-04-06 13:30 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-05 12:45 [Qemu-devel] [PATCH 0/5] chardev, virtio-console: flow control, error handling Amit Shah
2010-04-05 12:45 ` [Qemu-devel] [PATCH 1/5] char: Let the caller know how many bytes were written in case of incomplete writes Amit Shah
2010-04-05 12:45   ` [Qemu-devel] [PATCH 2/5] char: unix write: Add some sleep to ease off spinning in a tight loop Amit Shah
2010-04-05 12:45     ` [Qemu-devel] [PATCH 3/5] char: unix: For files that are nonblocking, report -EAGAIN to calling functions Amit Shah
2010-04-05 12:45       ` [Qemu-devel] [PATCH 4/5] virtio-console: Factor out common init between console and generic ports Amit Shah
2010-04-05 12:45         ` [Qemu-devel] [PATCH 5/5] virtio-console: Throttle virtio-serial-bus if we can't consume any more guest data Amit Shah
2010-04-06  7:45           ` [Qemu-devel] " Gerd Hoffmann
2010-04-05 16:33   ` [Qemu-devel] [PATCH 1/5] char: Let the caller know how many bytes were written in case of incomplete writes Paul Brook
2010-04-06  3:24     ` Amit Shah
2010-04-06  9:34       ` Paul Brook
2010-04-06  9:58         ` Amit Shah
2010-04-06 10:21           ` Gerd Hoffmann
2010-04-06 11:05             ` Amit Shah
2010-04-06 11:16               ` Gerd Hoffmann
2010-04-06 13:30                 ` Jamie Lokier
2010-04-06  7:40   ` [Qemu-devel] " Gerd Hoffmann
2010-04-06  7:54     ` Amit Shah
2010-04-06  7:36 ` [Qemu-devel] Re: [PATCH 0/5] chardev, virtio-console: flow control, error handling Gerd Hoffmann
2010-04-06  7:52   ` Amit Shah
2010-04-06  8:17     ` Gerd Hoffmann
2010-04-06  8:28       ` Amit Shah

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).