All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme/fc: use real sqsize as argument when connecting queues
@ 2020-03-13 12:48 Hannes Reinecke
  2020-03-13 20:24 ` Sagi Grimberg
  2020-03-16 17:48 ` Keith Busch
  0 siblings, 2 replies; 6+ messages in thread
From: Hannes Reinecke @ 2020-03-13 12:48 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Hannes Reinecke, linux-nvme, Sagi Grimberg, Keith Busch, James Smart

When creating queues we should be passing in the real sqsize number,
and not increasing it by one just so that the function has to
substract it again.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/nvme/host/fc.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index 0cbc4a703359..f76325a47578 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -1211,7 +1211,7 @@ nvme_fc_connect_admin_queue(struct nvme_fc_ctrl *ctrl,
 				sizeof(struct fcnvme_lsdesc_cr_assoc_cmd));
 
 	assoc_rqst->assoc_cmd.ersp_ratio = cpu_to_be16(ersp_ratio);
-	assoc_rqst->assoc_cmd.sqsize = cpu_to_be16(qsize - 1);
+	assoc_rqst->assoc_cmd.sqsize = cpu_to_be16(qsize);
 	/* Linux supports only Dynamic controllers */
 	assoc_rqst->assoc_cmd.cntlid = cpu_to_be16(0xffff);
 	uuid_copy(&assoc_rqst->assoc_cmd.hostid, &ctrl->ctrl.opts->host->id);
@@ -1326,7 +1326,7 @@ nvme_fc_connect_queue(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue,
 				sizeof(struct fcnvme_lsdesc_cr_conn_cmd));
 	conn_rqst->connect_cmd.ersp_ratio = cpu_to_be16(ersp_ratio);
 	conn_rqst->connect_cmd.qid  = cpu_to_be16(queue->qnum);
-	conn_rqst->connect_cmd.sqsize = cpu_to_be16(qsize - 1);
+	conn_rqst->connect_cmd.sqsize = cpu_to_be16(qsize);
 
 	lsop->queue = queue;
 	lsreq->rqstaddr = conn_rqst;
@@ -2484,11 +2484,11 @@ nvme_fc_create_io_queues(struct nvme_fc_ctrl *ctrl)
 		goto out_free_tag_set;
 	}
 
-	ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.sqsize + 1);
+	ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.sqsize);
 	if (ret)
 		goto out_cleanup_blk_queue;
 
-	ret = nvme_fc_connect_io_queues(ctrl, ctrl->ctrl.sqsize + 1);
+	ret = nvme_fc_connect_io_queues(ctrl, ctrl->ctrl.sqsize);
 	if (ret)
 		goto out_delete_hw_queues;
 
@@ -2539,11 +2539,11 @@ nvme_fc_recreate_io_queues(struct nvme_fc_ctrl *ctrl)
 	if (ctrl->ctrl.queue_count == 1)
 		return 0;
 
-	ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.sqsize + 1);
+	ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.sqsize);
 	if (ret)
 		goto out_free_io_queues;
 
-	ret = nvme_fc_connect_io_queues(ctrl, ctrl->ctrl.sqsize + 1);
+	ret = nvme_fc_connect_io_queues(ctrl, ctrl->ctrl.sqsize);
 	if (ret)
 		goto out_delete_hw_queues;
 
-- 
2.16.4


_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] nvme/fc: use real sqsize as argument when connecting queues
  2020-03-13 12:48 [PATCH] nvme/fc: use real sqsize as argument when connecting queues Hannes Reinecke
