Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LkhQm-0002kY-BF for qemu-devel@nongnu.org; Fri, 20 Mar 2009 12:18:48 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LkhQl-0002jP-HM for qemu-devel@nongnu.org; Fri, 20 Mar 2009 12:18:47 -0400 Received: from [199.232.76.173] (port=50777 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LkhQl-0002jF-As for qemu-devel@nongnu.org; Fri, 20 Mar 2009 12:18:47 -0400 Received: from savannah.gnu.org ([199.232.41.3]:39754 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LkhQl-0001ta-5E for qemu-devel@nongnu.org; Fri, 20 Mar 2009 12:18:47 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1LkhQk-0007gv-He for qemu-devel@nongnu.org; Fri, 20 Mar 2009 16:18:46 +0000 Received: from aliguori by cvs.savannah.gnu.org with local (Exim 4.69) (envelope-from ) id 1LkhQk-0007gr-8C for qemu-devel@nongnu.org; Fri, 20 Mar 2009 16:18:46 +0000 MIME-Version: 1.0 Errors-To: aliguori Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Anthony Liguori Message-Id: Date: Fri, 20 Mar 2009 16:18:46 +0000 Subject: [Qemu-devel] [6868] virtio: Allow guest to defer VIRTIO_F_NOTIFY_ON_EMPTY ( Alex Williamson) Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 6868 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6868 Author: aliguori Date: 2009-03-20 16:18:45 +0000 (Fri, 20 Mar 2009) Log Message: ----------- virtio: Allow guest to defer VIRTIO_F_NOTIFY_ON_EMPTY (Alex Williamson) 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 Signed-off-by: Anthony Liguori Modified Paths: -------------- branches/stable_0_10_0/hw/virtio.c Modified: branches/stable_0_10_0/hw/virtio.c =================================================================== --- branches/stable_0_10_0/hw/virtio.c 2009-03-20 16:18:39 UTC (rev 6867) +++ branches/stable_0_10_0/hw/virtio.c 2009-03-20 16:18:45 UTC (rev 6868) @@ -726,9 +726,10 @@ 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;