qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH V3 09/14] virtio: introduce vector to virtqueues


From: Cornelia Huck
Subject: Re: [Qemu-devel] [PATCH V3 09/14] virtio: introduce vector to virtqueues mapping
Date: Fri, 6 Mar 2015 13:55:44 +0100

On Thu,  5 Mar 2015 13:48:46 +0800
Jason Wang <address@hidden> wrote:

> Currently we will try to traverse all virtqueues to find a subset that
> using a specific vector. This is sub optimal when we will support
> hundreds or even thousands of virtqueues. So this patch introduces a
> method which could be used by transport to get all virtqueues that
> using a same vector. This is done through QLISTs and the number of
> QLISTs was queried through a transport specific method. When guest
> setting vectors, the virtqueue will be linked and helpers for traverse
> the list was also introduced.
> 
> The first user will be virtio pci which will use this to speed up
> MSI-X masking and unmasking handling.

Will there be any users beyond virtio-pci, though? For virtio-ccw, at
least, "vectors" are an identity mapping of the queue index. I'm not
sure if introducing (memory) overhead for everyone is worth it.

> 
> Cc: Anthony Liguori <address@hidden>
> Cc: Michael S. Tsirkin <address@hidden>
> Signed-off-by: Jason Wang <address@hidden>
> ---
>  hw/virtio/virtio-pci.c         |  8 ++++++++
>  hw/virtio/virtio.c             | 32 ++++++++++++++++++++++++++++++--
>  include/hw/virtio/virtio-bus.h |  1 +
>  include/hw/virtio/virtio.h     |  3 +++
>  4 files changed, 42 insertions(+), 2 deletions(-)
> 

>  void virtio_queue_set_vector(VirtIODevice *vdev, int n, uint16_t vector)
>  {
> -    if (n < virtio_get_queue_max(vdev))
> +    VirtQueue *vq = &vdev->vq[n];
> +
> +    if (n < virtio_get_queue_max(vdev)) {
> +        if (vdev->vq[n].vector != VIRTIO_NO_VECTOR) {
> +            QLIST_REMOVE(vq, node);
> +        }
>          vdev->vq[n].vector = vector;
> +        if (vector != VIRTIO_NO_VECTOR) {
> +            QLIST_INSERT_HEAD(&vdev->vector_queues[vector], vq, node);
> +        }
> +    }
>  }

Is there any way to remove an entry? E.g., if the guest unassociates
virtqueues. (I just noticed I probably need to use VIRTIO_NO_VECTOR
instead of 0 for that case in ccw.)

Or maybe I'm completely misunderstanding what vectors are doing on
pci :)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]