All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Jens Axboe <axboe@kernel.dk>,
	"Martin K . Petersen" <martin.petersen@oracle.com>
Cc: linux-block@vger.kernel.org,
	James Bottomley <James.Bottomley@HansenPartnership.com>,
	linux-scsi@vger.kernel.org, Bart Van Assche <bvanassche@acm.org>,
	Hannes Reinecke <hare@suse.com>,
	John Garry <john.garry@huawei.com>,
	Keith Busch <keith.busch@intel.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Don Brace <don.brace@microsemi.com>,
	Kashyap Desai <kashyap.desai@broadcom.com>,
	Sathya Prakash <sathya.prakash@broadcom.com>,
	Christoph Hellwig <hch@lst.de>, Ming Lei <ming.lei@redhat.com>
Subject: [PATCH V2 2/5] blk-mq: introduce .complete_queue_affinity
Date: Mon, 27 May 2019 23:02:04 +0800	[thread overview]
Message-ID: <20190527150207.11372-3-ming.lei@redhat.com> (raw)
In-Reply-To: <20190527150207.11372-1-ming.lei@redhat.com>

Some SCSI devices support single hw queue(tags), meantime allow
multiple private complete queues for handling request delivery &
completion. And mapping between CPU and private completion queue is
setup via pci_alloc_irq_vectors_affinity(PCI_IRQ_AFFINITY), just
like normal blk-mq's queue mapping.

Introduce .complete_queue_affinity callback for getting the
complete queue's affinity, so that we can drain in-flight requests
delivered from the complete queue if last CPU of the completion queue
becomes offline.

Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 include/linux/blk-mq.h | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 15d1aa53d96c..56f2e2ed62a7 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -140,7 +140,8 @@ typedef int (poll_fn)(struct blk_mq_hw_ctx *);
 typedef int (map_queues_fn)(struct blk_mq_tag_set *set);
 typedef bool (busy_fn)(struct request_queue *);
 typedef void (complete_fn)(struct request *);
-
+typedef const struct cpumask *(hctx_complete_queue_affinity_fn)(
+		struct blk_mq_hw_ctx *, int);
 
 struct blk_mq_ops {
 	/*
@@ -207,6 +208,15 @@ struct blk_mq_ops {
 
 	map_queues_fn		*map_queues;
 
+	/*
+	 * Some SCSI devices support private complete queue, returns
+	 * affinity of the complete queue, and the passed 'cpu' parameter
+	 * has to be included in the complete queue's affinity cpumask, and
+	 * used to figure out the mapped reply queue. If NULL is returns,
+	 * it means this hctx hasn't private completion queues.
+	 */
+	hctx_complete_queue_affinity_fn *complete_queue_affinity;
+
 #ifdef CONFIG_BLK_DEBUG_FS
 	/*
 	 * Used by the debugfs implementation to show driver-specific
-- 
2.20.1


  parent reply	other threads:[~2019-05-27 15:02 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-27 15:02 [PATCH V2 0/5] blk-mq: Wait for for hctx inflight requests on CPU unplug Ming Lei
2019-05-27 15:02 ` [PATCH V2 1/5] scsi: select reply queue from request's CPU Ming Lei
2019-05-28  5:43   ` Hannes Reinecke
2019-05-28 10:33   ` John Garry
2019-05-29  2:36     ` Ming Lei
2019-05-27 15:02 ` Ming Lei [this message]
2019-05-27 15:02 ` [PATCH V2 3/5] scsi: core: implement callback of .complete_queue_affinity Ming Lei
2019-05-27 15:02 ` [PATCH V2 4/5] scsi: implement .complete_queue_affinity Ming Lei
2019-05-27 15:02 ` [PATCH V2 5/5] blk-mq: Wait for for hctx inflight requests on CPU unplug Ming Lei
2019-05-28 16:50   ` John Garry
2019-05-29  2:28     ` Ming Lei
2019-05-29  2:42       ` Ming Lei
2019-05-29  9:42         ` John Garry
2019-05-29 10:10           ` Ming Lei
2019-05-29 15:33             ` Ming Lei
2019-05-29 16:10               ` John Garry
2019-05-30  2:28                 ` Ming Lei
2019-05-30  4:11                   ` Ming Lei
2019-05-30  9:31                   ` John Garry
2019-05-30  9:45                     ` Ming Lei

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=20190527150207.11372-3-ming.lei@redhat.com \
    --to=ming.lei@redhat.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=don.brace@microsemi.com \
    --cc=hare@suse.com \
    --cc=hch@lst.de \
    --cc=john.garry@huawei.com \
    --cc=kashyap.desai@broadcom.com \
    --cc=keith.busch@intel.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=sathya.prakash@broadcom.com \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.