From: Christoph Hellwig <hch@lst.de>
To: mst@redhat.com, jasowang@redhat.com
Cc: axboe@kernel.dk, pbonzini@redhat.com,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org
Subject: [PATCH 8/9] virtio_blk: use virtio IRQ affinity
Date: Fri, 27 Jan 2017 09:16:36 +0100 [thread overview]
Message-ID: <1485504997-17584-9-git-send-email-hch@lst.de> (raw)
In-Reply-To: <1485504997-17584-1-git-send-email-hch@lst.de>
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 c54118b..1028dfe 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.1.4
next prev parent reply other threads:[~2017-01-27 8:16 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-27 8:16 automatic IRQ affinity for virtio V2 Christoph Hellwig
2017-01-27 8:16 ` [PATCH 1/9] virtio_pci: remove struct virtio_pci_vq_info Christoph Hellwig
2017-02-03 7:54 ` Jason Wang
[not found] ` <a5568074-d92e-8322-6955-19c640006fda@redhat.com>
2017-02-03 8:22 ` Christoph Hellwig
2017-01-27 8:16 ` [PATCH 2/9] virtio_pci: use shared interrupts for virtqueues Christoph Hellwig
2017-02-03 7:54 ` Jason Wang
[not found] ` <da34883b-1069-2cfc-aaa3-6aaf3ee0ebf2@redhat.com>
2017-02-03 8:26 ` Christoph Hellwig
2017-02-03 9:47 ` Jason Wang
2017-02-03 9:52 ` Christoph Hellwig
2017-02-03 9:56 ` Jason Wang
2017-01-27 8:16 ` [PATCH 3/9] virtio_pci: don't duplicate the msix_enable flag in struct pci_dev Christoph Hellwig
2017-02-03 7:56 ` Jason Wang
2017-01-27 8:16 ` [PATCH 4/9] virtio_pci: simplify MSI-X setup Christoph Hellwig
2017-02-03 7:57 ` Jason Wang
2017-01-27 8:16 ` [PATCH 5/9] virtio: allow drivers to request IRQ affinity when creating VQs Christoph Hellwig
2017-02-03 8:01 ` Jason Wang
2017-01-27 8:16 ` [PATCH 6/9] virtio: provide a method to get the IRQ affinity mask for a virtqueue Christoph Hellwig
2017-02-03 8:02 ` Jason Wang
2017-01-27 8:16 ` [PATCH 7/9] blk-mq: provide a default queue mapping for virtio device Christoph Hellwig
2017-01-27 8:16 ` Christoph Hellwig [this message]
2017-01-27 8:16 ` [PATCH 9/9] virtio_scsi: use virtio IRQ affinity Christoph Hellwig
[not found] <20170205171526.6224-1-hch@lst.de>
2017-02-05 17:15 ` [PATCH 8/9] virtio_blk: " Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1485504997-17584-9-git-send-email-hch@lst.de \
--to=hch@lst.de \
--cc=axboe@kernel.dk \
--cc=jasowang@redhat.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=virtualization@lists.linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).