Message ID | 1583409280-158604-7-git-send-email-john.garry@huawei.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | blk-mq/scsi: Provide hostwide shared tags for SCSI HBAs | expand |
On 05/03/2020 11:54, John Garry wrote: > From: Hannes Reinecke <hare@suse.com> > > Add a host template flag 'host_tagset' so hostwide tagset can be > shared on multiple reply queues after the SCSI device's reply queue > is converted to blk-mq hw queue. We should also change the comment about Scsi_host.nr_hw_queues in include/scsi/scsi_host.h also, like this: * Note: it is assumed that each hardware queue has a queue depth of * can_queue. In other words, the total queue depth per host -* is nr_hw_queues * can_queue. +* is nr_hw_queues * can_queue. However, in the case of .host_tagset +* being set, the total queue depth per host is can_queue. > > Signed-off-by: Hannes Reinecke <hare@suse.com> > Signed-off-by: John Garry <john.garry@huawei.com> > --- > drivers/scsi/scsi_lib.c | 2 ++ > include/scsi/scsi_host.h | 3 +++ > 2 files changed, 5 insertions(+) > > diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c > index 610ee41fa54c..84788ccc2672 100644 > --- a/drivers/scsi/scsi_lib.c > +++ b/drivers/scsi/scsi_lib.c > @@ -1901,6 +1901,8 @@ int scsi_mq_setup_tags(struct Scsi_Host *shost) > shost->tag_set.flags = BLK_MQ_F_SHOULD_MERGE; > shost->tag_set.flags |= > BLK_ALLOC_POLICY_TO_MQ_FLAG(shost->hostt->tag_alloc_policy); > + if (shost->hostt->host_tagset) > + shost->tag_set.flags |= BLK_MQ_F_TAG_HCTX_SHARED; > shost->tag_set.driver_data = shost; > > return blk_mq_alloc_tag_set(&shost->tag_set); > diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h > index f577647bf5f2..4fd0af0883dd 100644 > --- a/include/scsi/scsi_host.h > +++ b/include/scsi/scsi_host.h > @@ -429,6 +429,9 @@ struct scsi_host_template { > /* True if the low-level driver supports blk-mq only */ > unsigned force_blk_mq:1; > > + /* True if the host uses host-wide tagspace */ > + unsigned host_tagset:1; > + > /* > * Countdown for host blocking with no commands outstanding. > */ >
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 610ee41fa54c..84788ccc2672 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1901,6 +1901,8 @@ int scsi_mq_setup_tags(struct Scsi_Host *shost) shost->tag_set.flags = BLK_MQ_F_SHOULD_MERGE; shost->tag_set.flags |= BLK_ALLOC_POLICY_TO_MQ_FLAG(shost->hostt->tag_alloc_policy); + if (shost->hostt->host_tagset) + shost->tag_set.flags |= BLK_MQ_F_TAG_HCTX_SHARED; shost->tag_set.driver_data = shost; return blk_mq_alloc_tag_set(&shost->tag_set); diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index f577647bf5f2..4fd0af0883dd 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -429,6 +429,9 @@ struct scsi_host_template { /* True if the low-level driver supports blk-mq only */ unsigned force_blk_mq:1; + /* True if the host uses host-wide tagspace */ + unsigned host_tagset:1; + /* * Countdown for host blocking with no commands outstanding. */