Skip to content

Global fix / workaround usage of qemu_chr_fe_write

Daniel P. Berrange qemu-devel 2 versions – Applied

Status from this message: Queued for 2.8, thanks.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 2 repliesApplied
  2. v15 patches 4 repliesSuperseded

Changes in v2 from the cover letter

- Dropped virtio-console patch which already merged in 2.7

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/4impi: check return of qemu_chr_fe_write() for errorshw/ipmi/ipmi_bmc_extern.c+6 -20 replies
2/4sclpconsolelm: remove bogus check for -EAGAINhw/char/sclpconsole-lm.c+3 -150 replies
3/4hw: replace most use of qemu_chr_fe_write with qemu_chr_fe_write_allbackends/rng-egd.c gdbstub.c hw/arm/omap2.c +26 more+104 -270 replies
4/4char: convert qemu_chr_fe_write to qemu_chr_fe_write_allqemu-char.c+12 -62 replies

Reviews trailers per patch

1 of 4 patches has a Reviewed-by or Acked-by.

PatchCornelia Huck
1/4
2/4A-b
3/4
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [Qemu-devel] [PATCH v2 0/4] Global fix / workaround usage of qemu_chr_fe_write

This series does a global fix and/or workaround for bad usage of qemu_chr_fe_write(). Essentially only about 4/5 places in the code got the usage correct, by handling errors. Everything else would silently loose data if used with a chardev backend that can return EAGAIN. One specific instance of that bug was highlighted when I fixed the socket backend, such that in connect mode, it would be non-blocking. https://bugs.launchpad.net/qemu/+bug/1586756

The "correct" fix is to check for short writes, or EAGAIN and then schedule an event callback to re-try the write later. A couple of places do that correctly (for example hw/char/serial.c and hw/char/virtioconsole.c). Changing existing serial port impls todo this though is a fair amount of amount, so as a temporary fix, this series changes all the broken code to simply use qemu_chr_fe_write_all() instead. Thus we at least stop silently loosing data, albeit at the cost of blocking the guest execution while we wait. So we still need to do a proper fix in all these devices models at some point, hence I've left comments in the code as a reminder.

Changed in v2:

- Dropped virtio-console patch which already merged in 2.7

Daniel P. Berrange (4):
impi: check return of qemu_chr_fe_write() for errors
sclpconsolelm: remove bogus check for -EAGAIN
hw: replace most use of qemu_chr_fe_write with qemu_chr_fe_write_all
char: convert qemu_chr_fe_write to qemu_chr_fe_write_all

 backends/rng-egd.c          |  4 +++-
 gdbstub.c                   |  4 +++-
 hw/arm/omap2.c              |  8 +++++---
 hw/arm/pxa2xx.c             |  4 +++-
 hw/arm/strongarm.c          |  4 +++-
 hw/char/bcm2835_aux.c       |  4 +++-
 hw/char/debugcon.c          |  4 +++-
 hw/char/digic-uart.c        |  2 ++
 hw/char/escc.c              |  4 +++-
 hw/char/etraxfs_ser.c       |  4 +++-
 hw/char/exynos4210_uart.c   |  4 +++-
 hw/char/grlib_apbuart.c     |  4 +++-
 hw/char/imx_serial.c        |  4 +++-
 hw/char/ipoctal232.c        |  4 +++-
 hw/char/lm32_juart.c        |  2 ++
 hw/char/lm32_uart.c         |  2 ++
 hw/char/mcf_uart.c          |  4 +++-
 hw/char/parallel.c          |  4 +++-
 hw/char/pl011.c             |  4 +++-
 hw/char/sclpconsole-lm.c    | 22 ++++++----------------
 hw/char/sclpconsole.c       |  2 ++
 hw/char/sh_serial.c         |  4 +++-
 hw/char/spapr_vty.c         |  5 +++--
 hw/char/stm32f2xx_usart.c   |  2 ++
 hw/char/virtio-console.c    | 21 +++++++++++++++++++++
 hw/char/xilinx_uartlite.c   |  4 +++-
 hw/ipmi/ipmi_bmc_extern.c   |  8 ++++++--
 hw/usb/ccid-card-passthru.c |  7 +++++--
 hw/usb/dev-serial.c         |  4 +++-
 qemu-char.c                 | 18 ++++++++++++------
 slirp/slirp.c               |  4 +++-
 31 files changed, 125 insertions(+), 50 deletions(-)
Signature · 1 line
2.7.4