All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2 1/2] IB/iser: Fix sg_tablesize calculation
@ 2017-01-17 14:47 Max Gurtovoy
       [not found] ` <1484664446-15535-1-git-send-email-maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Max Gurtovoy @ 2017-01-17 14:47 UTC (permalink / raw)
  To: hch-jcswGhMUV9g, swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW,
	sagi-NQWnxTmZq1alnMjI0IkVqw, 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.
Remove wrong sg_tablesize assignment, and use the value that was set during
address resolution handler with the needed casting.

Fixes: 911f4331bc87 ("IB/mlx5: Expose correct max_fast_reg_page_list_len")
Cc: <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org> # v4.5+
Signed-off-by: Max Gurtovoy <maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
Changes since v1:
 - update "Fixes" statement
 - use sg_tablesize assignment from iser_calc_scsi_params()
 - add patch 2/2 to remove unneeded variable
---
 drivers/infiniband/ulp/iser/iscsi_iser.c |    7 -------
 1 files changed, 0 insertions(+), 7 deletions(-)

diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c
index 9104e6b..1c91187 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.c
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.c
@@ -651,13 +651,6 @@ static void iscsi_iser_cleanup_task(struct iscsi_task *task)
 						   SHOST_DIX_GUARD_CRC);
 		}
 
-		/*
-		 * Limit the sg_tablesize and max_sectors based on the device
-		 * 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);
-
 		if (iscsi_host_add(shost,
 				   ib_conn->device->ib_device->dma_device)) {
 			mutex_unlock(&iser_conn->state_mutex);
-- 
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] 5+ messages in thread

* [PATCHv2 2/2] IB/iser: remove unused variable from iser_conn struct
       [not found] ` <1484664446-15535-1-git-send-email-maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
@ 2017-01-17 14:47   ` Max Gurtovoy
       [not found]     ` <1484664446-15535-2-git-send-email-maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  2017-01-17 15:54   ` [PATCHv2 1/2] IB/iser: Fix sg_tablesize calculation Sagi Grimberg
  1 sibling, 1 reply; 5+ messages in thread
From: Max Gurtovoy @ 2017-01-17 14:47 UTC (permalink / raw)
  To: hch-jcswGhMUV9g, swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW,
	sagi-NQWnxTmZq1alnMjI0IkVqw, dledford-H+wXaHxf7aLQT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: Max Gurtovoy

max_sectors calculation was fixed in commit:
9c674815d346 ("IB/iser: Fix max_sectors calculation").
Thus, iser_conn variable scsi_max_sectors is not needed anymore.

Signed-off-by: Max Gurtovoy <maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 drivers/infiniband/ulp/iser/iscsi_iser.c |    4 ++++
 drivers/infiniband/ulp/iser/iscsi_iser.h |    2 --
 drivers/infiniband/ulp/iser/iser_verbs.c |   13 +------------
 3 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c
index 1c91187..e71af71 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.c
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.c
@@ -672,6 +672,10 @@ static void iscsi_iser_cleanup_task(struct iscsi_task *task)
 	max_fr_sectors = ((shost->sg_tablesize - 1) * PAGE_SIZE) >> 9;
 	shost->max_sectors = min(iser_max_sectors, max_fr_sectors);
 
+	iser_dbg("iser_conn %p, sg_tablesize %u, max_sectors %u\n",
+		 iser_conn, shost->sg_tablesize,
+		 shost->max_sectors);
+
 	if (cmds_max > max_cmds) {
 		iser_info("cmds_max changed from %u to %u\n",
 			  cmds_max, max_cmds);
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.h b/drivers/infiniband/ulp/iser/iscsi_iser.h
index 0be6a7c..9d0b22a 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.h
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.h
@@ -496,7 +496,6 @@ struct ib_conn {
  * @rx_descs:         rx buffers array (cyclic buffer)
  * @num_rx_descs:     number of rx descriptors
  * @scsi_sg_tablesize: scsi host sg_tablesize
- * @scsi_max_sectors: scsi host max sectors
  */
 struct iser_conn {
 	struct ib_conn		     ib_conn;
@@ -519,7 +518,6 @@ struct iser_conn {
 	struct iser_rx_desc	     *rx_descs;
 	u32                          num_rx_descs;
 	unsigned short               scsi_sg_tablesize;
-	unsigned int                 scsi_max_sectors;
 	bool			     snd_w_inv;
 };
 
diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c
index 8ae7a3b..6a9d1cb 100644
--- a/drivers/infiniband/ulp/iser/iser_verbs.c
+++ b/drivers/infiniband/ulp/iser/iser_verbs.c
@@ -707,18 +707,7 @@ static void iser_connect_error(struct rdma_cm_id *cma_id)
 	sup_sg_tablesize = min_t(unsigned, ISCSI_ISER_MAX_SG_TABLESIZE,
 				 device->ib_device->attrs.max_fast_reg_page_list_len);
 
-	if (sg_tablesize > sup_sg_tablesize) {
-		sg_tablesize = sup_sg_tablesize;
-		iser_conn->scsi_max_sectors = sg_tablesize * SIZE_4K / 512;
-	} else {
-		iser_conn->scsi_max_sectors = max_sectors;
-	}
-
-	iser_conn->scsi_sg_tablesize = sg_tablesize;
-
-	iser_dbg("iser_conn %p, sg_tablesize %u, max_sectors %u\n",
-		 iser_conn, iser_conn->scsi_sg_tablesize,
-		 iser_conn->scsi_max_sectors);
+	iser_conn->scsi_sg_tablesize = min(sg_tablesize, sup_sg_tablesize);
 }
 
 /**
-- 
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] 5+ messages in thread

* Re: [PATCHv2 1/2] IB/iser: Fix sg_tablesize calculation
       [not found] ` <1484664446-15535-1-git-send-email-maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  2017-01-17 14:47   ` [PATCHv2 2/2] IB/iser: remove unused variable from iser_conn struct Max Gurtovoy
@ 2017-01-17 15:54   ` Sagi Grimberg
  1 sibling, 0 replies; 5+ messages in thread
