Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1573938

[PATCH 8/9] virtio_blk: use virtio IRQ affinity

From Christoph Hellwig <hch@lst.de>
Newsgroups linux.kernel
Subject [PATCH 8/9] virtio_blk: use virtio IRQ affinity
Date 2017-02-05 18:20 +0100
Message-ID <t7yDM-1Lc-15@gated-at.bofh.it> (permalink)
References <t7yDL-1Lc-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Use automatic IRQ affinity assignment in the virtio layer if available,
and build the blk-mq queues based on it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/virtio_blk.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index c54118bdc67d..1028dfeb5a7f 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -5,6 +5,7 @@
 #include <linux/hdreg.h>
 #include <linux/module.h>
 #include <linux/mutex.h>
+#include <linux/interrupt.h>
 #include <linux/virtio.h>
 #include <linux/virtio_blk.h>
 #include <linux/scatterlist.h>
@@ -12,6 +13,7 @@
 #include <scsi/scsi_cmnd.h>
 #include <linux/idr.h>
 #include <linux/blk-mq.h>
+#include <linux/blk-mq-virtio.h>
 #include <linux/numa.h>
 
 #define PART_BITS 4
@@ -385,6 +387,7 @@ static int init_vq(struct virtio_blk *vblk)
 	struct virtqueue **vqs;
 	unsigned short num_vqs;
 	struct virtio_device *vdev = vblk->vdev;
+	struct irq_affinity desc = { 0, };
 
 	err = virtio_cread_feature(vdev, VIRTIO_BLK_F_MQ,
 				   struct virtio_blk_config, num_queues,
@@ -412,7 +415,7 @@ static int init_vq(struct virtio_blk *vblk)
 
 	/* Discover virtqueues and write information to configuration.  */
 	err = vdev->config->find_vqs(vdev, num_vqs, vqs, callbacks, names,
-			NULL);
+			&desc);
 	if (err)
 		goto out;
 
@@ -543,10 +546,18 @@ static int virtblk_init_request(void *data, struct request *rq,
 	return 0;
 }
 
+static int virtblk_map_queues(struct blk_mq_tag_set *set)
+{
+	struct virtio_blk *vblk = set->driver_data;
+
+	return blk_mq_virtio_map_queues(set, vblk->vdev, 0);
+}
+
 static struct blk_mq_ops virtio_mq_ops = {
 	.queue_rq	= virtio_queue_rq,
 	.complete	= virtblk_request_done,
 	.init_request	= virtblk_init_request,
+	.map_queues	= virtblk_map_queues,
 };
 
 static unsigned int virtblk_queue_depth;
-- 
2.11.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

automatic IRQ affinity for virtio V3 Christoph Hellwig <hch@lst.de> - 2017-02-05 18:20 +0100
  [PATCH 9/9] virtio_scsi: use virtio IRQ affinity Christoph Hellwig <hch@lst.de> - 2017-02-05 18:20 +0100
  [PATCH 7/9] blk-mq: provide a default queue mapping for virtio device Christoph Hellwig <hch@lst.de> - 2017-02-05 18:20 +0100
  [PATCH 8/9] virtio_blk: use virtio IRQ affinity Christoph Hellwig <hch@lst.de> - 2017-02-05 18:20 +0100
  [PATCH 1/9] virtio_pci: remove struct virtio_pci_vq_info Christoph Hellwig <hch@lst.de> - 2017-02-05 18:20 +0100
    Re: [PATCH 1/9] virtio_pci: remove struct virtio_pci_vq_info Jason Wang <jasowang@redhat.com> - 2017-02-07 08:20 +0100
      Re: [PATCH 1/9] virtio_pci: remove struct virtio_pci_vq_info Christoph Hellwig <hch@lst.de> - 2017-02-07 10:40 +0100
        Re: [PATCH 1/9] virtio_pci: remove struct virtio_pci_vq_info Jason Wang <jasowang@redhat.com> - 2017-02-08 04:00 +0100
  [PATCH 6/9] virtio: provide a method to get the IRQ affinity mask for a virtqueue Christoph Hellwig <hch@lst.de> - 2017-02-05 18:20 +0100
  [PATCH 2/9] virtio_pci: use shared interrupts for virtqueues Christoph Hellwig <hch@lst.de> - 2017-02-05 18:20 +0100
    Re: [PATCH 2/9] virtio_pci: use shared interrupts for virtqueues Jason Wang <jasowang@redhat.com> - 2017-02-07 08:20 +0100
  [PATCH 4/9] virtio_pci: simplify MSI-X setup Christoph Hellwig <hch@lst.de> - 2017-02-05 18:20 +0100
  [PATCH 3/9] virtio_pci: don't duplicate the msix_enable flag in struct pci_dev Christoph Hellwig <hch@lst.de> - 2017-02-05 18:20 +0100
  Re: automatic IRQ affinity for virtio V3 Christoph Hellwig <hch@infradead.org> - 2017-02-09 15:10 +0100
    Re: automatic IRQ affinity for virtio V3 "Michael S. Tsirkin" <mst@redhat.com> - 2017-02-09 17:10 +0100

csiph-web