linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] staging: lustre: small recent fixes for LNet/libcfs
@ 2016-05-09 14:53 James Simmons
  2016-05-09 14:53 ` [PATCH 1/4] staging: lustre: o2iblnd: limit cap.max_send_wr for MLX5 James Simmons
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: James Simmons @ 2016-05-09 14:53 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger, Oleg Drokin
  Cc: Linux Kernel Mailing List, Lustre Development List, James Simmons

Here are various fixes and improvements for the libcfs
and LNet layer. Two memory leaks fixed as well as adding
container support for the ko2iblnd driver. Lastly handle
the lower limit of the mlx5 driver for cap.max_send_wr.

Dmitry Eremin (1):
  staging: lustre: o2iblnd: limit cap.max_send_wr for MLX5

James Simmons (2):
  staging: lustre: libcfs: fix memort leak in libcfs crypto layer
  staging: lustre: ko2iblnd: fix memory corruption with fragments

Li Dongyang (1):
  staging: lustre: o2iblnd: make rdma_create_id() support containers

 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c    |   20 +++++++++++++++-----
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h    |    2 +-
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c |    8 ++++++++
 .../lustre/lnet/libcfs/linux/linux-crypto.c        |    1 +
 4 files changed, 25 insertions(+), 6 deletions(-)

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

* [PATCH 1/4] staging: lustre: o2iblnd: limit cap.max_send_wr for MLX5
  2016-05-09 14:53 [PATCH 0/4] staging: lustre: small recent fixes for LNet/libcfs James Simmons
@ 2016-05-09 14:53 ` James Simmons
  2016-05-09 14:53 ` [PATCH 2/4] staging: lustre: o2iblnd: make rdma_create_id() support containers James Simmons
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: James Simmons @ 2016-05-09 14:53 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger, Oleg Drokin
  Cc: Linux Kernel Mailing List, Lustre Development List,
	Dmitry Eremin, James Simmons

From: Dmitry Eremin <dmitry.eremin@intel.com>

Decrease cap.max_send_wr until it is accepted by rdma_create_qp()

Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7124
Reviewed-on: http://review.whamcloud.com/18347
Reviewed-by: Olaf Weber <olaf@sgi.com>
Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c    |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
index d99b4fa..bc179a2 100644
--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
+++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
@@ -768,7 +768,12 @@ kib_conn_t *kiblnd_create_conn(kib_peer_t *peer, struct rdma_cm_id *cmid,
 
 	conn->ibc_sched = sched;
 
-	rc = rdma_create_qp(cmid, conn->ibc_hdev->ibh_pd, init_qp_attr);
+	do {
+		rc = rdma_create_qp(cmid, conn->ibc_hdev->ibh_pd, init_qp_attr);
+		if (!rc || init_qp_attr->cap.max_send_wr < 16)
+			break;
+	} while (rc);
+
 	if (rc) {
 		CERROR("Can't create QP: %d, send_wr: %d, recv_wr: %d\n",
 		       rc, init_qp_attr->cap.max_send_wr,
@@ -776,6 +781,10 @@ kib_conn_t *kiblnd_create_conn(kib_peer_t *peer, struct rdma_cm_id *cmid,
 		goto failed_2;
 	}
 
+	if (init_qp_attr->cap.max_send_wr != IBLND_SEND_WRS(conn))
+		CDEBUG(D_NET, "original send wr %d, created with %d\n",
+		       IBLND_SEND_WRS(conn), init_qp_attr->cap.max_send_wr);
+
 	LIBCFS_FREE(init_qp_attr, sizeof(*init_qp_attr));
 
 	/* 1 ref for caller and each rxmsg */
-- 
1.7.1

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

* [PATCH 2/4] staging: lustre: o2iblnd: make rdma_create_id() support containers
  2016-05-09 14:53 [PATCH 0/4] staging: lustre: small recent fixes for LNet/libcfs James Simmons
  2016-05-09 14:53 ` [PATCH 1/4] staging: lustre: o2iblnd: limit cap.max_send_wr for MLX5 James Simmons
