Hello, This refreshed series adds support for non-blocking chardev writes if the caller asks for it.
This series does away with the special qemu_chr_write_nb() call that did nonblocking writes. Instead, now the writes are nonblocking if the caller registers a callback function with the chardev that indicates a driver became writable. Individual drivers too have to be modified a bit to update their fd handlers for nonblocking writes to work. This series has non-blocking support for the unix and tcp drivers. The virtio-console code is tweaked to use this facility. This helps a fast guest slow down in case of a slow host reader. The worst-case condition was a guest writing data to a chardev that wasn't being read from resulting in the guest getting unresponsive. Amit Shah (7): virtio-console: Factor out common init between console and generic ports char: Add a QemuChrHandlers struct to initialise chardev handlers char: Introduce char_set/remove_fd_handlers() char: Add framework for a 'write unblocked' callback char: Update send_all() to handle nonblocking chardev write requests char: Equip the unix/tcp backend to handle nonblocking writes virtio-console: Enable port throttling when chardev is slow to consume data gdbstub.c | 9 ++- hw/debugcon.c | 2 +- hw/escc.c | 9 ++- hw/etraxfs_ser.c | 13 +++- hw/ivshmem.c | 28 ++++++-- hw/mcf_uart.c | 9 ++- hw/pl011.c | 9 ++- hw/pxa2xx.c | 13 +++- hw/serial.c | 9 ++- hw/sh_serial.c | 12 +++- hw/syborg_serial.c | 9 ++- hw/usb-serial.c | 9 ++- hw/virtio-console.c | 53 +++++++++----- hw/xen_console.c | 16 +++-- hw/xilinx_uartlite.c | 11 +++- monitor.c | 19 ++++- net/slirp.c | 8 ++- net/socket.c | 4 +- qemu-char.c | 190 ++++++++++++++++++++++++++++++++++++++++---------- qemu-char.h | 17 ++++- qemu_socket.h | 2 +- 21 files changed, 343 insertions(+), 108 deletions(-) -- 1.7.3.2