All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv1 0/1] fix sg_tablesize calculation in iser
@ 2017-01-16 17:44 Max Gurtovoy
       [not found] ` <1484588681-12987-1-git-send-email-maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Max Gurtovoy @ 2017-01-16 17:44 UTC (permalink / raw)
  To: swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW,
	sagi-NQWnxTmZq1alnMjI0IkVqw, hch-jcswGhMUV9g,
	dledford-H+wXaHxf7aLQT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: Max Gurtovoy

Hi Guys,
I've noticed that we set the sg_tablesize wrongly in iser
because of the unsigned short casting (still haven't checked other ULPs).
This can cause performance degredation since each IO is divided into
4k chunks or less (sg_nents=1).
I think we need to cc stable kernel since v4.3, right ?

Max Gurtovoy (1):
  IB/iser: Fix sg_tablesize calculation

 drivers/infiniband/ulp/iser/iscsi_iser.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

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

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

* [PATCHv1 1/1] IB/iser: Fix sg_tablesize calculation
       [not found] ` <1484588681-12987-1-git-send-email-maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
@ 2017-01-16 17:44   ` Max Gurtovoy
       [not found]     ` <1484588681-12987-2-git-send-email-maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Max Gurtovoy @ 2017-01-16 17:44 UTC (permalink / raw)
  To: swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW,
	sagi-NQWnxTmZq1alnMjI0IkVqw, hch-jcswGhMUV9g,
	dledford-H+wXaHxf7aLQT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: Max Gurtovoy

For devices that can register page list that is bigger than
USHRT_MAX, we actually take the wrong value for sg_tablesize.
E.g: for CX4 max_fast_reg_page_list_len is 65536 (bigger than USHRT_MAX)
so we set sg_tablesize to 0 by mistake. Therefore, each IO that is
bigger than 4k splitted to "< 4k" chunks that cause performance degredation.

