From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Hajnoczi Subject: Re: [PATCH 3/3] virtio-pci: don't poll masked vectors Date: Wed, 19 Dec 2012 13:35:31 +0100 Message-ID: <20121219123531.GD6498@stefanha-thinkpad.redhat.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Asias He , qemu-devel@nongnu.org, Marcelo Tosatti , Jan Kiszka , Peter Maydell , kvm@vger.kernel.org To: "Michael S. Tsirkin" Return-path: Received: from mail-we0-f174.google.com ([74.125.82.174]:54362 "EHLO mail-we0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750781Ab2LSMkf (ORCPT ); Wed, 19 Dec 2012 07:40:35 -0500 Received: by mail-we0-f174.google.com with SMTP id x10so901935wey.5 for ; Wed, 19 Dec 2012 04:40:34 -0800 (PST) Content-Disposition: inline In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: 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