All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Fix 4.4 IB merge window regressions
@ 2015-11-30 14:34 Mike Marciniszyn
       [not found] ` <20151130143326.24060.35941.stgit-K+u1se/DcYrLESAwzcoQNrvm/XP+8Wra@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Mike Marciniszyn @ 2015-11-30 14:34 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

This two patch series fixes regressions for qib and hfi1
introduced in the 4.4 merge window.

These are critical for 4.4 and for rebasing the qib/hfi1
refactoring.

---

Ira Weiny (1):
      IB/qib: Fix qib_mr structure

Mike Marciniszyn (1):
      IB/core: correct issue with sge copyin corrupting wr


 drivers/infiniband/core/uverbs_cmd.c  |   15 ++++++++++-----
 drivers/infiniband/hw/qib/qib_verbs.h |    2 +-
 2 files changed, 11 insertions(+), 6 deletions(-)

-- 
Mike
--
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

* [PATCH 1/2] IB/core: correct issue with sge copyin corrupting wr
       [not found] ` <20151130143326.24060.35941.stgit-K+u1se/DcYrLESAwzcoQNrvm/XP+8Wra@public.gmane.org>
@ 2015-11-30 14:34   ` Mike Marciniszyn
  2015-11-30 14:34   ` [PATCH 2/2] IB/qib: Fix qib_mr structure Mike Marciniszyn
  2015-11-30 18:05   ` [PATCH 0/2] Fix 4.4 IB merge window regressions ira.weiny
  2 siblings, 0 replies; 5+ messages in thread
From: Mike Marciniszyn @ 2015-11-30 14:34 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

Commit e622f2f4ad21 ("IB: split struct ib_send_wr")
introduced a regression for HCAs whose user mode post
sends go through ib_uverbs_post_send().

The code didn't account for the fact that the first sge is
offset by an operation dependent length.  The allocation did,
but the pointer to the sge list is computed without that knowledge.

Store the operation dependent length in an automatic and
compute the sge list copy in destination using that length.

Reviewed-by: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/infiniband/core/uverbs_cmd.c |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index 94816ae..4cb8e9d 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -2446,6 +2446,7 @@ ssize_t ib_uverbs_post_send(struct ib_uverbs_file *file,
 	int                             i, sg_ind;
 	int				is_ud;
 	ssize_t                         ret = -EINVAL;
+	size_t                          next_size;
 
 	if (copy_from_user(&cmd, buf, sizeof cmd))
 		return -EFAULT;
@@ -2490,7 +2491,8 @@ ssize_t ib_uverbs_post_send(struct ib_uverbs_file *file,
 				goto out_put;
 			}
 
-			ud = alloc_wr(sizeof(*ud), user_wr->num_sge);
+			next_size = sizeof(*ud);
+			ud = alloc_wr(next_size, user_wr->num_sge);
 			if (!ud) {
 				ret = -ENOMEM;
 				goto out_put;
@@ -2511,7 +2513,8 @@ ssize_t ib_uverbs_post_send(struct ib_uverbs_file *file,
 			   user_wr->opcode == IB_WR_RDMA_READ) {
 			struct ib_rdma_wr *rdma;
 
-			rdma = alloc_wr(sizeof(*rdma), user_wr->num_sge);
+			next_size = sizeof(*rdma);
+			rdma = alloc_wr(next_size, user_wr->num_sge);
 			if (!rdma) {
 				ret = -ENOMEM;
 				goto out_put;
@@ -2525,7 +2528,8 @@ ssize_t ib_uverbs_post_send(struct ib_uverbs_file *file,
 			   user_wr->opcode == IB_WR_ATOMIC_FETCH_AND_ADD) {
 			struct ib_atomic_wr *atomic;
 
-			atomic = alloc_wr(sizeof(*atomic), user_wr->num_sge);
+			next_size = sizeof(*atomic);
+			atomic = alloc_wr(next_size, user_wr->num_sge);
 			if (!atomic) {
 				ret = -ENOMEM;
 				goto out_put;
@@ -2540,7 +2544,8 @@ ssize_t ib_uverbs_post_send(struct ib_uverbs_file *file,
 		} else if (user_wr->opcode == IB_WR_SEND ||
 			   user_wr->opcode == IB_WR_SEND_WITH_IMM ||
 			   user_wr->opcode == IB_WR_SEND_WITH_INV) {
-			next = alloc_wr(sizeof(*next), user_wr->num_sge);
+			next_size = sizeof(*next);
+			next = alloc_wr(next_size, user_wr->num_sge);
 			if (!next) {
 				ret = -ENOMEM;
 				goto out_put;
@@ -2572,7 +2577,7 @@ ssize_t ib_uverbs_post_send(struct ib_uverbs_file *file,
 
 		if (next->num_sge) {
 			next->sg_list = (void *) next +
-				ALIGN(sizeof *next, sizeof (struct ib_sge));
+				ALIGN(next_size, sizeof(struct ib_sge));
 			if (copy_from_user(next->sg_list,
 					   buf + sizeof cmd +
 					   cmd.wr_count * cmd.wqe_size +

--
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

* [PATCH 2/2] IB/qib: Fix qib_mr structure
       [not found] ` <20151130143326.24060.35941.stgit-K+u1se/DcYrLESAwzcoQNrvm/XP+8Wra@public.gmane.org>
  2015-11-30 14:34   ` [PATCH 1/2] IB/core: correct issue with sge copyin corrupting wr Mike Marciniszyn
@ 2015-11-30 14:34   ` Mike Marciniszyn
  2015-11-30 18:05   ` [PATCH 0/2] Fix 4.4 IB merge window regressions ira.weiny
  2 siblings, 0 replies; 5+ messages in thread
From: Mike Marciniszyn @ 2015-11-30 14:34 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

From: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

struct qib_mr requires the mr member be the last because struct
qib_mregion contains a dynamic array at the end.  The additions
of members should have been placed before this structure as the
comment noted.

Failure to do so was causing random memory corruption.  Reproducing
this bug was easy to do by running the client and server of
ib_write_bw -s 8 -n 5 on the same node.

This BUG() was tripped in a slab debug kernel:

kernel BUG at mm/slab.c:2572!

Fixes: 38071a461f0a ("IB/qib: Support the new memory registration API")
Reviewed-by: Mike Marciniszyn <mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/infiniband/hw/qib/qib_verbs.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/qib/qib_verbs.h b/drivers/infiniband/hw/qib/qib_verbs.h
index 2baf5ad..bc803f3 100644
--- a/drivers/infiniband/hw/qib/qib_verbs.h
+++ b/drivers/infiniband/hw/qib/qib_verbs.h
@@ -329,9 +329,9 @@ struct qib_sge {
 struct qib_mr {
 	struct ib_mr ibmr;
 	struct ib_umem *umem;
-	struct qib_mregion mr;  /* must be last */
 	u64 *pages;
 	u32 npages;
+	struct qib_mregion mr;  /* must be last */
 };
 
 /*

--
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: [PATCH 0/2] Fix 4.4 IB merge window regressions
       [not found] ` <20151130143326.24060.35941.stgit-K+u1se/DcYrLESAwzcoQNrvm/XP+8Wra@public.gmane.org>
  2015-11-30 14:34   ` [PATCH 1/2] IB/core: correct issue with sge copyin corrupting wr Mike Marciniszyn
  2015-11-30 14:34   ` [PATCH 2/2] IB/qib: Fix qib_mr structure Mike Marciniszyn