From: Sagi Grimberg @ 2017-01-17 15:54 UTC (permalink / raw)
  To: Max Gurtovoy, hch-jcswGhMUV9g,
	swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW,
	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.
> Remove wrong sg_tablesize assignment, and use the value that was set during
> address resolution handler with the needed casting.
>
> Fixes: 911f4331bc87 ("IB/mlx5: Expose correct max_fast_reg_page_list_len")

That's not correct, the patch was a fix which exposed a bug in iser
that was broken anyway. Let's remove it.

Other than that, looks good,

Reviewed-by: Sagi Grimberg <sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
--
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] 5+ messages in thread

* Re: [PATCHv2 2/2] IB/iser: remove unused variable from iser_conn struct
       [not found]     ` <1484664446-15535-2-git-send-email-maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
@ 2017-01-17 15:55       ` Sagi Grimberg
       [not found]         ` <f53c4dff-17eb-d9ab-aa5b-6bb91af65aba-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Sagi Grimberg @ 2017-01-17 15:55 UTC (permalink / raw)
  To: Max Gurtovoy, hch-jcswGhMUV9g,
	swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW,
	dledford-H+wXaHxf7aLQT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA

Looks good,

Reviewed-by: Sagi Grimberg <sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
--
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] 5+ messages in thread

* RE: [PATCHv2 2/2] IB/iser: remove unused variable from iser_conn struct
       [not found]         ` <f53c4dff-17eb-d9ab-aa5b-6bb91af65aba-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
@ 2017-01-17 16:49           ` Steve Wise
  0 siblings, 0 replies; 5+ messages in thread
From: Steve Wise @ 2017-01-17 16:49 UTC (permalink / raw)
  To: 'Sagi Grimberg', 'Max Gurtovoy', hch-jcswGhMUV9g,
	dledford-H+wXaHxf7aLQT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: 'Raju Rangoju'

> Looks good,
> 
> Reviewed-by: Sagi Grimberg <sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>

Chelsio will test these 2 out asap over cxgb4 and report back.

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] 5+ messages in thread

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

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-17 14:47 [PATCHv2 1/2] IB/iser: Fix sg_tablesize calculation Max Gurtovoy
     [not found] ` <1484664446-15535-1-git-send-email-maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2017-01-17 14:47   ` [PATCHv2 2/2] IB/iser: remove unused variable from iser_conn struct Max Gurtovoy
     [not found]     ` <1484664446-15535-2-git-send-email-maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2017-01-17 15:55       ` Sagi Grimberg
     [not found]         ` <f53c4dff-17eb-d9ab-aa5b-6bb91af65aba-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
2017-01-17 16:49           ` Steve Wise
2017-01-17 15:54   ` [PATCHv2 1/2] IB/iser: Fix sg_tablesize calculation Sagi Grimberg

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.