From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:38936) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R3juR-0008G3-I8 for qemu-devel@nongnu.org; Wed, 14 Sep 2011 03:29:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R3juQ-0005cn-9v for qemu-devel@nongnu.org; Wed, 14 Sep 2011 03:29:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49211) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R3juP-0005ce-V9 for qemu-devel@nongnu.org; Wed, 14 Sep 2011 03:29:26 -0400 From: Amit Shah Date: Wed, 14 Sep 2011 12:59:06 +0530 Message-Id: In-Reply-To: References: In-Reply-To: References: Subject: [Qemu-devel] [PATCH 2/3] virtio-serial-bus: discard data in already popped-out elem List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Amit Shah , Juan Quintela , qemu list , Markus Armbruster 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 --- 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