@ 2020-03-13 20:24 ` Sagi Grimberg
  2020-03-14 14:45   ` Hannes Reinecke
  2020-03-16 17:48 ` Keith Busch
  1 sibling, 1 reply; 6+ messages in thread
From: Sagi Grimberg @ 2020-03-13 20:24 UTC (permalink / raw)
  To: Hannes Reinecke, Christoph Hellwig; +Cc: Keith Busch, linux-nvme, James Smart


On 3/13/20 5:48 AM, Hannes Reinecke wrote:
> When creating queues we should be passing in the real sqsize number,
> and not increasing it by one just so that the function has to
> substract it again.

Kinda makes more sense to pass around actual queue size and
not the zero-based version of it, isn't it?


> 
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
>   drivers/nvme/host/fc.c | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
> index 0cbc4a703359..f76325a47578 100644
> --- a/drivers/nvme/host/fc.c
> +++ b/drivers/nvme/host/fc.c
> @@ -1211,7 +1211,7 @@ nvme_fc_connect_admin_queue(struct nvme_fc_ctrl *ctrl,
>   				sizeof(struct fcnvme_lsdesc_cr_assoc_cmd));
>   
>   	assoc_rqst->assoc_cmd.ersp_ratio = cpu_to_be16(ersp_ratio);
> -	assoc_rqst->assoc_cmd.sqsize = cpu_to_be16(qsize - 1);
> +	assoc_rqst->assoc_cmd.sqsize = cpu_to_be16(qsize);
>   	/* Linux supports only Dynamic controllers */
>   	assoc_rqst->assoc_cmd.cntlid = cpu_to_be16(0xffff);
>   	uuid_copy(&assoc_rqst->assoc_cmd.hostid, &ctrl->ctrl.opts->host->id);
> @@ -1326,7 +1326,7 @@ nvme_fc_connect_queue(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue,
>   				sizeof(struct fcnvme_lsdesc_cr_conn_cmd));
>   	conn_rqst->connect_cmd.ersp_ratio = cpu_to_be16(ersp_ratio);
>   	conn_rqst->connect_cmd.qid  = cpu_to_be16(queue->qnum);
> -	conn_rqst->connect_cmd.sqsize = cpu_to_be16(qsize - 1);
> +	conn_rqst->connect_cmd.sqsize = cpu_to_be16(qsize);
>   
>   	lsop->queue = queue;
>   	lsreq->rqstaddr = conn_rqst;
> @@ -2484,11 +2484,11 @@ nvme_fc_create_io_queues(struct nvme_fc_ctrl *ctrl)
>   		goto out_free_tag_set;
>   	}
>   
> -	ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.sqsize + 1);
> +	ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.sqsize);

What if the LLDD will allocate based on this argument?

>   	if (ret)
>   		goto out_cleanup_blk_queue;
>   
> -	ret = nvme_fc_connect_io_queues(ctrl, ctrl->ctrl.sqsize + 1);
> +	ret = nvme_fc_connect_io_queues(ctrl, ctrl->ctrl.sqsize);
>   	if (ret)
>   		goto out_delete_hw_queues;
>   
> @@ -2539,11 +2539,11 @@ nvme_fc_recreate_io_queues(struct nvme_fc_ctrl *ctrl)
>   	if (ctrl->ctrl.queue_count == 1)
>   		return 0;
>   
> -	ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.sqsize + 1);
> +	ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.sqsize);
>   	if (ret)
>   		goto out_free_io_queues;
>   
> -	ret = nvme_fc_connect_io_queues(ctrl, ctrl->ctrl.sqsize + 1);
> +	ret = nvme_fc_connect_io_queues(ctrl, ctrl->ctrl.sqsize);
>   	if (ret)
>   		goto out_delete_hw_queues;
>   
> 

_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] nvme/fc: use real sqsize as argument when connecting queues
  2020-03-13 20:24 ` Sagi Grimberg
@ 2020-03-14 14:45   ` Hannes Reinecke
  0 siblings, 0 replies; 6+ messages in thread
From: Hannes Reinecke @ 2020-03-14 14:45 UTC (permalink / raw)
  To: Sagi Grimberg, Christoph Hellwig; +Cc: Keith Busch, linux-nvme, James Smart

On 3/13/20 9:24 PM, Sagi Grimberg wrote:
> 
> On 3/13/20 5:48 AM, Hannes Reinecke wrote:
>> When creating queues we should be passing in the real sqsize number,
>> and not increasing it by one just so that the function has to
>> substract it again.
> 
> Kinda makes more sense to pass around actual queue size and
> not the zero-based version of it, isn't it?
> 
Oh, it would.
But then I would have expected ctrl->sqsize carrying the 'real' queue 
size. Which we currently don't (That why I've sent the other patch).

But calling a function with (arg + 1), just so that the function body 
does an 'arg - 1' internally is totally pointless.

What I'm aiming at with these patches is to keep ctrl->sqsize as the 
real (1-based)  size, to be converted to the wire format (0-based) when 
actually put on the wire.
And allocating the tagset with (ctrl-sqsize - 1) to cover the queue full 
detected as mandated by the spec.

I'll be reviewing the patches with that in mind and will be resending a 
new version.

Cheers,

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

_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] nvme/fc: use real sqsize as argument when connecting queues
  2020-03-13 12:48 [PATCH] nvme/fc: use real sqsize as argument when connecting queues Hannes Reinecke
  2020-03-13 20:24 ` Sagi Grimberg
