From patchwork Thu Mar 19 16:21:59 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Williamson X-Patchwork-Id: 13066 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n2JGPNmT030463 for ; Thu, 19 Mar 2009 16:25:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753856AbZCSQZW (ORCPT ); Thu, 19 Mar 2009 12:25:22 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753029AbZCSQZW (ORCPT ); Thu, 19 Mar 2009 12:25:22 -0400 Received: from g4t0016.houston.hp.com ([15.201.24.19]:38946 "EHLO g4t0016.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752746AbZCSQZV (ORCPT ); Thu, 19 Mar 2009 12:25:21 -0400 Received: from g1t0039.austin.hp.com (g1t0039.austin.hp.com [16.236.32.45]) by g4t0016.houston.hp.com (Postfix) with ESMTP id 285031464E; Thu, 19 Mar 2009 16:25:19 +0000 (UTC) Received: from ldl.fc.hp.com (ldl.fc.hp.com [15.11.146.30]) by g1t0039.austin.hp.com (Postfix) with ESMTP id 6683C3400F; Thu, 19 Mar 2009 16:25:19 +0000 (UTC) Received: from localhost (ldl.fc.hp.com [127.0.0.1]) by ldl.fc.hp.com (Postfix) with ESMTP id 2B0C239C00D; Thu, 19 Mar 2009 10:25:19 -0600 (MDT) X-Virus-Scanned: Debian amavisd-new at ldl.fc.hp.com Received: from ldl.fc.hp.com ([127.0.0.1]) by localhost (ldl.fc.hp.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HadXIey-Mfs4; Thu, 19 Mar 2009 10:25:18 -0600 (MDT) Received: from kvm.aw (lart.fc.hp.com [15.11.146.31]) by ldl.fc.hp.com (Postfix) with ESMTP id 06FCC39C008; Thu, 19 Mar 2009 10:25:18 -0600 (MDT) From: Alex Williamson Subject: [PATCH] qemu:virtio: Allow guest to defer VIRTIO_F_NOTIFY_ON_EMPTY To: qemu-devel@nongnu.org Cc: kvm@vger.kernel.org, alex.williamson@hp.com Date: Thu, 19 Mar 2009 10:21:59 -0600 Message-ID: <20090319162118.24068.98794.stgit@kvm.aw> User-Agent: StGIT/0.14.2 MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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 --- hw/virtio.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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;