From: Bart Van Assche <bvanassche@acm.org>
To: "Martin K . Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org, Jaegeuk Kim <jaegeuk@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
Bart Van Assche <bvanassche@acm.org>,
Hannes Reinecke <hare@suse.de>,
John Garry <john.garry@huawei.com>,
"James E.J. Bottomley" <jejb@linux.ibm.com>
Subject: [PATCH 05/11] scsi: core: Add support for reserved tags
Date: Tue, 9 Nov 2021 16:44:34 -0800 [thread overview]
Message-ID: <20211110004440.3389311-6-bvanassche@acm.org> (raw)
In-Reply-To: <20211110004440.3389311-1-bvanassche@acm.org>
Allow SCSI LLDs to allocate reserved tags by passing the BLK_MQ_REQ_RESERVED
flag to blk_mq_alloc_request().
Cc: Hannes Reinecke <hare@suse.de>
Cc: John Garry <john.garry@huawei.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/scsi_lib.c | 4 +++-
include/scsi/scsi_host.h | 9 ++++++++-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 43151e5d07ab..51d4ae1a5b16 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1916,6 +1916,7 @@ int scsi_mq_setup_tags(struct Scsi_Host *shost)
{
unsigned int cmd_size, sgl_size;
struct blk_mq_tag_set *tag_set = &shost->tag_set;
+ unsigned int reserved_tags = shost->hostt->reserved_tags;
sgl_size = max_t(unsigned int, sizeof(struct scatterlist),
scsi_mq_inline_sgl_size(shost));
@@ -1931,7 +1932,8 @@ int scsi_mq_setup_tags(struct Scsi_Host *shost)
tag_set->ops = &scsi_mq_ops_no_commit;
tag_set->nr_hw_queues = shost->nr_hw_queues ? : 1;
tag_set->nr_maps = shost->nr_maps ? : 1;
- tag_set->queue_depth = shost->can_queue;
+ tag_set->queue_depth = shost->can_queue + reserved_tags;
+ tag_set->reserved_tags = reserved_tags;
tag_set->cmd_size = cmd_size;
tag_set->numa_node = NUMA_NO_NODE;
tag_set->flags = BLK_MQ_F_SHOULD_MERGE;
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index ebe059badba0..0fa3ee73501a 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -367,10 +367,17 @@ struct scsi_host_template {
/*
* This determines if we will use a non-interrupt driven
* or an interrupt driven scheme. It is set to the maximum number
- * of simultaneous commands a single hw queue in HBA will accept.
+ * of simultaneous commands a single hw queue in HBA will accept. Does
+ * not include @reserved_tags.
*/
int can_queue;
+ /*
+ * Number of tags to reserve. A reserved tag can be allocated by passing
+ * the BLK_MQ_REQ_RESERVED flag to blk_get_request().
+ */
+ unsigned reserved_tags;
+
/*
* In many instances, especially where disconnect / reconnect are
* supported, our host also has an ID on the SCSI bus. If this is
next prev parent reply other threads:[~2021-11-10 0:45 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-10 0:44 [PATCH 00/11] UFS patches for kernel v5.17 Bart Van Assche
2021-11-10 0:44 ` [PATCH 01/11] scsi: ufs: Rename a function argument Bart Van Assche
2021-11-10 1:28 ` Chanho Park
2021-11-11 16:59 ` Alim Akhtar
2021-11-10 0:44 ` [PATCH 02/11] scsi: ufs: Remove is_rpmb_wlun() Bart Van Assche
2021-11-10 17:47 ` Asutosh Das (asd)
2021-11-11 16:52 ` Alim Akhtar
2021-11-10 0:44 ` [PATCH 03/11] scsi: ufs: Remove the sdev_rpmb member Bart Van Assche
2021-11-10 17:50 ` Asutosh Das (asd)
2021-11-11 16:47 ` Alim Akhtar
2021-11-10 0:44 ` [PATCH 04/11] scsi: ufs: Remove dead code Bart Van Assche
2021-11-11 7:06 ` Avri Altman
2021-11-15 15:58 ` Bean Huo
2021-11-15 16:01 ` Bean Huo
2021-11-10 0:44 ` Bart Van Assche [this message]
2021-11-10 0:44 ` [PATCH 06/11] scsi: ufs: Rework ufshcd_change_queue_depth() Bart Van Assche
2021-11-11 7:22 ` Avri Altman
2021-11-15 18:27 ` Bart Van Assche
2021-11-10 0:44 ` [PATCH 07/11] scsi: ufs: Fix a deadlock in the error handler Bart Van Assche
2021-11-10 6:42 ` Christoph Hellwig
2021-11-15 18:28 ` Bart Van Assche
2021-11-11 7:33 ` Avri Altman
2021-11-15 18:29 ` Bart Van Assche
2021-11-10 0:44 ` [PATCH 08/11] scsi: ufs: Improve SCSI abort handling further Bart Van Assche
2021-11-10 8:57 ` Adrian Hunter
2021-11-10 18:56 ` Bart Van Assche
2021-11-12 10:56 ` Adrian Hunter
2021-11-15 23:09 ` Bart Van Assche
2021-11-16 9:03 ` Adrian Hunter
2021-11-16 16:07 ` Bart Van Assche
2021-11-11 9:17 ` Peter Wang
2021-11-16 9:07 ` Peter Wang
2021-11-16 16:08 ` Bart Van Assche
2021-11-16 20:16 ` Adrian Hunter
2021-11-16 21:53 ` Bart Van Assche
2021-11-17 7:37 ` Adrian Hunter
2021-11-10 0:44 ` [PATCH 09/11] scsi: ufs: Fix a kernel crash during shutdown Bart Van Assche
2021-11-11 7:48 ` Avri Altman
2021-11-15 18:45 ` Bart Van Assche
2021-11-10 0:44 ` [PATCH 10/11] scsi: ufs: Optimize the command queueing code Bart Van Assche
2021-11-10 8:04 ` Adrian Hunter
2021-11-10 18:57 ` Bart Van Assche
2021-11-11 7:51 ` Avri Altman
2021-11-12 23:40 ` Asutosh Das (asd)
2021-11-10 0:44 ` [PATCH 11/11] scsi: ufs: Implement polling support Bart Van Assche
2021-11-10 1:36 ` Douglas Gilbert
2021-11-19 19:39 ` Bart Van Assche
2021-11-11 8:11 ` Avri Altman
2021-11-19 19:01 ` Bart Van Assche
[not found] ` <CGME20211110004503epcas2p420544000401f38525f70bac1528623ee@epcms2p4>
2021-11-10 9:48 ` [PATCH 01/11] scsi: ufs: Rename a function argument Keoseong Park
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=20211110004440.3389311-6-bvanassche@acm.org \
--to=bvanassche@acm.org \
--cc=adrian.hunter@intel.com \
--cc=hare@suse.de \
--cc=jaegeuk@kernel.org \
--cc=jejb@linux.ibm.com \
--cc=john.garry@huawei.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/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).