Skip to content

Commit fb5e31d

Browse files
Christoph Hellwigmstsirkin
authored andcommitted
virtio: allow drivers to request IRQ affinity when creating VQs
Add a struct irq_affinity pointer to the find_vqs methods, which if set is used to tell the PCI layer to create the MSI-X vectors for our I/O virtqueues with the proper affinity from the start. Compared to after the fact affinity hints this gives us an instantly working setup and allows to allocate the irq descritors node-local and avoid interconnect traffic. Last but not least this will allow blk-mq queues are created based on the interrupt affinity for storage drivers. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
1 parent 52a6151 commit fb5e31d

20 files changed

Lines changed: 48 additions & 34 deletions

File tree

‎drivers/block/virtio_blk.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,8 @@ static int init_vq(struct virtio_blk *vblk)
411411
}
412412

413413
/* Discover virtqueues and write information to configuration. */
414-
err = vdev->config->find_vqs(vdev, num_vqs, vqs, callbacks, names);
414+
err = vdev->config->find_vqs(vdev, num_vqs, vqs, callbacks, names,
415+
NULL);
415416
if (err)
416417
goto out;
417418

‎drivers/char/virtio_console.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1939,7 +1939,7 @@ static int init_vqs(struct ports_device *portdev)
19391939
/* Find the queues. */
19401940
err = portdev->vdev->config->find_vqs(portdev->vdev, nr_queues, vqs,
19411941
io_callbacks,
1942-
(const char **)io_names);
1942+
(const char **)io_names, NULL);
19431943
if (err)
19441944
goto free;
19451945

‎drivers/crypto/virtio/virtio_crypto_core.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ static int virtcrypto_find_vqs(struct virtio_crypto *vi)
119119
}
120120

121121
ret = vi->vdev->config->find_vqs(vi->vdev, total_vqs, vqs, callbacks,
122-
names);
122+
names, NULL);
123123
if (ret)
124124
goto err_find;
125125

‎drivers/gpu/drm/virtio/virtgpu_kms.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ int virtio_gpu_driver_load(struct drm_device *dev, unsigned long flags)
172172
vgdev->has_virgl_3d ? "enabled" : "not available");
173173

174174
ret = vgdev->vdev->config->find_vqs(vgdev->vdev, 2, vqs,
175-
callbacks, names);
175+
callbacks, names, NULL);
176176
if (ret) {
177177
DRM_ERROR("failed to find virt queues\n");
178178
goto err_vqs;

‎drivers/misc/mic/vop/vop_main.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ static struct virtqueue *vop_find_vq(struct virtio_device *dev,
374374
static int vop_find_vqs(struct virtio_device *dev, unsigned nvqs,
375375
struct virtqueue *vqs[],
376376
vq_callback_t *callbacks[],
377-
const char * const names[])
377+
const char * const names[], struct irq_affinity *desc)
378378
{
379379
struct _vop_vdev *vdev = to_vopvdev(dev);
380380
struct vop_device *vpdev = vdev->vpdev;

‎drivers/net/caif/caif_virtio.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,8 @@ static int cfv_probe(struct virtio_device *vdev)
679679
goto err;
680680

681681
/* Get the TX virtio ring. This is a "guest side vring". */
682-
err = vdev->config->find_vqs(vdev, 1, &cfv->vq_tx, &vq_cbs, &names);
682+
err = vdev->config->find_vqs(vdev, 1, &cfv->vq_tx, &vq_cbs, &names,
683+
NULL);
683684
if (err)
684685
goto err;
685686

‎drivers/net/virtio_net.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2003,7 +2003,7 @@ static int virtnet_find_vqs(struct virtnet_info *vi)
20032003
}
20042004

20052005
ret = vi->vdev->config->find_vqs(vi->vdev, total_vqs, vqs, callbacks,
2006-
names);
2006+
names, NULL);
20072007
if (ret)
20082008
goto err_find;
20092009

‎drivers/remoteproc/remoteproc_virtio.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ static void rproc_virtio_del_vqs(struct virtio_device *vdev)
137137
static int rproc_virtio_find_vqs(struct virtio_device *vdev, unsigned int nvqs,
138138
struct virtqueue *vqs[],
139139
vq_callback_t *callbacks[],
140-
const char * const names[])
140+
const char * const names[],
141+
struct irq_affinity *desc)
141142
{
142143
int i, ret;
143144

‎drivers/rpmsg/virtio_rpmsg_bus.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ static int rpmsg_probe(struct virtio_device *vdev)
869869
init_waitqueue_head(&vrp->sendq);
870870

871871
/* We expect two virtqueues, rx and tx (and in this order) */
872-
err = vdev->config->find_vqs(vdev, 2, vqs, vq_cbs, names);
872+
err = vdev->config->find_vqs(vdev, 2, vqs, vq_cbs, names, NULL);
873873
if (err)
874874
goto free_vrp;
875875

‎drivers/s390/virtio/kvm_virtio.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,8 @@ static void kvm_del_vqs(struct virtio_device *vdev)
255255
static int kvm_find_vqs(struct virtio_device *vdev, unsigned nvqs,
256256
struct virtqueue *vqs[],
257257
vq_callback_t *callbacks[],
258-
const char * const names[])
258+
const char * const names[],
259+
struct irq_affinity *desc)
259260
{
260261
struct kvm_device *kdev = to_kvmdev(vdev);
261262
int i;

0 commit comments

Comments
 (0)