@ 2015-11-30 18:05   ` ira.weiny
       [not found]     ` <20151130180519.GA9201-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
  2 siblings, 1 reply; 5+ messages in thread
From: ira.weiny @ 2015-11-30 18:05 UTC (permalink / raw)
  To: Mike Marciniszyn
  Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
	devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b

On Mon, Nov 30, 2015 at 09:34:15AM -0500, Mike Marciniszyn wrote:
> This two patch series fixes regressions for qib and hfi1
> introduced in the 4.4 merge window.
> 
> These are critical for 4.4 and for rebasing the qib/hfi1
> refactoring.

Doug, Greg,

It should also be noted that without this change to uverbs_cmd the hfi1 driver
is at least partially (ib_write_bw test) broken in staging-next.

Greg, if Linus pulls these from Doug into rc4 will you pull them into
staging-next?

Ira

> 
> ---
> 
> Ira Weiny (1):
>       IB/qib: Fix qib_mr structure
> 
> Mike Marciniszyn (1):
>       IB/core: correct issue with sge copyin corrupting wr
> 
> 
>  drivers/infiniband/core/uverbs_cmd.c  |   15 ++++++++++-----
>  drivers/infiniband/hw/qib/qib_verbs.h |    2 +-
>  2 files changed, 11 insertions(+), 6 deletions(-)
> 
> -- 
> Mike
> --
> 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
--
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: [PATCH 0/2] Fix 4.4 IB merge window regressions
       [not found]     ` <20151130180519.GA9201-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
@ 2015-11-30 18:52       ` gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r
  0 siblings, 0 replies; 5+ messages in thread
From: gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r @ 2015-11-30 18:52 UTC (permalink / raw)
  To: ira.weiny
  Cc: Mike Marciniszyn, dledford-H+wXaHxf7aLQT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b

On Mon, Nov 30, 2015 at 01:05:19PM -0500, ira.weiny wrote:
> On Mon, Nov 30, 2015 at 09:34:15AM -0500, Mike Marciniszyn wrote:
> > This two patch series fixes regressions for qib and hfi1
> > introduced in the 4.4 merge window.
> > 
> > These are critical for 4.4 and for rebasing the qib/hfi1
> > refactoring.
> 
> Doug, Greg,
> 
> It should also be noted that without this change to uverbs_cmd the hfi1 driver
> is at least partially (ib_write_bw test) broken in staging-next.
> 
> Greg, if Linus pulls these from Doug into rc4 will you pull them into
> staging-next?

Yes, I try to always sync up on the -rc releases.
--
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:[~2015-11-30 18:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-30 14:34 [PATCH 0/2] Fix 4.4 IB merge window regressions Mike Marciniszyn
     [not found] ` <20151130143326.24060.35941.stgit-K+u1se/DcYrLESAwzcoQNrvm/XP+8Wra@public.gmane.org>
2015-11-30 14:34   ` [PATCH 1/2] IB/core: correct issue with sge copyin corrupting wr Mike Marciniszyn
2015-11-30 14:34   ` [PATCH 2/2] IB/qib: Fix qib_mr structure Mike Marciniszyn
2015-11-30 18:05   ` [PATCH 0/2] Fix 4.4 IB merge window regressions ira.weiny
     [not found]     ` <20151130180519.GA9201-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2015-11-30 18:52       ` gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r

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.