* [Qemu-devel] [PATCH v2] virtio-serial: Do not notify virtqueue if no element was pushed back.
@ 2013-08-11 13:25 Gal Hammer
2013-08-12 13:34 ` Laszlo Ersek
2013-09-05 19:05 ` Amit Shah
0 siblings, 2 replies; 3+ messages in thread
From: Gal Hammer @ 2013-08-11 13:25 UTC (permalink / raw)
To: qemu-devel; +Cc: Gal Hammer
The redundant notification caused the Windows' driver to duplicate the
pending write request's buffer. The driver was fixed, but I think this
change is still required.
Signed-off-by: Gal Hammer <ghammer@redhat.com>
---
hw/char/virtio-serial-bus.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c
index da417c7..0d38b4b 100644
--- a/hw/char/virtio-serial-bus.c
+++ b/hw/char/virtio-serial-bus.c
@@ -105,6 +105,7 @@ static void do_flush_queued_data(VirtIOSerialPort *port, VirtQueue *vq,
VirtIODevice *vdev)
{
VirtIOSerialPortClass *vsc;
+ bool elem_pushed = false;
assert(port);
assert(virtio_queue_ready(vq));
@@ -145,9 +146,12 @@ static void do_flush_queued_data(VirtIOSerialPort *port, VirtQueue *vq,
break;
}
virtqueue_push(vq, &port->elem, 0);
+ elem_pushed = true;
port->elem.out_num = 0;
}
- virtio_notify(vdev, vq);
+ if (elem_pushed) {
+ virtio_notify(vdev, vq);
+ }
}
static void flush_queued_data(VirtIOSerialPort *port)
--
1.8.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH v2] virtio-serial: Do not notify virtqueue if no element was pushed back.
2013-08-11 13:25 [Qemu-devel] [PATCH v2] virtio-serial: Do not notify virtqueue if no element was pushed back Gal Hammer
@ 2013-08-12 13:34 ` Laszlo Ersek
2013-09-05 19:05 ` Amit Shah
1 sibling, 0 replies; 3+ messages in thread
From: Laszlo Ersek @ 2013-08-12 13:34 UTC (permalink / raw)
To: Gal Hammer; +Cc: qemu-devel
On 08/11/13 15:25, Gal Hammer wrote:
> The redundant notification caused the Windows' driver to duplicate the
> pending write request's buffer. The driver was fixed, but I think this
> change is still required.
>
> Signed-off-by: Gal Hammer <ghammer@redhat.com>
> ---
> hw/char/virtio-serial-bus.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c
> index da417c7..0d38b4b 100644
> --- a/hw/char/virtio-serial-bus.c
> +++ b/hw/char/virtio-serial-bus.c
> @@ -105,6 +105,7 @@ static void do_flush_queued_data(VirtIOSerialPort *port, VirtQueue *vq,
> VirtIODevice *vdev)
> {
> VirtIOSerialPortClass *vsc;
> + bool elem_pushed = false;
>
> assert(port);
> assert(virtio_queue_ready(vq));
> @@ -145,9 +146,12 @@ static void do_flush_queued_data(VirtIOSerialPort *port, VirtQueue *vq,
> break;
> }
> virtqueue_push(vq, &port->elem, 0);
> + elem_pushed = true;
> port->elem.out_num = 0;
> }
> - virtio_notify(vdev, vq);
> + if (elem_pushed) {
> + virtio_notify(vdev, vq);
> + }
> }
>
> static void flush_queued_data(VirtIOSerialPort *port)
>
Differs from v1 only in a more precise subject / more details in the
commit msg.
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH v2] virtio-serial: Do not notify virtqueue if no element was pushed back.
2013-08-11 13:25 [Qemu-devel] [PATCH v2] virtio-serial: Do not notify virtqueue if no element was pushed back Gal Hammer
2013-08-12 13:34 ` Laszlo Ersek
@ 2013-09-05 19:05 ` Amit Shah
1 sibling, 0 replies; 3+ messages in thread
From: Amit Shah @ 2013-09-05 19:05 UTC (permalink / raw)
To: Gal Hammer; +Cc: qemu-devel
Hi,
On (Sun) 11 Aug 2013 [16:25:25], Gal Hammer wrote:
> The redundant notification caused the Windows' driver to duplicate the
> pending write request's buffer. The driver was fixed, but I think this
> change is still required.
>
> Signed-off-by: Gal Hammer <ghammer@redhat.com>
> ---
> hw/char/virtio-serial-bus.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c
> index da417c7..0d38b4b 100644
> --- a/hw/char/virtio-serial-bus.c
> +++ b/hw/char/virtio-serial-bus.c
> @@ -105,6 +105,7 @@ static void do_flush_queued_data(VirtIOSerialPort *port, VirtQueue *vq,
> VirtIODevice *vdev)
> {
> VirtIOSerialPortClass *vsc;
> + bool elem_pushed = false;
>
> assert(port);
> assert(virtio_queue_ready(vq));
> @@ -145,9 +146,12 @@ static void do_flush_queued_data(VirtIOSerialPort *port, VirtQueue *vq,
> break;
> }
> virtqueue_push(vq, &port->elem, 0);
> + elem_pushed = true;
> port->elem.out_num = 0;
> }
> - virtio_notify(vdev, vq);
> + if (elem_pushed) {
> + virtio_notify(vdev, vq);
> + }
> }
Can you describe when you hit this bug in the commit message?
I can imagine something like this happening when a fast guest is
sending lots of data, while the host is slow to catch up, e.g. the
host chardev is a file on disk, and that takes a while to flush the
data from the guest, filling the chardev buffer, and causing the flow
control to kick in. While in that state, if the guest writes more
data to the virtqueue, a few iterations would occur where the host
will not pop any item from the queue, and the guest is kicked
unnecessarily.
Is that what you're seeing? Your reply to v1 of the patch doesn't
quite say that clearly.
Patch looks good, thanks.
Amit
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-09-05 19:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-11 13:25 [Qemu-devel] [PATCH v2] virtio-serial: Do not notify virtqueue if no element was pushed back Gal Hammer
2013-08-12 13:34 ` Laszlo Ersek
2013-09-05 19:05 ` Amit Shah
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).