Re: [PATCH 1/2] scsi: core: Add support for reserved tags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/3/21 1:05 AM, Bart Van Assche wrote:
Allow SCSI LLDs to allocate reserved tags by passing the BLK_MQ_REQ_RESERVED
flag to blk_get_request().

Cc: Hannes Reinecke <hare@xxxxxxx>
Cc: John Garry <john.garry@xxxxxxxxxx>
Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx>
---
  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 d0b7c6dc74f8..1cbade5fe990 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1917,6 +1917,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));
@@ -1932,7 +1933,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 97cdad14de56..5502fcb306db 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

This is essentially the same patch as I posted a while ago (cf https://lore.kernel.org/linux-scsi/20210222132405.91369-1- hare@xxxxxxx/).

But there had been push-back on that series as it would also try to use a scsi host device for driver-internal commands.

Maybe we should combine our efforts; patch 2 is equivalent to your patch, and 3-5 are a conversion of the fnic driver to use those commands. So we should merge our efforts to get this thing off the ground.

For the remainder of the patchset I'm currently working on a solution to address the upstream concerns.

Cheers,

Hannes
--
Dr. Hannes Reinecke                Kernel Storage Architect
hare@xxxxxxx                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux