> > > - qemu_chr_write(vcon->chr, buf, len); > > > + ret = qemu_chr_write(vcon->chr, buf, len); > > > + if (ret == -EAGAIN) { > > > + virtio_serial_throttle_port(port, true); > > > + } > > > > > > } > > > > This looks wrong. It will loose data in the case of a partial write > > (i.e. ret < len) > > That doesn't happen currently (qemu_chr_write doesn't return a value > 0 > but < len). > > I had code in there to handle it, but that would change behaviour for > current users of qemu_chr_write(), which is a risk.
Doesn't that make the code almost completely pointless? Allowing EAGAIN without allowing short writes means that the writes will still block for arbitrarily long periods of time. You're relying on the kernel blocking at the same point the guest happens to split a DMA block. If you're transferring any significant quantities of data the chances of that happening seem pretty slim. Paul