@ 2016-05-09 14:53 ` James Simmons
  2016-05-09 14:53 ` [PATCH 3/4] staging: lustre: libcfs: fix memort leak in libcfs crypto layer James Simmons
  2016-05-09 14:53 ` [PATCH 4/4] staging: lustre: ko2iblnd: fix memory corruption with fragments James Simmons
  3 siblings, 0 replies; 5+ messages in thread
From: James Simmons @ 2016-05-09 14:53 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger, Oleg Drokin
  Cc: Linux Kernel Mailing List, Lustre Development List, Li Dongyang,
	James Simmons

From: Li Dongyang <dongyang.li@anu.edu.au>

Add support for lustre's ko2iblnd driver to work with
containers which was requested by Sebastien Buisson.

Signed-off-by: Li Dongyang <dongyang.li@anu.edu.au>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6215
Reviewed-on: http://review.whamcloud.com/18759
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Sebastien Buisson <sbuisson@ddn.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h    |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h
index b22984f..45bbe93 100644
--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h
+++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h
@@ -109,7 +109,7 @@ extern kib_tunables_t  kiblnd_tunables;
 					IBLND_CREDIT_HIGHWATER_V1 : \
 					t->lnd_peercredits_hiw)
 
-#define kiblnd_rdma_create_id(cb, dev, ps, qpt) rdma_create_id(&init_net, \
+#define kiblnd_rdma_create_id(cb, dev, ps, qpt) rdma_create_id(current->nsproxy->net_ns, \
 							       cb, dev, \
 							       ps, qpt)
 
-- 
1.7.1

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

* [PATCH 3/4] staging: lustre: libcfs: fix memort leak in libcfs crypto layer
  2016-05-09 14:53 [PATCH 0/4] staging: lustre: small recent fixes for LNet/libcfs James Simmons
  2016-05-09 14:53 ` [PATCH 1/4] staging: lustre: o2iblnd: limit cap.max_send_wr for MLX5 James Simmons
  2016-05-09 14:53 ` [PATCH 2/4] staging: lustre: o2iblnd: make rdma_create_id() support containers James Simmons
@ 2016-05-09 14:53 ` James Simmons
  2016-05-09 14:53 ` [PATCH 4/4] staging: lustre: ko2iblnd: fix memory corruption with fragments James Simmons
  3 siblings, 0 replies; 5+ messages in thread
From: James Simmons @ 2016-05-09 14:53 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger, Oleg Drokin
  Cc: Linux Kernel Mailing List, Lustre Development List,
	James Simmons, James Simmons

During code review Boyko discovered a memory leak. This
patch fixes that leak.

Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4423
Reviewed-on: http://review.whamcloud.com/19716
Reviewed-by: Alexander Boyko <alexander.boyko@seagate.com>
Reviewed-by: Frank Zago <fzago@cray.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 .../lustre/lnet/libcfs/linux/linux-crypto.c        |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/lustre/lnet/libcfs/linux/linux-crypto.c b/drivers/staging/lustre/lnet/libcfs/linux/linux-crypto.c
index 84f9b7b..5c0116a 100644
--- a/drivers/staging/lustre/lnet/libcfs/linux/linux-crypto.c
+++ b/drivers/staging/lustre/lnet/libcfs/linux/linux-crypto.c
@@ -99,6 +99,7 @@ static int cfs_crypto_hash_alloc(enum cfs_crypto_hash_alg hash_alg,
 					 (*type)->cht_size);
 
 	if (err != 0) {
+		ahash_request_free(*req);
 		crypto_free_ahash(tfm);
 		return err;
 	}
-- 
1.7.1

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

* [PATCH 4/4] staging: lustre: ko2iblnd: fix memory corruption with fragments
  2016-05-09 14:53 [PATCH 0/4] staging: lustre: small recent fixes for LNet/libcfs James Simmons
                   ` (2 preceding siblings ...)
  2016-05-09 14:53 ` [PATCH 3/4] staging: lustre: libcfs: fix memort leak in libcfs crypto layer James Simmons
@ 2016-05-09 14:53 ` James Simmons
  3 siblings, 0 replies; 5+ messages in thread
