linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@mellanox.com>
To: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Doug Ledford <dledford@redhat.com>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	Linux Next Mailing List <linux-next@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Kamenee Arumugam <kamenee.arumugam@intel.com>,
	Dennis Dalessandro <dennis.dalessandro@intel.com>
Subject: Re: linux-next: build failure after merge of the rdma tree
Date: Mon, 8 Jul 2019 16:08:27 +0000	[thread overview]
Message-ID: <20190708160823.GH23966@mellanox.com> (raw)
In-Reply-To: <20190708125725.25c38fa7@canb.auug.org.au>

On Mon, Jul 08, 2019 at 12:57:25PM +1000, Stephen Rothwell wrote:
> Hi all,
> 
> After merging the rdma tree, today's linux-next build (x86_64
> allmodconfig) failed like this:
> 
> In file included from <command-line>:32:
> ./usr/include/rdma/rvt-abi.h:13:10: fatal error: rdma/ib_verbs.h: No such file or directory
>  #include <rdma/ib_verbs.h>
>           ^~~~~~~~~~~~~~~~~
> 
> Caused by commits
> 
>   dabac6e460ce ("IB/hfi1: Move receive work queue struct into uapi directory")
> 
> interacting with commit
> 
>   0c422a3d4e1b ("kbuild: compile-test exported headers to ensure they are self-contained")
> 
> from the kbuild tree.
> 
> You can't reference the include/linux headers from uapi headers ...
> 
> I have used the rmda tree from 20190628 again today (given the previous
> errors).

This is a bug that will break our userspace package too, we must fix
it, very happy to see the functionality in "kbuild: compile-test
exported headers to ensure they are self-contained"

Dennis, you must put stuff in rdma-core and run the rdma-core CI if
you are messing with the uapi headers.

I'm adding this fixup so we can progress with the merge window. Please
check it right away.

From f10ff380fd7dfba4a36d40f8dd00fe17da8a1a10 Mon Sep 17 00:00:00 2001
From: Jason Gunthorpe <jgg@mellanox.com>
Date: Mon, 8 Jul 2019 12:17:48 -0300
Subject: [PATCH] RDMA/rvt: Do not use a kernel header in the ABI

rvt was using ib_sge as part of it's ABI, which is not allowed. Introduce
a new struct with the same layout and use it instead.

Fixes: dabac6e460ce ("IB/hfi1: Move receive work queue struct into uapi directory")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
---
 drivers/infiniband/sw/rdmavt/qp.c | 32 ++++++++++++++++++++++++++-----
 include/uapi/rdma/rvt-abi.h       |  9 +++++++--
 2 files changed, 34 insertions(+), 7 deletions(-)

