From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51778) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6JFL-00068C-O5 for qemu-devel@nongnu.org; Mon, 05 Aug 2013 07:46:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V6JFF-0003fP-PK for qemu-devel@nongnu.org; Mon, 05 Aug 2013 07:46:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57374) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6JFF-0003fC-I8 for qemu-devel@nongnu.org; Mon, 05 Aug 2013 07:46:37 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r75BkZuJ017033 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 5 Aug 2013 07:46:36 -0400 Message-ID: <51FF9130.3030201@redhat.com> Date: Mon, 05 Aug 2013 13:49:04 +0200 From: Laszlo Ersek MIME-Version: 1.0 References: <1375690705-17266-1-git-send-email-ghammer@redhat.com> In-Reply-To: <1375690705-17266-1-git-send-email-ghammer@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] virtio: Do not notify virtqueue if no element was pushed back. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gal Hammer Cc: qemu-devel@nongnu.org On 08/05/13 10:18, Gal Hammer wrote: > Signed-off-by: Gal Hammer > --- > 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