@ 2020-03-16 17:48 ` Keith Busch
  2020-03-17 12:47   ` Christoph Hellwig
  2020-03-26 14:08   ` Himanshu Madhani
  1 sibling, 2 replies; 6+ messages in thread
From: Keith Busch @ 2020-03-16 17:48 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: James Smart, Keith Busch, Christoph Hellwig, linux-nvme, Sagi Grimberg

On Fri, Mar 13, 2020 at 01:48:08PM +0100, Hannes Reinecke wrote:
> When creating queues we should be passing in the real sqsize number,
> and not increasing it by one just so that the function has to
> substract it again.

Kind of makes me wonder: why are we even passing the sq size as a
parameter at all? The 'ctrl' parameter provides the same thing.

Anyway, this looks correct to me.

Reviewed-by: Keith Busch <kbusch@kernel.org>

> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
>  drivers/nvme/host/fc.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
> index 0cbc4a703359..f76325a47578 100644
> --- a/drivers/nvme/host/fc.c
> +++ b/drivers/nvme/host/fc.c
> @@ -1211,7 +1211,7 @@ nvme_fc_connect_admin_queue(struct nvme_fc_ctrl *ctrl,
>  				sizeof(struct fcnvme_lsdesc_cr_assoc_cmd));
>  
>  	assoc_rqst->assoc_cmd.ersp_ratio = cpu_to_be16(ersp_ratio);
> -	assoc_rqst->assoc_cmd.sqsize = cpu_to_be16(qsize - 1);
> +	assoc_rqst->assoc_cmd.sqsize = cpu_to_be16(qsize);
>  	/* Linux supports only Dynamic controllers */
>  	assoc_rqst->assoc_cmd.cntlid = cpu_to_be16(0xffff);
>  	uuid_copy(&assoc_rqst->assoc_cmd.hostid, &ctrl->ctrl.opts->host->id);
> @@ -1326,7 +1326,7 @@ nvme_fc_connect_queue(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue,
>  				sizeof(struct fcnvme_lsdesc_cr_conn_cmd));
>  	conn_rqst->connect_cmd.ersp_ratio = cpu_to_be16(ersp_ratio);
>  	conn_rqst->connect_cmd.qid  = cpu_to_be16(queue->qnum);
> -	conn_rqst->connect_cmd.sqsize = cpu_to_be16(qsize - 1);
> +	conn_rqst->connect_cmd.sqsize = cpu_to_be16(qsize);
>  
>  	lsop->queue = queue;
>  	lsreq->rqstaddr = conn_rqst;
> @@ -2484,11 +2484,11 @@ nvme_fc_create_io_queues(struct nvme_fc_ctrl *ctrl)
>  		goto out_free_tag_set;
>  	}
>  
> -	ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.sqsize + 1);
> +	ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.sqsize);
>  	if (ret)
>  		goto out_cleanup_blk_queue;
>  
> -	ret = nvme_fc_connect_io_queues(ctrl, ctrl->ctrl.sqsize + 1);
> +	ret = nvme_fc_connect_io_queues(ctrl, ctrl->ctrl.sqsize);
>  	if (ret)
>  		goto out_delete_hw_queues;
>  
> @@ -2539,11 +2539,11 @@ nvme_fc_recreate_io_queues(struct nvme_fc_ctrl *ctrl)
>  	if (ctrl->ctrl.queue_count == 1)
>  		return 0;
>  
> -	ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.sqsize + 1);
> +	ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.sqsize);
>  	if (ret)
>  		goto out_free_io_queues;
>  
> -	ret = nvme_fc_connect_io_queues(ctrl, ctrl->ctrl.sqsize + 1);
> +	ret = nvme_fc_connect_io_queues(ctrl, ctrl->ctrl.sqsize);
>  	if (ret)
>  		goto out_delete_hw_queues;
>  
> -- 
> 2.16.4

_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] nvme/fc: use real sqsize as argument when connecting queues
  2020-03-16 17:48 ` Keith Busch
@ 2020-03-17 12:47   ` Christoph Hellwig
  2020-03-26 14:08   ` Himanshu Madhani
  1 sibling, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2020-03-17 12:47 UTC (permalink / raw)
  To: Keith Busch
  Cc: Sagi Grimberg, Keith Busch, James Smart, linux-nvme,
	Hannes Reinecke, Christoph Hellwig

On Mon, Mar 16, 2020 at 10:48:19AM -0700, Keith Busch wrote:
> On Fri, Mar 13, 2020 at 01:48:08PM +0100, Hannes Reinecke wrote:
> > When creating queues we should be passing in the real sqsize number,
> > and not increasing it by one just so that the function has to
> > substract it again.
> 
> Kind of makes me wonder: why are we even passing the sq size as a
> parameter at all? The 'ctrl' parameter provides the same thing.

Yes, please kill the parameter entirely instead.

_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] nvme/fc: use real sqsize as argument when connecting queues
  2020-03-16 17:48 ` Keith Busch
  2020-03-17 12:47   ` Christoph Hellwig
