qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] virtio: Do not notify virtqueue if no element w


From: Laszlo Ersek
Subject: Re: [Qemu-devel] [PATCH] virtio: Do not notify virtqueue if no element was pushed back.
Date: Mon, 05 Aug 2013 13:49:04 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130621 Thunderbird/17.0.7

On 08/05/13 10:18, Gal Hammer wrote:
> Signed-off-by: Gal Hammer <address@hidden>
> ---
>  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)
> 

I could be missing something, but it looks good to me.

BTW the subject should say: "virtio-serial: ...", not generic "virtio: ...".

How did you catch this? Is this a performance problem, or did it expose
a guest driver bug? (The guest driver should be prepared for spurious
wakeups.)

Reviewed-by: Laszlo Ersek <address@hidden>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]