All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] RDMA/core: Optimized path for kernel post_send/post_recv
@ 2011-03-24 12:43 miroslaw.walukiewicz-ral2JQCrhuEAvxtiuMwx3w
       [not found] ` <20110324123937.19461.56781.stgit-dAdtdUp2yJRU7keBU/FxOFDQ4js95KgL@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: miroslaw.walukiewicz-ral2JQCrhuEAvxtiuMwx3w @ 2011-03-24 12:43 UTC (permalink / raw)
  To: roland-DgEjT+Ai2ygdnm+yROfE0A; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

The patch introduces a new path of posting buffers from user-space to kernel
post_send/post_recv using shared page.

The shared page is allocated and defined by vendor driver.
The vendor driver during create QP decides when the new path will be used
setting a field use_shpage_for_rxtx field in connection context.

When the connection context indicates that the shared page  should be used
the uverbs_post_send()/uverbs_post_recv() calls directly the vendor driver
private post_send()/post_recv() functions improving the kernel path.

Signed-off-by: Mirek Walukiewicz <miroslaw.walukiewicz-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---

 drivers/infiniband/core/uverbs_cmd.c |   55 +++++++++++++++++++++++++++-------
 include/rdma/ib_verbs.h              |    1 +
 2 files changed, 45 insertions(+), 11 deletions(-)


diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index c426992..ba6655c 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -299,6 +299,7 @@ ssize_t ib_uverbs_get_context(struct ib_uverbs_file *file,
 	INIT_LIST_HEAD(&ucontext->srq_list);
 	INIT_LIST_HEAD(&ucontext->ah_list);
 	ucontext->closing = 0;
+	ucontext->use_shpage_for_rxtx = 0;
 
 	resp.num_comp_vectors = file->device->num_comp_vectors;
 
@@ -1448,15 +1449,31 @@ ssize_t ib_uverbs_post_send(struct ib_uverbs_file *file,
 
 	if (cmd.wqe_size < sizeof (struct ib_uverbs_send_wr))
 		return -EINVAL;
+	qp = idr_read_qp(cmd.qp_handle, file->ucontext);
+	if (!qp)
+		goto out_raw_qp;
+
+	if (file->ucontext->use_shpage_for_rxtx) {
+		/* pass NULL pointers as the information about */
+		/* buffers is passed using endor defined shared page */
+		resp.bad_wr = 0;
+		ret = qp->device->post_send(qp, NULL, NULL);
+		if (ret)
+			resp.bad_wr = cmd.wr_count;
+
+		if (copy_to_user((void __user *) (unsigned long)
+				cmd.response,
+				&resp,
+				sizeof resp))
+			ret = -EFAULT;
+		put_qp_read(qp);
+		goto out_raw_qp;
+	}
 
 	user_wr = kmalloc(cmd.wqe_size, GFP_KERNEL);
 	if (!user_wr)
 		return -ENOMEM;
 
-	qp = idr_read_qp(cmd.qp_handle, file->ucontext);
-	if (!qp)
-		goto out;
-
 	is_ud = qp->qp_type == IB_QPT_UD;
 	sg_ind = 0;
 	last = NULL;
@@ -1576,9 +1593,8 @@ out_put:
 		wr = next;
 	}
 
-out:
 	kfree(user_wr);
-
+out_raw_qp:
 	return ret ? ret : in_len;
 }
 
@@ -1680,16 +1696,33 @@ ssize_t ib_uverbs_post_recv(struct ib_uverbs_file *file,
 	if (copy_from_user(&cmd, buf, sizeof cmd))
 		return -EFAULT;
 
+	qp = idr_read_qp(cmd.qp_handle, file->ucontext);
+	if (!qp)
+		goto out_raw_qp;
+
+	if (file->ucontext->use_shpage_for_rxtx) {
+		resp.bad_wr = 0;
+		/* pass NULL pointers as the information about */
+		/* buffers is passed using endor defined shared page */
+		ret = qp->device->post_recv(qp, NULL, NULL);
+		if (ret)
+			resp.bad_wr = cmd.wr_count;
+
+		if (copy_to_user((void __user *) (unsigned long)
+				cmd.response,
+				&resp,
+				sizeof resp))
+			ret = -EFAULT;
+		put_qp_read(qp);
+		goto out_raw_qp;
+	}
+
 	wr = ib_uverbs_unmarshall_recv(buf + sizeof cmd,
 				       in_len - sizeof cmd, cmd.wr_count,
 				       cmd.sge_count, cmd.wqe_size);
 	if (IS_ERR(wr))
 		return PTR_ERR(wr);
 
-	qp = idr_read_qp(cmd.qp_handle, file->ucontext);
-	if (!qp)
-		goto out;
-
 	resp.bad_wr = 0;
 	ret = qp->device->post_recv(qp, wr, &bad_wr);
 
@@ -1706,13 +1739,13 @@ ssize_t ib_uverbs_post_recv(struct ib_uverbs_file *file,
 			 &resp, sizeof resp))
 		ret = -EFAULT;
 
-out:
 	while (wr) {
 		next = wr->next;
 		kfree(wr);
 		wr = next;
 	}
 
+out_raw_qp:
 	return ret ? ret : in_len;
 }
 
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 55cd0a0..ab31c03 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -831,6 +831,7 @@ struct ib_ucontext {
 	struct list_head	srq_list;
 	struct list_head	ah_list;
 	int			closing;
+	int                     use_shpage_for_rxtx;
 };
 
 struct ib_uobject {


--
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] RDMA/core: Optimized path for kernel post_send/post_recv
       [not found] ` <20110324123937.19461.56781.stgit-dAdtdUp2yJRU7keBU/FxOFDQ4js95KgL@public.gmane.org>
