Re: [PATCH 3/3] virtio-pci: don't poll masked vectors

Stefan Hajnoczi
2012-12-19T12:40:35Z

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