From: James Simmons @ 2016-05-09 14:53 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger, Oleg Drokin
  Cc: Linux Kernel Mailing List, Lustre Development List, James Simmons

In my test of the upstream client this change exposed a long
standing issues where we have a offset that is not page algined
would causes us to access memory beyond the scatter gather list
which was causing memory corruption when all 256 fragments were
in use.

Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c    |    9 +++++----
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c |    8 ++++++++
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
index bc179a2..8a18384 100644
--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
+++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
@@ -2020,8 +2020,8 @@ static void kiblnd_destroy_tx_pool(kib_pool_t *pool)
 				    sizeof(*tx->tx_pages));
 		if (tx->tx_frags)
 			LIBCFS_FREE(tx->tx_frags,
-				    IBLND_MAX_RDMA_FRAGS *
-					    sizeof(*tx->tx_frags));
+				    (1 + IBLND_MAX_RDMA_FRAGS) *
+				     sizeof(*tx->tx_frags));
 		if (tx->tx_wrq)
 			LIBCFS_FREE(tx->tx_wrq,
 				    (1 + IBLND_MAX_RDMA_FRAGS) *
@@ -2099,11 +2099,12 @@ static int kiblnd_create_tx_pool(kib_poolset_t *ps, int size,
 		}
 
 		LIBCFS_CPT_ALLOC(tx->tx_frags, lnet_cpt_table(), ps->ps_cpt,
-				 IBLND_MAX_RDMA_FRAGS * sizeof(*tx->tx_frags));
+				 (1 + IBLND_MAX_RDMA_FRAGS) *
+				 sizeof(*tx->tx_frags));
 		if (!tx->tx_frags)
 			break;
 
-		sg_init_table(tx->tx_frags, IBLND_MAX_RDMA_FRAGS);
+		sg_init_table(tx->tx_frags, IBLND_MAX_RDMA_FRAGS + 1);
 
 		LIBCFS_CPT_ALLOC(tx->tx_wrq, lnet_cpt_table(), ps->ps_cpt,
 				 (1 + IBLND_MAX_RDMA_FRAGS) *
diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
index bbfee53..0f7e3a1 100644
--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
+++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
@@ -689,6 +689,10 @@ kiblnd_setup_rd_iov(lnet_ni_t *ni, kib_tx_t *tx, kib_rdma_desc_t *rd,
 
 		sg_set_page(sg, page, fragnob, page_offset);
 		sg = sg_next(sg);
+		if (!sg) {
+			CERROR("lacking enough sg entries to map tx\n");
+			return -EFAULT;
+		}
 
 		if (offset + fragnob < iov->iov_len) {
 			offset += fragnob;
@@ -733,6 +737,10 @@ kiblnd_setup_rd_kiov(lnet_ni_t *ni, kib_tx_t *tx, kib_rdma_desc_t *rd,
 		sg_set_page(sg, kiov->kiov_page, fragnob,
 			    kiov->kiov_offset + offset);
 		sg = sg_next(sg);
+		if (!sg) {
+			CERROR("lacking enough sg entries to map tx\n");
+			return -EFAULT;
+		}
 
 		offset = 0;
 		kiov++;
-- 
1.7.1

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

end of thread, other threads:[~2016-05-09 14:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-09 14:53 [PATCH 0/4] staging: lustre: small recent fixes for LNet/libcfs James Simmons
2016-05-09 14:53 ` [PATCH 1/4] staging: lustre: o2iblnd: limit cap.max_send_wr for MLX5 James Simmons
2016-05-09 14:53 ` [PATCH 2/4] staging: lustre: o2iblnd: make rdma_create_id() support containers James Simmons
2016-05-09 14:53 ` [PATCH 3/4] staging: lustre: libcfs: fix memort leak in libcfs crypto layer James Simmons
2016-05-09 14:53 ` [PATCH 4/4] staging: lustre: ko2iblnd: fix memory corruption with fragments James Simmons

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).