qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qemu:virtio: Allow guest to defer VIRTIO_F_NOTIFY_ON_EMPTY
@ 2009-03-19 16:21 Alex Williamson
  2009-03-20 17:31 ` [Qemu-devel] " Anthony Liguori
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Williamson @ 2009-03-19 16:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: alex.williamson, kvm

There may be cases where the guest does not want the avail queue
interrupt, even when it's empty.  For the virtio-net case, the
guest may use a different buffering scheme or decide polling for
used buffers is more efficient.  This can be accomplished by simply
checking for whether the guest has acknowledged the existing notify
on empty flag.

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
---

 hw/virtio.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/hw/virtio.c b/hw/virtio.c
index b94ab0f..08ea16d 100644
--- a/hw/virtio.c
+++ b/hw/virtio.c
@@ -726,9 +726,10 @@ VirtQueue *virtio_add_queue(VirtIODevice *vdev, int queue_size,
 
 void virtio_notify(VirtIODevice *vdev, VirtQueue *vq)
 {
-    /* Always notify when queue is empty */
-    if ((vq->inuse || vring_avail_idx(vq) != vq->last_avail_idx) &&
-        (vring_avail_flags(vq) & VRING_AVAIL_F_NO_INTERRUPT))
+    /* Always notify when queue is empty (when feature acknowledge) */
+    if ((vring_avail_flags(vq) & VRING_AVAIL_F_NO_INTERRUPT) &&
+        (!(vdev->features & (1 << VIRTIO_F_NOTIFY_ON_EMPTY)) ||
+         (vq->inuse || vring_avail_idx(vq) != vq->last_avail_idx)))
         return;
 
     vdev->isr |= 0x01;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Qemu-devel] Re: [PATCH] qemu:virtio: Allow guest to defer VIRTIO_F_NOTIFY_ON_EMPTY
  2009-03-19 16:21 [Qemu-devel] [PATCH] qemu:virtio: Allow guest to defer VIRTIO_F_NOTIFY_ON_EMPTY Alex Williamson
@ 2009-03-20 17:31 ` Anthony Liguori
  0 siblings, 0 replies; 2+ messages in thread
From: Anthony Liguori @ 2009-03-20 17:31 UTC (permalink / raw)
  To: Alex Williamson; +Cc: qemu-devel, kvm

Alex Williamson wrote:
> There may be cases where the guest does not want the avail queue
> interrupt, even when it's empty.  For the virtio-net case, the
> guest may use a different buffering scheme or decide polling for
> used buffers is more efficient.  This can be accomplished by simply
> checking for whether the guest has acknowledged the existing notify
> on empty flag.
>
> Signed-off-by: Alex Williamson <alex.williamson@hp.com>
>   

Applied to trunk and stable.  Thanks.

Regards,

Anthony Liguori

>   

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-03-20 17:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-19 16:21 [Qemu-devel] [PATCH] qemu:virtio: Allow guest to defer VIRTIO_F_NOTIFY_ON_EMPTY Alex Williamson
2009-03-20 17:31 ` [Qemu-devel] " Anthony Liguori

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).