diff mbox

[2/8] scsi-mq: Add support for multiple hardware queues

Message ID 541C281E.9090206@acm.org (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Bart Van Assche Sept. 19, 2014, 12:57 p.m. UTC
Allow a SCSI LLD to declare how many hardware queues it supports
by setting Scsi_Host.nr_hw_queues before calling scsi_add_host().

Note: it is assumed that each hardware queue has a queue depth of
shost->can_queue. In other words, the total queue depth per host
is (number of hardware queues) * (shost->can_queue).

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Cc: Christoph Hellwig <hch@lst.de>
---
 drivers/scsi/scsi_lib.c  | 2 +-
 include/scsi/scsi_host.h | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

Comments

Sagi Grimberg Sept. 19, 2014, 6:05 p.m. UTC | #1
On 9/19/2014 3:57 PM, Bart Van Assche wrote:
> Allow a SCSI LLD to declare how many hardware queues it supports
> by setting Scsi_Host.nr_hw_queues before calling scsi_add_host().
>
> Note: it is assumed that each hardware queue has a queue depth of
> shost->can_queue. In other words, the total queue depth per host
> is (number of hardware queues) * (shost->can_queue).
>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> Cc: Christoph Hellwig <hch@lst.de>
> ---
>   drivers/scsi/scsi_lib.c  | 2 +-
>   include/scsi/scsi_host.h | 4 ++++
>   2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index d837dc1..b0b6117 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -2071,7 +2071,7 @@ int scsi_mq_setup_tags(struct Scsi_Host *shost)
>
>   memset(&shost->tag_set, 0, sizeof(shost->tag_set));
>   shost->tag_set.ops = &scsi_mq_ops;
> - shost->tag_set.nr_hw_queues = 1;
> + shost->tag_set.nr_hw_queues = shost->nr_hw_queues ? : 1;
>   shost->tag_set.queue_depth = shost->can_queue;
>   shost->tag_set.cmd_size = cmd_size;
>   shost->tag_set.numa_node = NUMA_NO_NODE;
> diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
> index ba20347..0a867d9 100644
> --- a/include/scsi/scsi_host.h
> +++ b/include/scsi/scsi_host.h
> @@ -638,6 +638,10 @@ struct Scsi_Host {
>   short unsigned int sg_prot_tablesize;
>   unsigned int max_sectors;
>   unsigned long dma_boundary;
> + /*
> + * In scsi-mq mode, the number of hardware queues supported by the LLD.
> + */
> + unsigned nr_hw_queues;
>   /*
>   * Used to assign serial numbers to the cmds.
>   * Protected by the host lock.
>

I think this patch should be squashed with passing LLD hctx patch (in
whatever form it ends up).
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Christoph Hellwig Sept. 19, 2014, 6:11 p.m. UTC | #2
On Fri, Sep 19, 2014 at 09:05:53PM +0300, Sagi Grimberg wrote:
> I think this patch should be squashed with passing LLD hctx patch (in
> whatever form it ends up).

Agreed.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ming Lei Sept. 26, 2014, 11:08 a.m. UTC | #3
On Sat, Sep 20, 2014 at 2:05 AM, Sagi Grimberg <sagig@dev.mellanox.co.il> wrote:
> On 9/19/2014 3:57 PM, Bart Van Assche wrote:
>> Allow a SCSI LLD to declare how many hardware queues it supports
>> by setting Scsi_Host.nr_hw_queues before calling scsi_add_host().
>>
>> Note: it is assumed that each hardware queue has a queue depth of
>> shost->can_queue. In other words, the total queue depth per host
>> is (number of hardware queues) * (shost->can_queue).
>>
>> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
>> Cc: Christoph Hellwig <hch@lst.de>
>> ---
>>   drivers/scsi/scsi_lib.c  | 2 +-
>>   include/scsi/scsi_host.h | 4 ++++
>>   2 files changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
>> index d837dc1..b0b6117 100644
>> --- a/drivers/scsi/scsi_lib.c
>> +++ b/drivers/scsi/scsi_lib.c
>> @@ -2071,7 +2071,7 @@ int scsi_mq_setup_tags(struct Scsi_Host *shost)
>>
>>   memset(&shost->tag_set, 0, sizeof(shost->tag_set));
>>   shost->tag_set.ops = &scsi_mq_ops;
>> - shost->tag_set.nr_hw_queues = 1;
>> + shost->tag_set.nr_hw_queues = shost->nr_hw_queues ? : 1;
>>   shost->tag_set.queue_depth = shost->can_queue;
>>   shost->tag_set.cmd_size = cmd_size;
>>   shost->tag_set.numa_node = NUMA_NO_NODE;
>> diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
>> index ba20347..0a867d9 100644
>> --- a/include/scsi/scsi_host.h
>> +++ b/include/scsi/scsi_host.h
>> @@ -638,6 +638,10 @@ struct Scsi_Host {
>>   short unsigned int sg_prot_tablesize;
>>   unsigned int max_sectors;
>>   unsigned long dma_boundary;
>> + /*
>> + * In scsi-mq mode, the number of hardware queues supported by the LLD.
>> + */
>> + unsigned nr_hw_queues;
>>   /*
>>   * Used to assign serial numbers to the cmds.
>>   * Protected by the host lock.
>>
>
> I think this patch should be squashed with passing LLD hctx patch (in
> whatever form it ends up).

I suggest to apply this patch and related scsi-mq multi hw-queue
enablement patches first, so that any scsi drivers capable of
multi hw-queue can go without waiting for passing hctx
patches which may take a bit long since lots of drivers are involved,
as Jens said, the mapping from req to hctx is quite cheap.


Thanks,
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Bart Van Assche Sept. 26, 2014, 2:02 p.m. UTC | #4
On 26/09/2014 5:08, Ming Lei wrote:
>
> I suggest to apply this patch and related scsi-mq multi hw-queue
> enablement patches first, so that any scsi drivers capable of
> multi hw-queue can go without waiting for passing hctx
> patches which may take a bit long since lots of drivers are involved,
> as Jens said, the mapping from req to hctx is quite cheap.

Hello Ming,

This week I have been traveling. I hope to find more time next week or 
the week after next week to rework this patch series and to address the 
feedback I have received from you, Jens, Christoph and Sagi.

Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index d837dc1..b0b6117 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -2071,7 +2071,7 @@  int scsi_mq_setup_tags(struct Scsi_Host *shost)
 
 	memset(&shost->tag_set, 0, sizeof(shost->tag_set));
 	shost->tag_set.ops = &scsi_mq_ops;
-	shost->tag_set.nr_hw_queues = 1;
+	shost->tag_set.nr_hw_queues = shost->nr_hw_queues ? : 1;
 	shost->tag_set.queue_depth = shost->can_queue;
 	shost->tag_set.cmd_size = cmd_size;
 	shost->tag_set.numa_node = NUMA_NO_NODE;
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index ba20347..0a867d9 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -638,6 +638,10 @@  struct Scsi_Host {
 	short unsigned int sg_prot_tablesize;
 	unsigned int max_sectors;
 	unsigned long dma_boundary;
+	/*
+	 * In scsi-mq mode, the number of hardware queues supported by the LLD.
+	 */
+	unsigned nr_hw_queues;
 	/* 
 	 * Used to assign serial numbers to the cmds.
 	 * Protected by the host lock.