* [Qemu-devel] [PATCH 1/2] virtio-serial: Check if virtio queue is ready before consuming data
@ 2010-07-01 9:28 Amit Shah
2010-07-01 9:28 ` [Qemu-devel] [PATCH 2/2] virtio-serial: Assert for virtio queue ready before virtqueue operations Amit Shah
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Amit Shah @ 2010-07-01 9:28 UTC (permalink / raw)
To: qemu list; +Cc: Amit Shah
If a virtio-serial port is removed before the guest comes up and
initialises the virtqueues, qemu exits with the message
Guest moved used index from 0 to 61440
This happens because we try to clear any pending buffers from the
virtqueue.
Ensure the virtqueue is initialised before calling any virtqueue
operations.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
hw/virtio-serial-bus.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index 7f9d28f..b89daa6 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -139,6 +139,9 @@ static void flush_queued_data(VirtIOSerialPort *port, bool discard)
{
assert(port);
+ if (!virtio_queue_ready(port->ovq)) {
+ return;
+ }
do_flush_queued_data(port, port->ovq, &port->vser->vdev, discard);
}
--
1.7.0.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Qemu-devel] [PATCH 2/2] virtio-serial: Assert for virtio queue ready before virtqueue operations
2010-07-01 9:28 [Qemu-devel] [PATCH 1/2] virtio-serial: Check if virtio queue is ready before consuming data Amit Shah
@ 2010-07-01 9:28 ` Amit Shah
2010-07-14 13:23 ` [Qemu-devel] [PATCH 1/2] virtio-serial: Check if virtio queue is ready before consuming data Amit Shah
2010-07-14 14:39 ` Alon Levy
2 siblings, 0 replies; 4+ messages in thread
From: Amit Shah @ 2010-07-01 9:28 UTC (permalink / raw)
To: qemu list; +Cc: Amit Shah
In addition to the previous fix for calling do_flush_queued_data() only
when the virtqueue is ready, ensure do_flush_queued_data() gets a vq
that's suitably initialised.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
hw/virtio-serial-bus.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index b89daa6..93cffa2 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -117,6 +117,7 @@ static void do_flush_queued_data(VirtIOSerialPort *port, VirtQueue *vq,
VirtQueueElement elem;
assert(port || discard);
+ assert(virtio_queue_ready(vq));
while ((discard || !port->throttled) && virtqueue_pop(vq, &elem)) {
uint8_t *buf;
--
1.7.0.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH 1/2] virtio-serial: Check if virtio queue is ready before consuming data
2010-07-01 9:28 [Qemu-devel] [PATCH 1/2] virtio-serial: Check if virtio queue is ready before consuming data Amit Shah
2010-07-01 9:28 ` [Qemu-devel] [PATCH 2/2] virtio-serial: Assert for virtio queue ready before virtqueue operations Amit Shah
@ 2010-07-14 13:23 ` Amit Shah
2010-07-14 14:39 ` Alon Levy
2 siblings, 0 replies; 4+ messages in thread
From: Amit Shah @ 2010-07-14 13:23 UTC (permalink / raw)
To: qemu list
On (Thu) Jul 01 2010 [14:58:16], Amit Shah wrote:
> If a virtio-serial port is removed before the guest comes up and
> initialises the virtqueues, qemu exits with the message
>
> Guest moved used index from 0 to 61440
>
> This happens because we try to clear any pending buffers from the
> virtqueue.
>
> Ensure the virtqueue is initialised before calling any virtqueue
> operations.
>
> Signed-off-by: Amit Shah <amit.shah@redhat.com>
Ping (for patches 1 and 2)
Amit
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH 1/2] virtio-serial: Check if virtio queue is ready before consuming data
2010-07-01 9:28 [Qemu-devel] [PATCH 1/2] virtio-serial: Check if virtio queue is ready before consuming data Amit Shah
2010-07-01 9:28 ` [Qemu-devel] [PATCH 2/2] virtio-serial: Assert for virtio queue ready before virtqueue operations Amit Shah
2010-07-14 13:23 ` [Qemu-devel] [PATCH 1/2] virtio-serial: Check if virtio queue is ready before consuming data Amit Shah
@ 2010-07-14 14:39 ` Alon Levy
2 siblings, 0 replies; 4+ messages in thread
From: Alon Levy @ 2010-07-14 14:39 UTC (permalink / raw)
To: Amit Shah; +Cc: qemu list
----- "Amit Shah" <amit.shah@redhat.com> wrote:
> If a virtio-serial port is removed before the guest comes up and
> initialises the virtqueues, qemu exits with the message
>
> Guest moved used index from 0 to 61440
>
> This happens because we try to clear any pending buffers from the
> virtqueue.
>
> Ensure the virtqueue is initialised before calling any virtqueue
> operations.
>
> Signed-off-by: Amit Shah <amit.shah@redhat.com>
> ---
> hw/virtio-serial-bus.c | 3 +++
> 1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
> index 7f9d28f..b89daa6 100644
> --- a/hw/virtio-serial-bus.c
> +++ b/hw/virtio-serial-bus.c
> @@ -139,6 +139,9 @@ static void flush_queued_data(VirtIOSerialPort
> *port, bool discard)
> {
> assert(port);
>
> + if (!virtio_queue_ready(port->ovq)) {
> + return;
> + }
> do_flush_queued_data(port, port->ovq, &port->vser->vdev,
> discard);
> }
>
> --
> 1.7.0.1
ACK series
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-07-14 14:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-01 9:28 [Qemu-devel] [PATCH 1/2] virtio-serial: Check if virtio queue is ready before consuming data Amit Shah
2010-07-01 9:28 ` [Qemu-devel] [PATCH 2/2] virtio-serial: Assert for virtio queue ready before virtqueue operations Amit Shah
2010-07-14 13:23 ` [Qemu-devel] [PATCH 1/2] virtio-serial: Check if virtio queue is ready before consuming data Amit Shah
2010-07-14 14:39 ` Alon Levy
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).