@ 2020-03-26 14:08   ` Himanshu Madhani
  1 sibling, 0 replies; 6+ messages in thread
From: Himanshu Madhani @ 2020-03-26 14:08 UTC (permalink / raw)
  To: Keith Busch, Hannes Reinecke
  Cc: Sagi Grimberg, linux-nvme, James Smart, Keith Busch, Christoph Hellwig

On 3/16/2020 12:48 PM, Keith Busch wrote:
> On Fri, Mar 13, 2020 at 01:48:08PM +0100, Hannes Reinecke wrote:
>> When creating queues we should be passing in the real sqsize number,
>> and not increasing it by one just so that the function has to
>> substract it again.
> 
> Kind of makes me wonder: why are we even passing the sq size as a
> parameter at all? The 'ctrl' parameter provides the same thing.
> 
> Anyway, this looks correct to me.
> 
> Reviewed-by: Keith Busch <kbusch@kernel.org>
> 
>> Signed-off-by: Hannes Reinecke <hare@suse.de>
>> ---
>>   drivers/nvme/host/fc.c | 12 ++++++------
>>   1 file changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
>> index 0cbc4a703359..f76325a47578 100644
>> --- a/drivers/nvme/host/fc.c
>> +++ b/drivers/nvme/host/fc.c
>> @@ -1211,7 +1211,7 @@ nvme_fc_connect_admin_queue(struct nvme_fc_ctrl *ctrl,
>>   				sizeof(struct fcnvme_lsdesc_cr_assoc_cmd));
>>   
>>   	assoc_rqst->assoc_cmd.ersp_ratio = cpu_to_be16(ersp_ratio);
>> -	assoc_rqst->assoc_cmd.sqsize = cpu_to_be16(qsize - 1);
>> +	assoc_rqst->assoc_cmd.sqsize = cpu_to_be16(qsize);
>>   	/* Linux supports only Dynamic controllers */
>>   	assoc_rqst->assoc_cmd.cntlid = cpu_to_be16(0xffff);
>>   	uuid_copy(&assoc_rqst->assoc_cmd.hostid, &ctrl->ctrl.opts->host->id);
>> @@ -1326,7 +1326,7 @@ nvme_fc_connect_queue(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue,
>>   				sizeof(struct fcnvme_lsdesc_cr_conn_cmd));
>>   	conn_rqst->connect_cmd.ersp_ratio = cpu_to_be16(ersp_ratio);
>>   	conn_rqst->connect_cmd.qid  = cpu_to_be16(queue->qnum);
>> -	conn_rqst->connect_cmd.sqsize = cpu_to_be16(qsize - 1);
>> +	conn_rqst->connect_cmd.sqsize = cpu_to_be16(qsize);
>>   
>>   	lsop->queue = queue;
>>   	lsreq->rqstaddr = conn_rqst;
>> @@ -2484,11 +2484,11 @@ nvme_fc_create_io_queues(struct nvme_fc_ctrl *ctrl)
>>   		goto out_free_tag_set;
>>   	}
>>   
>> -	ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.sqsize + 1);
>> +	ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.sqsize);
>>   	if (ret)
>>   		goto out_cleanup_blk_queue;
>>   
>> -	ret = nvme_fc_connect_io_queues(ctrl, ctrl->ctrl.sqsize + 1);
>> +	ret = nvme_fc_connect_io_queues(ctrl, ctrl->ctrl.sqsize);
>>   	if (ret)
>>   		goto out_delete_hw_queues;
>>   
>> @@ -2539,11 +2539,11 @@ nvme_fc_recreate_io_queues(struct nvme_fc_ctrl *ctrl)
>>   	if (ctrl->ctrl.queue_count == 1)
>>   		return 0;
>>   
>> -	ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.sqsize + 1);
>> +	ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.sqsize);
>>   	if (ret)
>>   		goto out_free_io_queues;
>>   
>> -	ret = nvme_fc_connect_io_queues(ctrl, ctrl->ctrl.sqsize + 1);
>> +	ret = nvme_fc_connect_io_queues(ctrl, ctrl->ctrl.sqsize);
>>   	if (ret)
>>   		goto out_delete_hw_queues;
>>   
>> -- 
>> 2.16.4
> 
> _______________________________________________
> linux-nvme mailing list
> linux-nvme@lists.infradead.org
> https://urldefense.com/v3/__http://lists.infradead.org/mailman/listinfo/linux-nvme__;!!GqivPVa7Brio!Nq4LNDhkMZWjyk8xoSpCsvNM0d4IkwCW8FvAYtlC0EdnTSGaTFWKMr5Bo6B9vK2VAUxX$
> 

I lost track of original patch email. if its not too late.

Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>

_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-03-26 14:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-13 12:48 [PATCH] nvme/fc: use real sqsize as argument when connecting queues Hannes Reinecke
2020-03-13 20:24 ` Sagi Grimberg
2020-03-14 14:45   ` Hannes Reinecke
2020-03-16 17:48 ` Keith Busch
2020-03-17 12:47   ` Christoph Hellwig
2020-03-26 14:08   ` Himanshu Madhani

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.