[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 :)
- [Qemu-devel] [PATCH V3 06/14] virtio-serial-bus: switch to bus specific queue limit, (continued)
[Qemu-devel] [PATCH V3 07/14] virtio-mmio: switch to bus specific queue limit, Jason Wang, 2015/03/05
[Qemu-devel] [PATCH V3 09/14] virtio: introduce vector to virtqueues mapping, Jason Wang, 2015/03/05
- Re: [Qemu-devel] [PATCH V3 09/14] virtio: introduce vector to virtqueues mapping,
Cornelia Huck <=
[Qemu-devel] [PATCH V3 11/14] virtio-pci: speedup MSI-X masking and unmasking, Jason Wang, 2015/03/05
[Qemu-devel] [PATCH V3 10/14] virtio: introduce virtio_queue_get_index(), Jason Wang, 2015/03/05
[Qemu-devel] [PATCH V3 12/14] virtio-pci: increase the maximum number of virtqueues to 513, Jason Wang, 2015/03/05
[Qemu-devel] [PATCH V3 14/14] virtio-pci: introduce auto_msix_bar_size property, Jason Wang, 2015/03/05
[Qemu-devel] [PATCH V3 13/14] pci: remove hard-coded bar size in msix_init_exclusive_bar(), Jason Wang, 2015/03/05
Re: [Qemu-devel] [PATCH V3 00/14] Support more virtio queues, Michael S. Tsirkin, 2015/03/12