While discarding data previously any popped-out elem in the vq but not yet pushed into the guest because the backend was throttled wasn't pushed back into the guest. Fix that by checking if we had any in-progress elem, and pushing it out to the guest first before emptying the vq.
Signed-off-by: Amit Shah <amit.s...@redhat.com> --- hw/virtio-serial-bus.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c index 6838d73..2c84398 100644 --- a/hw/virtio-serial-bus.c +++ b/hw/virtio-serial-bus.c @@ -122,6 +122,10 @@ static void discard_vq_data(VirtIOSerialPort *port, VirtQueue *vq, if (!virtio_queue_ready(vq)) { return; } + if (port && port->elem.out_num) { + virtqueue_push(vq, &port->elem, 0); + port->elem.out_num = 0; + } while (virtqueue_pop(vq, &elem)) { virtqueue_push(vq, &elem, 0); } -- 1.7.6