From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:44761) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TlIs4-0005ed-0U for qemu-devel@nongnu.org; Wed, 19 Dec 2012 07:35:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TlIs2-0004mt-Rq for qemu-devel@nongnu.org; Wed, 19 Dec 2012 07:35:35 -0500 Received: from mail-we0-f171.google.com ([74.125.82.171]:38940) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TlIs2-0004mp-Ic for qemu-devel@nongnu.org; Wed, 19 Dec 2012 07:35:34 -0500 Received: by mail-we0-f171.google.com with SMTP id u3so937117wey.16 for ; Wed, 19 Dec 2012 04:35:33 -0800 (PST) Date: Wed, 19 Dec 2012 13:35:31 +0100 From: Stefan Hajnoczi Message-ID: <20121219123531.GD6498@stefanha-thinkpad.redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH 3/3] virtio-pci: don't poll masked vectors List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: Peter Maydell , kvm@vger.kernel.org, Jan Kiszka , Marcelo Tosatti , qemu-devel@nongnu.org, Asias He On Tue, Dec 18, 2012 at 02:39:19PM +0200, Michael S. Tsirkin wrote: > -static int virtio_pci_set_guest_notifier(DeviceState *d, int n, bool assign) > +static void kvm_virtio_pci_vector_poll(PCIDevice *dev, > + unsigned int vector_start, > + unsigned int vector_end) > +{ > + VirtIOPCIProxy *proxy = container_of(dev, VirtIOPCIProxy, pci_dev); > + VirtIODevice *vdev = proxy->vdev; > + int queue_no; > + unsigned int vector; > + EventNotifier *notifier; > + VirtQueue *vq; > + > + for (queue_no = 0; queue_no < VIRTIO_PCI_QUEUE_MAX; queue_no++) { > + if (!virtio_queue_get_num(vdev, queue_no)) { > + break; > + } > + vector = virtio_queue_vector(vdev, queue_no); > + if (vector < vector_start || vector >= vector_end || > + !msix_is_masked(dev, vector)) { > + continue; > + } > + vq = virtio_get_queue(vdev, queue_no); > + notifier = virtio_queue_get_guest_notifier(vq); > + if (event_notifier_test_and_clear(notifier)) { > + msix_set_pending(dev, vector); > + } Small difference to virtio_queue_guest_notifier_read() here: we do not set vq->vdev->isr |= 0x01. I guess no guest drivers use isr with MSIX but should we still set it or even just call virtio_queue_guest_notifier_read() instead of duplicating that event notifier read here? Stefan