@ 2011-03-24 19:56   ` Roland Dreier
  2011-05-19 20:51   ` Steve Wise
  1 sibling, 0 replies; 5+ messages in thread
From: Roland Dreier @ 2011-03-24 19:56 UTC (permalink / raw)
  To: miroslaw.walukiewicz-ral2JQCrhuEAvxtiuMwx3w
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

Overall, looks pretty sane and non-intrusive.  I would like to see
patches for at least one driver using it before we merge this.

> +       if (file->ucontext->use_shpage_for_rxtx) {

Why do we attach this flag to the entire ucontext rather than
an individual QP?  It seems more awkward to require two
contexts if a process wants to use both bypass and non-bypass QPs.

 - R.
--
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] RDMA/core: Optimized path for kernel post_send/post_recv
       [not found] ` <20110324123937.19461.56781.stgit-dAdtdUp2yJRU7keBU/FxOFDQ4js95KgL@public.gmane.org>
  2011-03-24 19:56   ` Roland Dreier
@ 2011-05-19 20:51   ` Steve Wise
       [not found]     ` <4DD582E9.6020509-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
  1 sibling, 1 reply; 5+ messages in thread
From: Steve Wise @ 2011-05-19 20:51 UTC (permalink / raw)
  To: roland-DgEjT+Ai2ygdnm+yROfE0A
  Cc: miroslaw.walukiewicz-ral2JQCrhuEAvxtiuMwx3w,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA



On 03/24/2011 07:43 AM, miroslaw.walukiewicz-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org wrote:
> The patch introduces a new path of posting buffers from user-space to kernel
> post_send/post_recv using shared page.
>
> The shared page is allocated and defined by vendor driver.
> The vendor driver during create QP decides when the new path will be used
> setting a field use_shpage_for_rxtx field in connection context.
>
> When the connection context indicates that the shared page  should be used
> the uverbs_post_send()/uverbs_post_recv() calls directly the vendor driver
> private post_send()/post_recv() functions improving the kernel path.
>
> Signed-off-by: Mirek Walukiewicz<miroslaw.walukiewicz-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> ---

Hey Roland,

Do you plan to merge this?

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

* Re: [PATCH] RDMA/core: Optimized path for kernel post_send/post_recv
       [not found]     ` <4DD582E9.6020509-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
@ 2011-05-19 22:48       ` Roland Dreier
  0 siblings, 0 replies; 5+ messages in thread
From: Roland Dreier @ 2011-05-19 22:48 UTC (permalink / raw)
  To: Steve Wise
  Cc: miroslaw.walukiewicz-ral2JQCrhuEAvxtiuMwx3w,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA

On Thu, May 19, 2011 at 1:51 PM, Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org> wrote:
> Do you plan to merge this?

No... never got a reply after my previous reply:

Overall, looks pretty sane and non-intrusive.  I would like to see
patches for at least one driver using it before we merge this.

> +       if (file->ucontext->use_shpage_for_rxtx) {

Why do we attach this flag to the entire ucontext rather than
an individual QP?  It seems more awkward to require two
contexts if a process wants to use both bypass and non-bypass QPs.
--
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] RDMA/core: Optimized path for kernel post_send/post_recv
@ 2011-02-22 11:50 miroslaw.walukiewicz-ral2JQCrhuEAvxtiuMwx3w
  0 siblings, 0 replies; 5+ messages in thread
From: miroslaw.walukiewicz-ral2JQCrhuEAvxtiuMwx3w @ 2011-02-22 11:50 UTC (permalink / raw)
  To: roland-DgEjT+Ai2ygdnm+yROfE0A; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

The patch introduces a new path of posting buffers from user-space to kernel
using a shared page method.

The shared page is allocated and defined by vendor driver.
The vendor driver during QP creation decides when the new path will be used
setting a field use_shpage_for_rxtx field in a connection context.

When the connection context indicates that the shared page  should be used
the uverbs_post_send()/uverbs_post_recv() calls diretly the vendor device
post_send()/post_recv() functions improving the kernel path performance.

Signed-off-by: Mirek Walukiewicz <miroslaw.walukiewicz-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---

 drivers/infiniband/core/uverbs_cmd.c |   55 +++++++++++++++++++++++++++-------
 include/rdma/ib_verbs.h              |    1 +
 2 files changed, 45 insertions(+), 11 deletions(-)


diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index c426992..ba6655c 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -299,6 +299,7 @@ ssize_t ib_uverbs_get_context(struct ib_uverbs_file *file,
 	INIT_LIST_HEAD(&ucontext->srq_list);
 	INIT_LIST_HEAD(&ucontext->ah_list);
 	ucontext->closing = 0;
+	ucontext->use_shpage_for_rxtx = 0;
 
 	resp.num_comp_vectors = file->device->num_comp_vectors;
 
@@ -1448,15 +1449,31 @@ ssize_t ib_uverbs_post_send(struct ib_uverbs_file *file,
 
 	if (cmd.wqe_size < sizeof (struct ib_uverbs_send_wr))
 		return -EINVAL;
+	qp = idr_read_qp(cmd.qp_handle, file->ucontext);
+	if (!qp)
+		goto out_raw_qp;
+
+	if (file->ucontext->use_shpage_for_rxtx) {
+		/* pass NULL pointers as the information about */
+		/* buffers is passed using endor defined shared page */
+		resp.bad_wr = 0;
+		ret = qp->device->post_send(qp, NULL, NULL);
+		if (ret)
+			resp.bad_wr = cmd.wr_count;
+
+		if (copy_to_user((void __user *) (unsigned long)
+				cmd.response,
+				&resp,
+				sizeof resp))
+			ret = -EFAULT;
+		put_qp_read(qp);
+		goto out_raw_qp;
+	}
 
 	user_wr = kmalloc(cmd.wqe_size, GFP_KERNEL);
 	if (!user_wr)
 		return -ENOMEM;
 
-	qp = idr_read_qp(cmd.qp_handle, file->ucontext);
-	if (!qp)
-		goto out;
-
 	is_ud = qp->qp_type == IB_QPT_UD;
 	sg_ind = 0;
 	last = NULL;
@@ -1576,9 +1593,8 @@ out_put:
 		wr = next;
 	}
 
-out:
 	kfree(user_wr);
-
+out_raw_qp:
 	return ret ? ret : in_len;
 }
 
@@ -1680,16 +1696,33 @@ ssize_t ib_uverbs_post_recv(struct ib_uverbs_file *file,
 	if (copy_from_user(&cmd, buf, sizeof cmd))
 		return -EFAULT;
 
+	qp = idr_read_qp(cmd.qp_handle, file->ucontext);
+	if (!qp)
+		goto out_raw_qp;
+
+	if (file->ucontext->use_shpage_for_rxtx) {
+		resp.bad_wr = 0;
+		/* pass NULL pointers as the information about */
+		/* buffers is passed using endor defined shared page */
+		ret = qp->device->post_recv(qp, NULL, NULL);
+		if (ret)
+			resp.bad_wr = cmd.wr_count;
+
+		if (copy_to_user((void __user *) (unsigned long)
+				cmd.response,
+				&resp,
+				sizeof resp))
+			ret = -EFAULT;
+		put_qp_read(qp);
+		goto out_raw_qp;
+	}
+
 	wr = ib_uverbs_unmarshall_recv(buf + sizeof cmd,
 				       in_len - sizeof cmd, cmd.wr_count,
 				       cmd.sge_count, cmd.wqe_size);
 	if (IS_ERR(wr))
 		return PTR_ERR(wr);
 
-	qp = idr_read_qp(cmd.qp_handle, file->ucontext);
-	if (!qp)
-		goto out;
-
 	resp.bad_wr = 0;
 	ret = qp->device->post_recv(qp, wr, &bad_wr);
 
@@ -1706,13 +1739,13 @@ ssize_t ib_uverbs_post_recv(struct ib_uverbs_file *file,
 			 &resp, sizeof resp))
 		ret = -EFAULT;
 
-out:
 	while (wr) {
 		next = wr->next;
 		kfree(wr);
 		wr = next;
 	}
 
+out_raw_qp:
 	return ret ? ret : in_len;
 }
 
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 55cd0a0..ab31c03 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -831,6 +831,7 @@ struct ib_ucontext {
 	struct list_head	srq_list;
 	struct list_head	ah_list;
 	int			closing;
+	int                     use_shpage_for_rxtx;
 };
 
 struct ib_uobject {


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

end of thread, other threads:[~2011-05-19 22:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-24 12:43 [PATCH] RDMA/core: Optimized path for kernel post_send/post_recv miroslaw.walukiewicz-ral2JQCrhuEAvxtiuMwx3w
     [not found] ` <20110324123937.19461.56781.stgit-dAdtdUp2yJRU7keBU/FxOFDQ4js95KgL@public.gmane.org>
2011-03-24 19:56   ` Roland Dreier
2011-05-19 20:51   ` Steve Wise
     [not found]     ` <4DD582E9.6020509-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
2011-05-19 22:48       ` Roland Dreier
  -- strict thread matches above, loose matches on Subject: below --
2011-02-22 11:50 miroslaw.walukiewicz-ral2JQCrhuEAvxtiuMwx3w

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.