Fixes: 7854550ae6d8 ("RDMA/iser: Limit sgs to the device fastreg depth")
Signed-off-by: Max Gurtovoy <maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 drivers/infiniband/ulp/iser/iscsi_iser.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c
index 9104e6b..ff37f19 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.c
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.c
@@ -656,7 +656,8 @@ static void iscsi_iser_cleanup_task(struct iscsi_task *task)
 		 * max fastreg page list length.
 		 */
 		shost->sg_tablesize = min_t(unsigned short, shost->sg_tablesize,
-			ib_conn->device->ib_device->attrs.max_fast_reg_page_list_len);
+				      min_t(unsigned int, USHRT_MAX,
+			ib_conn->device->ib_device->attrs.max_fast_reg_page_list_len));
 
 		if (iscsi_host_add(shost,
 				   ib_conn->device->ib_device->dma_device)) {
-- 
1.7.1

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

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

* Re: [PATCHv1 1/1] IB/iser: Fix sg_tablesize calculation
       [not found]     ` <1484588681-12987-2-git-send-email-maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
@ 2017-01-16 21:03       ` Sagi Grimberg
       [not found]         ` <cd6691fd-11b4-dbf3-3ec4-12ff97bc515a-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Sagi Grimberg @ 2017-01-16 21:03 UTC (permalink / raw)
  To: Max Gurtovoy, swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW,
	hch-jcswGhMUV9g, dledford-H+wXaHxf7aLQT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA


> For devices that can register page list that is bigger than
> USHRT_MAX, we actually take the wrong value for sg_tablesize.
> E.g: for CX4 max_fast_reg_page_list_len is 65536 (bigger than USHRT_MAX)
> so we set sg_tablesize to 0 by mistake. Therefore, each IO that is
> bigger than 4k splitted to "< 4k" chunks that cause performance degredation.
>
> Fixes: 7854550ae6d8 ("RDMA/iser: Limit sgs to the device fastreg depth")
> Signed-off-by: Max Gurtovoy <maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> ---
>  drivers/infiniband/ulp/iser/iscsi_iser.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c
> index 9104e6b..ff37f19 100644
> --- a/drivers/infiniband/ulp/iser/iscsi_iser.c
> +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c
> @@ -656,7 +656,8 @@ static void iscsi_iser_cleanup_task(struct iscsi_task *task)
>  		 * max fastreg page list length.
>  		 */

Hi Max,

>  		shost->sg_tablesize = min_t(unsigned short, shost->sg_tablesize,
> -			ib_conn->device->ib_device->attrs.max_fast_reg_page_list_len);
> +				      min_t(unsigned int, USHRT_MAX,
> +			ib_conn->device->ib_device->attrs.max_fast_reg_page_list_len));

Hmm, This looks broken since I fixed up mlx5 capability at:
911f4331bc87 ("IB/mlx5: Expose correct max_fast_reg_page_list_len")

However, I suspect this assignment should be removed altogether because
we already take that into account in the address resolution handler,
there the min statement is for unsigned and casted back to ushrt.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* RE: [PATCHv1 1/1] IB/iser: Fix sg_tablesize calculation
       [not found]         ` <cd6691fd-11b4-dbf3-3ec4-12ff97bc515a-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
@ 2017-01-16 21:17           ` Steve Wise
  2017-01-16 21:31             ` Sagi Grimberg
  2017-01-17  9:57           ` Max Gurtovoy
  1 sibling, 1 reply; 6+ messages in thread
From: Steve Wise @ 2017-01-16 21:17 UTC (permalink / raw)
  To: 'Sagi Grimberg', 'Max Gurtovoy',
	hch-jcswGhMUV9g, dledford-H+wXaHxf7aLQT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA

> > diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c
> b/drivers/infiniband/ulp/iser/iscsi_iser.c
> > index 9104e6b..ff37f19 100644
> > --- a/drivers/infiniband/ulp/iser/iscsi_iser.c
> > +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c
> > @@ -656,7 +656,8 @@ static void iscsi_iser_cleanup_task(struct iscsi_task
*task)
> >  		 * max fastreg page list length.
> >  		 */
> 
> Hi Max,
> 
> >  		shost->sg_tablesize = min_t(unsigned short, shost->sg_tablesize,
> > -			ib_conn->device->ib_device-
> >attrs.max_fast_reg_page_list_len);
> > +				      min_t(unsigned int, USHRT_MAX,
> > +			ib_conn->device->ib_device-
> >attrs.max_fast_reg_page_list_len));
> 
> Hmm, This looks broken since I fixed up mlx5 capability at:
> 911f4331bc87 ("IB/mlx5: Expose correct max_fast_reg_page_list_len")
> 
> However, I suspect this assignment should be removed altogether because
> we already take that into account in the address resolution handler,
> there the min statement is for unsigned and casted back to ushrt.

Hey Sagi, where is the code to which you refer?   "address resolution handler?"

Thanks,

Steve

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

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

* Re: [PATCHv1 1/1] IB/iser: Fix sg_tablesize calculation
  2017-01-16 21:17           ` Steve Wise
@ 2017-01-16 21:31             ` Sagi Grimberg
  0 siblings, 0 replies; 6+ messages in thread
From: Sagi Grimberg @ 2017-01-16 21:31 UTC (permalink / raw)
  To: Steve Wise, 'Max Gurtovoy',
	hch-jcswGhMUV9g, dledford-H+wXaHxf7aLQT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA


> Hey Sagi,

Hey Steve,

> where is the code to which you refer?   "address resolution handler?"

iser_calc_scsi_params()
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCHv1 1/1] IB/iser: Fix sg_tablesize calculation
       [not found]         ` <cd6691fd-11b4-dbf3-3ec4-12ff97bc515a-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
  2017-01-16 21:17           ` Steve Wise
@ 2017-01-17  9:57           ` Max Gurtovoy
  1 sibling, 0 replies; 6+ messages in thread
From: Max Gurtovoy @ 2017-01-17  9:57 UTC (permalink / raw)
  To: Sagi Grimberg, swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW,
	hch-jcswGhMUV9g, dledford-H+wXaHxf7aLQT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA



On 1/16/2017 11:03 PM, Sagi Grimberg wrote:
>
>> For devices that can register page list that is bigger than
>> USHRT_MAX, we actually take the wrong value for sg_tablesize.
>> E.g: for CX4 max_fast_reg_page_list_len is 65536 (bigger than USHRT_MAX)
>> so we set sg_tablesize to 0 by mistake. Therefore, each IO that is
>> bigger than 4k splitted to "< 4k" chunks that cause performance
>> degredation.
>>
>> Fixes: 7854550ae6d8 ("RDMA/iser: Limit sgs to the device fastreg depth")
>> Signed-off-by: Max Gurtovoy <maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
>> ---
>>  drivers/infiniband/ulp/iser/iscsi_iser.c |    3 ++-
>>  1 files changed, 2 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c
>> b/drivers/infiniband/ulp/iser/iscsi_iser.c
>> index 9104e6b..ff37f19 100644
>> --- a/drivers/infiniband/ulp/iser/iscsi_iser.c
>> +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c
>> @@ -656,7 +656,8 @@ static void iscsi_iser_cleanup_task(struct
>> iscsi_task *task)
>>           * max fastreg page list length.
>>           */
>
> Hi Max,
>
>>          shost->sg_tablesize = min_t(unsigned short, shost->sg_tablesize,
>> -
>> ib_conn->device->ib_device->attrs.max_fast_reg_page_list_len);
>> +                      min_t(unsigned int, USHRT_MAX,
>> +
>> ib_conn->device->ib_device->attrs.max_fast_reg_page_list_len));
>
> Hmm, This looks broken since I fixed up mlx5 capability at:
> 911f4331bc87 ("IB/mlx5: Expose correct max_fast_reg_page_list_len")
>
> However, I suspect this assignment should be removed altogether because
> we already take that into account in the address resolution handler,
> there the min statement is for unsigned and casted back to ushrt.

Hi Sagi,
I can send v2 with assignment removal (there is some work to do in 
iser_calc_scsi_params too) but I think that your commit 911f4331bc87 
broke it accidently and not logically. Think of other providers that 
also may support max_fast_reg_page_list_len > USHRT_MAX (there was no 
such providers till that point in time).

Altought it's not optimal but it's the best solution in competability 
means since there are 4 commits involved in that area (from first to last):
1. 7854550ae6 ("RDMA/iser: Limit sgs to the device fastreg depth")
2. df749cdc45 ("IB/iser: Support up to 8MB data transfer in a single 
command")
3. 911f4331bc ("IB/mlx5: Expose correct max_fast_reg_page_list_len")
4. 9c674815d3 ("IB/iser: Fix max_sectors calculation")

and the last one fixes all the loop.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2017-01-17  9:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-16 17:44 [PATCHv1 0/1] fix sg_tablesize calculation in iser Max Gurtovoy
     [not found] ` <1484588681-12987-1-git-send-email-maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2017-01-16 17:44   ` [PATCHv1 1/1] IB/iser: Fix sg_tablesize calculation Max Gurtovoy
     [not found]     ` <1484588681-12987-2-git-send-email-maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2017-01-16 21:03       ` Sagi Grimberg
     [not found]         ` <cd6691fd-11b4-dbf3-3ec4-12ff97bc515a-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
2017-01-16 21:17           ` Steve Wise
2017-01-16 21:31             ` Sagi Grimberg
2017-01-17  9:57           ` Max Gurtovoy

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.