diff --git a/drivers/infiniband/sw/rdmavt/qp.c b/drivers/infiniband/sw/rdmavt/qp.c
index 11b4d3c1efd486..0b0a241c57ff37 100644
--- a/drivers/infiniband/sw/rdmavt/qp.c
+++ b/drivers/infiniband/sw/rdmavt/qp.c
@@ -1847,8 +1847,11 @@ int rvt_post_recv(struct ib_qp *ibqp, const struct ib_recv_wr *wr,
 			wqe = rvt_get_rwqe_ptr(&qp->r_rq, wq->head);
 			wqe->wr_id = wr->wr_id;
 			wqe->num_sge = wr->num_sge;
-			for (i = 0; i < wr->num_sge; i++)
-				wqe->sg_list[i] = wr->sg_list[i];
+			for (i = 0; i < wr->num_sge; i++) {
+				wqe->sg_list[i].addr = wr->sg_list[i].addr;
+				wqe->sg_list[i].length = wr->sg_list[i].length;
+				wqe->sg_list[i].lkey = wr->sg_list[i].lkey;
+			}
 			/*
 			 * Make sure queue entry is written
 			 * before the head index.
@@ -2250,8 +2253,11 @@ int rvt_post_srq_recv(struct ib_srq *ibsrq, const struct ib_recv_wr *wr,
 		wqe = rvt_get_rwqe_ptr(&srq->rq, wq->head);
 		wqe->wr_id = wr->wr_id;
 		wqe->num_sge = wr->num_sge;
-		for (i = 0; i < wr->num_sge; i++)
-			wqe->sg_list[i] = wr->sg_list[i];
+		for (i = 0; i < wr->num_sge; i++) {
+			wqe->sg_list[i].addr = wr->sg_list[i].addr;
+			wqe->sg_list[i].length = wr->sg_list[i].length;
+			wqe->sg_list[i].lkey = wr->sg_list[i].lkey;
+		}
 		/* Make sure queue entry is written before the head index. */
 		smp_store_release(&wq->head, next);
 		spin_unlock_irqrestore(&srq->rq.kwq->p_lock, flags);
@@ -2259,6 +2265,22 @@ int rvt_post_srq_recv(struct ib_srq *ibsrq, const struct ib_recv_wr *wr,
 	return 0;
 }
 
+/*
+ * rvt used the internal kernel struct as part of its ABI, for now make sure
+ * the kernel struct does not change layout. FIXME: rvt should never cast the
+ * user struct to a kernel struct.
+ */
+static struct ib_sge *rvt_cast_sge(struct rvt_wqe_sge *sge)
+{
+	BUILD_BUG_ON(offsetof(struct ib_sge, addr) !=
+		     offsetof(struct rvt_wqe_sge, addr));
+	BUILD_BUG_ON(offsetof(struct ib_sge, length) !=
+		     offsetof(struct rvt_wqe_sge, length));
+	BUILD_BUG_ON(offsetof(struct ib_sge, lkey) !=
+		     offsetof(struct rvt_wqe_sge, lkey));
+	return (struct ib_sge *)sge;
+}
+
 /*
  * Validate a RWQE and fill in the SGE state.
  * Return 1 if OK.
@@ -2282,7 +2304,7 @@ static int init_sge(struct rvt_qp *qp, struct rvt_rwqe *wqe)
 			continue;
 		/* Check LKEY */
 		ret = rvt_lkey_ok(rkt, pd, j ? &ss->sg_list[j - 1] : &ss->sge,
-				  NULL, &wqe->sg_list[i],
+				  NULL, rvt_cast_sge(&wqe->sg_list[i]),
 				  IB_ACCESS_LOCAL_WRITE);
 		if (unlikely(ret <= 0))
 			goto bad_lkey;
diff --git a/include/uapi/rdma/rvt-abi.h b/include/uapi/rdma/rvt-abi.h
index d2e35d24f1a9e6..7328293c715cfb 100644
--- a/include/uapi/rdma/rvt-abi.h
+++ b/include/uapi/rdma/rvt-abi.h
@@ -10,11 +10,16 @@
 
 #include <linux/types.h>
 #include <rdma/ib_user_verbs.h>
-#include <rdma/ib_verbs.h>
 #ifndef RDMA_ATOMIC_UAPI
 #define RDMA_ATOMIC_UAPI(_type, _name) struct{ _type val; } _name
 #endif
 
+struct rvt_wqe_sge {
+	__aligned_u64 addr;
+	__u32 length;
+	__u32 lkey;
+};
+
 /*
  * This structure is used to contain the head pointer, tail pointer,
  * and completion queue entries as a single memory allocation so
@@ -39,7 +44,7 @@ struct rvt_rwqe {
 	__u64 wr_id;
 	__u8 num_sge;
 	__u8 padding[7];
-	struct ib_sge sg_list[];
+	struct rvt_wqe_sge sg_list[];
 };
 
 /*
-- 
2.21.0



  reply	other threads:[~2019-07-08 16:08 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-08  2:57 linux-next: build failure after merge of the rdma tree Stephen Rothwell
2019-07-08 16:08 ` Jason Gunthorpe [this message]
2019-07-09  3:11   ` Stephen Rothwell
2019-07-25 18:32   ` Dennis Dalessandro
  -- strict thread matches above, loose matches on Subject: below --
2020-02-26  2:51 Stephen Rothwell
2020-02-26  3:04 ` Devesh Sharma
2020-02-26 17:25 ` Jason Gunthorpe
2019-07-09  3:30 Stephen Rothwell
2019-07-09  7:04 ` Mark Zhang
2019-07-09  7:18   ` Leon Romanovsky
2019-07-09 12:43     ` Stephen Rothwell
2019-07-09 13:11       ` Leon Romanovsky
2019-07-09 12:46     ` Jason Gunthorpe
2019-07-10  1:04       ` Stephen Rothwell
2019-07-10  4:30         ` Stephen Rothwell
2019-07-16 23:28           ` Stephen Rothwell
2019-07-17  6:33             ` Masahiro Yamada
2019-07-17  7:45               ` Stephen Rothwell
2019-07-08  3:03 Stephen Rothwell
2019-07-08 14:09 ` Jason Gunthorpe
2019-07-01  4:14 Stephen Rothwell
2019-07-01  7:54 ` wangxi
2019-07-01 22:49   ` Jason Gunthorpe
2019-07-04  2:02 ` Stephen Rothwell
2019-07-04  2:04   ` Jason Gunthorpe
2019-07-04  2:10     ` oulijun
2019-07-04  4:07     ` wangxi
2019-07-04  4:10       ` wangxi
2019-07-04  6:31     ` oulijun
2019-07-05 13:15   ` Jason Gunthorpe
2019-07-05 14:59     ` Stephen Rothwell
2018-12-04  0:47 Stephen Rothwell
2018-12-04  1:52 ` Jason Gunthorpe
2018-12-04  9:42   ` Leon Romanovsky
2018-12-07  2:41     ` Stephen Rothwell
2018-12-05 12:25   ` Guy Levi(SW)
2018-12-05 22:58     ` Stephen Rothwell
2018-12-10  0:43       ` Changbin Du
2018-12-10 15:52       ` Masahiro Yamada
2018-01-25  7:22 Stephen Rothwell
2018-01-25  8:50 ` Leon Romanovsky
2018-01-25 16:08   ` Doug Ledford
2017-07-31  2:07 Stephen Rothwell
2017-04-21  1:42 Stephen Rothwell
2017-04-21  1:58 ` Joe Perches
2017-04-21  2:21   ` Doug Ledford
2017-04-21  2:23     ` Stephen Rothwell
2017-04-21  2:21   ` Stephen Rothwell
2017-02-15  0:30 Stephen Rothwell
2017-02-15  1:05 ` Doug Ledford
2017-02-15  5:09   ` Selvin Xavier
2016-09-27  1:23 Stephen Rothwell
2016-09-27  5:04 ` Christoph Hellwig
2016-09-27  5:48   ` Stephen Rothwell
2016-09-27 13:39     ` Christoph Hellwig
2016-09-27 17:15       ` Doug Ledford
2016-09-28  1:43 ` Stephen Rothwell
2016-09-28 15:00   ` Doug Ledford
2016-09-28 15:23     ` Greg KH
2016-09-28 15:26       ` Doug Ledford
2016-09-28 21:45     ` Stephen Rothwell
2016-03-16  1:15 Stephen Rothwell
2016-03-16  6:49 ` Herbert Xu
2016-03-16 19:02   ` Doug Ledford
2016-03-16 20:41     ` Stephen Rothwell
2016-03-16 22:14     ` Ismail, Mustafa
2016-01-13  1:35 Stephen Rothwell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190708160823.GH23966@mellanox.com \
    --to=jgg@mellanox.com \
    --cc=dennis.dalessandro@intel.com \
    --cc=dledford@redhat.com \
    --cc=kamenee.arumugam@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    --cc=yamada.masahiro@socionext.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).