ib_core: implement XRC RCV qp's
PATCH 2/4 ib_core: implement XRC RCV qp's
Added creation of XRC receive-only QPs for userspace, which reside in kernel space (user cannot post-to or poll these QPs).
Motivation: MPI community requires XRC receive QPs which will not be destroyed when the creating process terminates.
Solution: Userspace requests that a QP be created in kernel space. Each userspace process using that QP (i.e. receiving packets on an XRC SRQ via the qp), registers with that QP. When the last userspace user unregisters with the QP, it is destroyed. Unregistration is also part of userspace process cleanup, so there is no leakage.
This patch implements the kernel procedures to implement the following (new) libibverbs API:ibv_create_xrc_rcv_qpibv_modify_xrc_rcv_qpibv_query_xrc_rcv_qpibv_reg_xrc_rcv_qpibv_unreg_xrc_rcv_qpibv_destroy_xrc_rcv_qp
Note that for users who do not wish to utilize the reg/unreg verbs, a destroy_xrc_rcv_qp verb is also provided. Thus, usage is:
Either: create/destroy_xrc_rcv_qp
Or: create/reg/unreg_xrc_rcv_qp (the unreg is used in place of destroy)
In addition, the patch implements the foundation for distributing XRC-receive-only-QP events to userspace processes registered with that QP.
--- drivers/infiniband/core/uverbs.h | 11 + drivers/infiniband/core/uverbs_cmd.c | 427 +++++++++++++++++++++++++++++++++ drivers/infiniband/core/uverbs_main.c | 25 ++ include/rdma/ib_user_verbs.h | 86 +++++++- include/rdma/ib_verbs.h | 32 +++ 5 files changed, 580 insertions(+), 1 deletions(-)
drivers/infiniband/core/uverbs.h +11 -0
@@ -176,6 +176,10 @@ void ib_uverbs_event_handler(struct ib_event_handler *handler, struct ib_event *event);void ib_uverbs_dealloc_xrcd (struct ib_uverbs_device *dev,struct ib_xrcd *xrcd); +void ib_uverbs_xrc_rcv_qp_event_handler (struct ib_event *event, +void *context_ptr); +int ib_uverbs_cleanup_xrc_rcv_qp (struct ib_uverbs_file *file, +u32 xrcd_handle,u32 qp_num);#define IB_UVERBS_DECLARE_CMD (name) \ ssize_t ib_uverbs_##name(struct ib_uverbs_file *file, \
@@ -213,5 +217,12 @@ IB_UVERBS_DECLARE_CMD(destroy_srq);IB_UVERBS_DECLARE_CMD (create_xrc_srq);IB_UVERBS_DECLARE_CMD (open_xrcd);IB_UVERBS_DECLARE_CMD (close_xrcd); +IB_UVERBS_DECLARE_CMD (create_xrc_rcv_qp); +IB_UVERBS_DECLARE_CMD (modify_xrc_rcv_qp); +IB_UVERBS_DECLARE_CMD (query_xrc_rcv_qp); +IB_UVERBS_DECLARE_CMD (reg_xrc_rcv_qp); +IB_UVERBS_DECLARE_CMD (unreg_xrc_rcv_qp); +IB_UVERBS_DECLARE_CMD (destroy_xrc_rcv_qp); +#endif /* UVERBS_H */
drivers/infiniband/core/uverbs_cmd.c +427 -0
442 lines not on this page · raw message
drivers/infiniband/core/uverbs_main.c +25 -0
@@ -113,6 +113,12 @@ static ssize_t (*uverbs_cmd_table[])(struct ib_uverbs_file *file, [IB_USER_VERBS_CMD_CREATE_XRC_SRQ] = ib_uverbs_create_xrc_srq, [IB_USER_VERBS_CMD_OPEN_XRCD] = ib_uverbs_open_xrcd, [IB_USER_VERBS_CMD_CLOSE_XRCD] = ib_uverbs_close_xrcd, + [IB_USER_VERBS_CMD_CREATE_XRC_RCV_QP] = ib_uverbs_create_xrc_rcv_qp, + [IB_USER_VERBS_CMD_MODIFY_XRC_RCV_QP] = ib_uverbs_modify_xrc_rcv_qp, + [IB_USER_VERBS_CMD_QUERY_XRC_RCV_QP] = ib_uverbs_query_xrc_rcv_qp, + [IB_USER_VERBS_CMD_REG_XRC_RCV_QP] = ib_uverbs_reg_xrc_rcv_qp, + [IB_USER_VERBS_CMD_UNREG_XRC_RCV_QP] = ib_uverbs_unreg_xrc_rcv_qp, + [IB_USER_VERBS_CMD_DESTROY_XRC_RCV_QP] = ib_uverbs_destroy_xrc_rcv_qp, };static struct vfsmount *uverbs_event_mnt;
@@ -250,6 +256,17 @@ static int ib_uverbs_cleanup_ucontext(struct ib_uverbs_file *file,kfree (uobj); } + { +struct ib_uxrc_rcv_qp_object *obj, *x; +list_for_each_entry_safe (obj, x, &context->xrc_rcv_qp_list, + list) { +ib_uverbs_cleanup_xrc_rcv_qp (file, obj->domain_handle, + obj->qp_num); +list_del (&obj->list); +kfree (obj); + } + } +mutex_lock (&file->device->xrcd_tree_mutex);list_for_each_entry_safe (uobj, tmp, &context->xrcd_list, list) {struct ib_xrcd *xrcd = uobj->object;
@@ -505,6 +522,14 @@ void ib_uverbs_event_handler(struct ib_event_handler *handler, NULL, NULL); } +void ib_uverbs_xrc_rcv_qp_event_handler (struct ib_event *event, +void *context_ptr) +{ +ib_uverbs_async_handler (context_ptr, event->element.xrc_qp_num, + event->event,NULL ,NULL ); +} + +struct file *ib_uverbs_alloc_event_file (struct ib_uverbs_file *uverbs_file,int is_async,int *fd) {
include/rdma/ib_user_verbs.h +85 -1
96 lines not on this page · raw message
include/rdma/ib_verbs.h +32 -0
@@ -344,12 +344,17 @@ enum ib_event_type {IB_EVENT_CLIENT_REREGISTER }; +enum ib_event_flags { +IB_XRC_QP_EVENT_FLAG =0x80000000 , +}; +struct ib_event {struct ib_device *device;union {struct ib_cq *cq;struct ib_qp *qp;struct ib_srq *srq; +u32 xrc_qp_num;u8 port_num; } element;enum ib_event_type event;
@@ -819,6 +824,7 @@ struct ib_ucontext {struct list_head srq_list;struct list_head ah_list;struct list_head xrcd_list; +struct list_head xrc_rcv_qp_list;int closing; };
@@ -852,6 +858,12 @@ struct ib_xrcd {atomic_t usecnt;/* count all resources */ }; +struct ib_uxrc_rcv_qp_object { +struct list_head list;/* link to context's list */ +u32 qp_num; +u32 domain_handle; +}; +struct ib_ah {struct ib_device *device;struct ib_pd *pd;
@@ -1154,6 +1166,26 @@ struct ib_device {struct ib_ucontext *context, struct ib_udata *udata);int (*dealloc_xrcd)(struct ib_xrcd *xrcd); +int (*create_xrc_rcv_qp)(struct ib_qp_init_attr *init_attr, +u32 *qp_num); +int (*modify_xrc_rcv_qp)(struct ib_xrcd *xrcd, +u32 qp_num, +struct ib_qp_attr *attr, +int attr_mask); +int (*query_xrc_rcv_qp)(struct ib_xrcd *xrcd, +u32 qp_num, +struct ib_qp_attr *attr, +int attr_mask, +struct ib_qp_init_attr *init_attr); +int (*reg_xrc_rcv_qp)(struct ib_xrcd *xrcd, +void *context, +u32 qp_num); +int (*unreg_xrc_rcv_qp)(struct ib_xrcd *xrcd, +void *context, +u32 qp_num); +int (*destroy_xrc_rcv_qp)(struct ib_xrcd *xrcd, +void *context, +u32 qp_num);struct ib_dma_mapping_ops *dma_ops;
Signature · 6 lines
1.6.3.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 201002281102.21207.jackm-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org
So I'm looking at merging this, and I'm wondering about one thing. Seems like it's just a mistake but I want to make sure I understand properly:
drivers/infiniband/core/uverbs_cmd.c ssize_t ib_uverbs_create_qp(struct ib_uverbs_file *file, · line 1083
Quoted 6 lines
drivers/infiniband/core/uverbs_cmd.c +1
-0@@ -1078,6 +1079,7 @@ ssize_t ib_uverbs_create_qp(struct ib_uverbs_file *file, goto err_put; } + attr.create_flags =0 ; attr.event_handler = ib_uverbs_qp_event_handler;
This looks redundant, because this function already sets create_flags to 0 a few lines later. So I think this line is just a remnant from some other patch.
But then ib_uverbs_create_xrc_rcv_qp() doesn't set create_flags before the call to device->create_xrc_rcv_qp() -- which maybe is OK, since that function is not going to look at create_flags right now, but for the future we should probably set it to 0, right?
Also it's not 100% clear to me why the low-level driver needs a special create_xrc_rcv_qp method, rather than having uverbs just call create_qp with the right parameters. But I haven't looked throught carefully to see the differences between eg query_xrc_rcv_qp() vs query_qp() methods.
- R.
Signature · 6 lines
Roland Dreier <[email protected]> || For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/index.html -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): adaljcfmkj9.fsf-BjVyx320WGW9gfZ95n9DRSW4+XlvGpQz@public.gmane.org
Quoted 8 lines · Roland Dreier
So I'm looking at merging this, and I'm wondering about one thing. Seems like it's just a mistake but I want to make sure I understand properly:
Quoted 4 lines
drivers/infiniband/core/uverbs_cmd.c +0
-0@@ -1078,6 +1079,7 @@ ssize_t ib_uverbs_create_qp(struct ib_uverbs_file *file, goto err_put; }
Quoted 6 lines
drivers/infiniband/core/uverbs_cmd.c ssize_t ib_uverbs_create_qp(struct ib_uverbs_file *file, · line 1083
Quoted 2 lines
drivers/infiniband/core/uverbs_cmd.c +1
-0+ attr.create_flags =0 ; attr.event_handler = ib_uverbs_qp_event_handler;This looks redundant, because this function already sets
create_flagsto 0 a few lines later. So I think this line is just a remnant from some other patch.
You're correct.
Quoted 5 lines
But then
ib_uverbs_create_xrc_rcv_qp()doesn't setcreate_flagsbefore the call todevice->create_xrc_rcv_qp()-- which maybe is OK, since that function is not going to look atcreate_flagsright now, but for the future we should probably set it to 0, right?
Can't hurt.
Quoted 3 lines
Also it's not 100% clear to me why the low-level driver needs a special
create_xrc_rcv_qpmethod, rather than having uverbs just callcreate_qpwith the right parameters.
I did not want to have the verbs layer dictate implementation details to the low-level driver. It is more correct, in my opinion, to have each low-level driver decide for itself on implementation. Therefore, the separate method. However, please note that I re-use the qp_create_common() method in mlx4_ib_create_xrc_rcv_qp.
Quoted 3 lines
But I haven't looked throught carefully to
see the differences between egquery_xrc_rcv_qp()vsquery_qp()methods.
Same comment.
Quoted 1 line
- R.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 4 lines
Note that for users who do not wish to utilize the reg/unreg verbs, a
destroy_xrc_rcv_qpverb is also provided. Thus, usage is:
Either: create/destroy_xrc_rcv_qp
Or: create/reg/unreg_xrc_rcv_qp (the unreg is used in place of destroy)
I don't really understand the semantics here. What is supposed to happen if I do create/reg/destroy? What happens if one process does destroy while another process is still registered? To make everything even more confusing, mlx4 defines unreg_rxc_rcv_qp to be equivalent to destroy_xrc_rcv_qp. I'm not even clear why the low-level driver has two entry points for these two methods -- shouldn't the uverbs core be handling the counting/listing of xrc rcv qps and just ask the low-level driver to destroy the QP when it's really done with it?
(By the way, should we use the name "target QP" instead of "rcv QP" to match the actual IB spec?)
- R.
Signature · 6 lines
Roland Dreier <[email protected]> || For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/index.html -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): adavdbaxcs1.fsf-BjVyx320WGW9gfZ95n9DRSW4+XlvGpQz@public.gmane.org
Quoted 8 lines · Roland Dreier
Quoted 4 lines
Note that for users who do not wish to utilize the reg/unreg verbs, a
destroy_xrc_rcv_qpverb is also provided. Thus, usage is:
Either: create/destroy_xrc_rcv_qp
Or: create/reg/unreg_xrc_rcv_qp (the unreg is used in place of destroy)I don't really understand the semantics here. What is supposed to happen if I do create/reg/destroy?> What happens if one process does destroy while another process is still registered?
Maybe we can simply assert that the unreg IS the destroy method of the IB_SPEC, and get rid of the destroy method.
The xrc target qp section of the spec was not written with QP persistence (after the creating process exited) in mind. That requirement surfaced at the last minute as a result of testing by the MPI community during the implementation phase (as far as I know). Unfortunately, this created a semantic problem.
For applications in which the creating process persists until all other processes which use the XRC RCV QP have finished with it, no reg/unreg is needed -- and the API that makes the most sense is create/destroy.
For apps which DO need persistence, we also need a reg/unreg for reference counting. In that situation, destroy_xrc_rcv_qp does not make sense as a pure destroy -- it functions as unreg_xrc_rcv_qp, since it must function within the reference counting context (unreg also destroys the QP in the low-level driver when there are no more references to it). In fact, in this case the semantics of destroy is identical to the semantics of unreg.
I do not see a clean way out of this mess other than to eliminate the destroy_xrc_rcv_qp method and claim that the unreg is in fact the destroy method of the SPEC.
Quoted 3 lines
To make everything
even more confusing, mlx4 definesunreg_rxc_rcv_qpto be equivalent todestroy_xrc_rcv_qp.
I simply noticed that if reg is not used, then the unreg would in fact destroy the QP. I therefore saw no reason to implement the destroy method separately.
Quoted 4 lines
I'm not even clear why the low-level driver has two
entry points for these two methods -- shouldn't the uverbs core be handling the counting/listing of xrc rcv qps and just ask the low-level driver to destroy the QP when it's really done with it?
The uverbs layer DOES handle the counting/listing (see, for example, list_add_tail at the end of ib_uverbs_create_xrc_rcv_qp.
However, I had an additional problem -- to distribute async events received for the xrc_rcv QP to all registered processes (so that each could unregister and allow the QP to be destroyed -- the ref count going to zero).
In my original implementation, the low-level driver was responsible for generating the events for all the processes. To move this mechanism to the core would require a fairly extensive re-write. I would need to introduce ib_core methods for create, reg, unreg, and destroy, since the uverbs layer operates per user process and does not track across multiple processes. I was concerned that modifications of this magnitude would introduce instability in XRC, and would require a significant QA cycle
Finally, I do not believe that it is such a bad thing to have low-level driver procedures for reg/unreg here. If a given low-level driver has implementation details that it wishes to record, it should have the opportunity to do so.
Quoted 3 lines
(By the way, should we use the name "target QP" instead of "rcv QP" to match the actual IB spec?)
I would rather not, since the xrc_rcv QP function names have been in use for 2 years already.
Quoted 1 line
- R.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 201005050945.05729.jackm-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org
Quoted 4 lines
Quoted 3 lines
I don't really understand the semantics here. What is supposed to happen if I do create/reg/destroy?> What happens if one process does destroy while another process is still registered?
Quoted 8 lines
Maybe we can simply assert that the unreg IS the destroy method of the
IB_SPEC, and get rid of the destroy method.The xrc target qp section of the spec was not written with QP persistence (after the creating process exited) in mind. That requirement surfaced at the last minute as a result of testing by the MPI community during the implementation phase (as far as I know). Unfortunately, this created a semantic problem.
Yes, I think we should try to simplify things here.
It's very unfortunate to diverge from the API that's been shipped for a while now, but I really think we don't want all these different ways of saying the same thing, with little difference between create and reg, and between destroy and unreg.
In fact the smallest possible API would be just
register_xrc_rcv_qp(xrcd, *qp_num)
where the user can pass in an invalid qp_num (say, -1 aka ffffffff) and have a new QP created, or a valid one to take a new ref on the existing rcv QP, and
unregister_xrc_rcv_qp(xrcd, qp_num).
(along these lines, the structure in these patches:
+struct ib_uverbs_create_xrc_rcv_qp {
+ __u64 response;
+ __u64 user_handle;
+ __u32 xrcd_handle;
+ __u32 max_send_wr;
+ __u32 max_recv_wr;
+ __u32 max_send_sge;
+ __u32 max_recv_sge;
+ __u32 max_inline_data;
+ __u8 sq_sig_all; + __u8 qp_type; + __u8 reserved[6];
+ __u64 driver_data[0];
+};
has many fields we don't need. Pretty much all the fields after xrcd_handle are ignored, except sq_sig_all is used -- and that is highly dubious since the rcv QP has no SQ! So I would propose something like just having:
+struct ib_uverbs_reg_xrc_rcv_qp {
+ __u64 response;
+ __u32 xrcd_handle;
+ __u32 qp_num;
+ __u64 driver_data[0];
+};
where response is used to pass back the qp_num in the create case.
And then we just have unreg_xrc_rcv_qp and no destroy method (since they are synonymous anyway).
Signature · 6 lines
Roland Dreier <[email protected]> || For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/index.html -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): adaeihqas5y.fsf-BjVyx320WGW9gfZ95n9DRSW4+XlvGpQz@public.gmane.org
Dr. Panda, Jeff, and Ishai,
We are trying to get XRC integrated into the next mainstream kernel.
For the kernel submission, I added a destroy_xrc_rcv_qp method (to be used if the application did not require persistence of the xrc_rcv qp after the creating process terminated -- per Diego Copernicoff's request). This did not affect the core API of create/modify/unreg that you have been using until now.
However, even without the new destroy method (as I suggest below), having the creating process call unreg is still a bit counterintuitive, since it calls create, and registration is a side-effect.
Roland is now intensively reviewing the XRC patches, and a made suggestion to simplify the API which Tziporet and I agree with (see Roland's comments below).
Please comment on this suggestion (which is to have reg_xrc_rcv_qp do create as well).
This is a minor change, that would require two changes in your current calls:
1. Instead of calling create_xrc_rcv_qp(), as is done currently, MPI would call
u32 qp_num = 0xFFFFFFFF; err = reg_xrc_rcv_qp(xrcd, &qp_num);
and would have the created qp number returned in qp_num;
(the qp_init attributes in the old create_xrc_rcv_qp are all ignored except for the xrc domain handle anyway)
2. instead of calling reg_xrc_rcv_qp(xrcd, qp_num), you would need to set the qp number in a u32 variable, and call reg_xrc_rcv_qp(xrcd, &qp_num).
The other xrc_rcv_qp verbs would work as they work now.
Regarding OFED, this change would not affect OFED 1.5.x ; it would only enter OFED at 1.6.x.
Please comment.
-Jack
P.S. You can see the submission/discussion of XRC starting at:
http://www.mail-archive.com/[email protected]/msg02792.html
Quoted 59 lines · Roland Dreier
Quoted 4 lines
Quoted 3 lines
I don't really understand the semantics here. What is supposed to happen if I do create/reg/destroy?> What happens if one process does destroy while another process is still registered?
Quoted 8 lines
Maybe we can simply assert that the unreg IS the destroy method of the
IB_SPEC, and get rid of the destroy method.The xrc target qp section of the spec was not written with QP persistence (after the creating process exited) in mind. That requirement surfaced at the last minute as a result of testing by the MPI community during the implementation phase (as far as I know). Unfortunately, this created a semantic problem.
Yes, I think we should try to simplify things here.
It's very unfortunate to diverge from the API that's been shipped for a while now, but I really think we don't want all these different ways of saying the same thing, with little difference between create and reg, and between destroy and unreg.
In fact the smallest possible API would be just
register_xrc_rcv_qp(xrcd, *qp_num)where the user can pass in an invalid
qp_num(say, -1 aka ffffffff) and have a new QP created, or a valid one to take a new ref on the existing rcv QP, and
unregister_xrc_rcv_qp(xrcd, qp_num).(along these lines, the structure in these patches:
(quoted diff) +14
-0+struct ib_uverbs_create_xrc_rcv_qp { + __u64 response; + __u64 user_handle; + __u32 xrcd_handle; + __u32 max_send_wr; + __u32 max_recv_wr; + __u32 max_send_sge; + __u32 max_recv_sge; + __u32 max_inline_data; + __u8 sq_sig_all; + __u8 qp_type; + __u8 reserved[6]; + __u64 driver_data[0]; +};has many fields we don't need. Pretty much all the fields after
xrcd_handleare ignored, exceptsq_sig_allis used -- and that is highly dubious since the rcv QP has no SQ! So I would propose something like just having:(quoted diff) +6
-0+struct ib_uverbs_reg_xrc_rcv_qp { + __u64 response; + __u32 xrcd_handle; + __u32 qp_num; + __u64 driver_data[0]; +};
Quoted 4 lines
where response is used to pass back the
qp_numin the create case.And then we just have
unreg_xrc_rcv_qpand no destroy method (since they are synonymous anyway).
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 201005081028.20327.jackm-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org
Hi Jack,
Thanks for your note and the suggested changes. I will discuss this with my team members and get back to you with our thoughts next week.
Thanks,
DK
Quoted 101 lines · Jack Morgenstein
Dr. Panda, Jeff, and Ishai,
We are trying to get XRC integrated into the next mainstream kernel.
For the kernel submission, I added a
destroy_xrc_rcv_qpmethod (to be used if the application did not require persistence of thexrc_rcvqp after the creating process terminated -- per Diego Copernicoff's request). This did not affect the core API of create/modify/unreg that you have been using until now.However, even without the new destroy method (as I suggest below), having the creating process call unreg is still a bit counterintuitive, since it calls create, and registration is a side-effect.
Roland is now intensively reviewing the XRC patches, and a made suggestion to simplify the API which Tziporet and I agree with (see Roland's comments below).
Please comment on this suggestion (which is to have
reg_xrc_rcv_qpdo create as well).
This is a minor change, that would require two changes in your current calls:
1. Instead of callingcreate_xrc_rcv_qp(), as is done currently, MPI would callu32 qp_num = 0xFFFFFFFF; err = reg_xrc_rcv_qp(xrcd, &qp_num);and would have the created qp number returned in
qp_num;
(theqp_initattributes in the oldcreate_xrc_rcv_qpare all ignored except for the xrc domain handle anyway)2. instead of calling
reg_xrc_rcv_qp(xrcd, qp_num), you would need to set the qp number in a u32 variable, and callreg_xrc_rcv_qp(xrcd, &qp_num).The other
xrc_rcv_qpverbs would work as they work now.Regarding OFED, this change would not affect OFED 1.5.x ; it would only enter OFED at 1.6.x.
Please comment.
-Jack
P.S. You can see the submission/discussion of XRC starting at:http://www.mail-archive.com/[email protected]/msg02792.htmlQuoted 59 lines · Roland Dreier
Quoted 4 lines
Quoted 3 lines
I don't really understand the semantics here. What is supposed to happen if I do create/reg/destroy?> What happens if one process does destroy while another process is still registered?
Quoted 8 lines
Maybe we can simply assert that the unreg IS the destroy method of the
IB_SPEC, and get rid of the destroy method.The xrc target qp section of the spec was not written with QP persistence (after the creating process exited) in mind. That requirement surfaced at the last minute as a result of testing by the MPI community during the implementation phase (as far as I know). Unfortunately, this created a semantic problem.
Yes, I think we should try to simplify things here.
It's very unfortunate to diverge from the API that's been shipped for a while now, but I really think we don't want all these different ways of saying the same thing, with little difference between create and reg, and between destroy and unreg.
In fact the smallest possible API would be just
register_xrc_rcv_qp(xrcd, *qp_num)where the user can pass in an invalid
qp_num(say, -1 aka ffffffff) and have a new QP created, or a valid one to take a new ref on the existing rcv QP, and
unregister_xrc_rcv_qp(xrcd, qp_num).(along these lines, the structure in these patches:
(quoted diff) +14
-0+struct ib_uverbs_create_xrc_rcv_qp { + __u64 response; + __u64 user_handle; + __u32 xrcd_handle; + __u32 max_send_wr; + __u32 max_recv_wr; + __u32 max_send_sge; + __u32 max_recv_sge; + __u32 max_inline_data; + __u8 sq_sig_all; + __u8 qp_type; + __u8 reserved[6]; + __u64 driver_data[0]; +};has many fields we don't need. Pretty much all the fields after
xrcd_handleare ignored, exceptsq_sig_allis used -- and that is highly dubious since the rcv QP has no SQ! So I would propose something like just having:(quoted diff) +6
-0+struct ib_uverbs_reg_xrc_rcv_qp { + __u64 response; + __u32 xrcd_handle; + __u32 qp_num; + __u64 driver_data[0]; +};
Quoted 5 lines
Quoted 4 lines
where response is used to pass back the
qp_numin the create case.And then we just have
unreg_xrc_rcv_qpand no destroy method (since they are synonymous anyway).
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
It should not be a problem in open MPI.
Is there going to be a change in the library version number?
Ishai
-----Original Message-----
From: Jack Morgenstein [mailto:[email protected]]
Sent: Saturday, May 08, 2010 10:28 AM
To: Roland Dreier
Cc: [email protected]; [email protected]; Tziporet Koren; [email protected]; [email protected]; Ishai Rabinovitz
Subject: Re: [PATCH 2/4] ib_core: implement XRC RCV qp's
Dr. Panda, Jeff, and Ishai,
We are trying to get XRC integrated into the next mainstream kernel.
For the kernel submission, I added a destroy_xrc_rcv_qp method (to be used if the application did not require persistence of the xrc_rcv qp after the creating process terminated -- per Diego Copernicoff's request). This did not affect the core API of create/modify/unreg that you have been using until now.
However, even without the new destroy method (as I suggest below), having the creating process call unreg is still a bit counterintuitive, since it calls create, and registration is a side-effect.
Roland is now intensively reviewing the XRC patches, and a made suggestion to simplify the API which Tziporet and I agree with (see Roland's comments below).
Please comment on this suggestion (which is to have reg_xrc_rcv_qp do create as well).
This is a minor change, that would require two changes in your current calls:
1. Instead of calling create_xrc_rcv_qp(), as is done currently, MPI would call
u32 qp_num = 0xFFFFFFFF; err = reg_xrc_rcv_qp(xrcd, &qp_num);
and would have the created qp number returned in qp_num;
(the qp_init attributes in the old create_xrc_rcv_qp are all ignored except for the xrc domain handle anyway)
2. instead of calling reg_xrc_rcv_qp(xrcd, qp_num), you would need to set the qp number in a u32 variable, and call reg_xrc_rcv_qp(xrcd, &qp_num).
The other xrc_rcv_qp verbs would work as they work now.
Regarding OFED, this change would not affect OFED 1.5.x ; it would only enter OFED at 1.6.x.
Please comment.
-Jack
P.S. You can see the submission/discussion of XRC starting at:
http://www.mail-archive.com/[email protected]/msg02792.html
Quoted 59 lines · Roland Dreier
Quoted 4 lines
Quoted 3 lines
I don't really understand the semantics here. What is supposed to happen if I do create/reg/destroy?> What happens if one process does destroy while another process is still registered?
Quoted 8 lines
Maybe we can simply assert that the unreg IS the destroy method of the
IB_SPEC, and get rid of the destroy method.The xrc target qp section of the spec was not written with QP persistence (after the creating process exited) in mind. That requirement surfaced at the last minute as a result of testing by the MPI community during the implementation phase (as far as I know). Unfortunately, this created a semantic problem.
Yes, I think we should try to simplify things here.
It's very unfortunate to diverge from the API that's been shipped for a while now, but I really think we don't want all these different ways of saying the same thing, with little difference between create and reg, and between destroy and unreg.
In fact the smallest possible API would be just
register_xrc_rcv_qp(xrcd, *qp_num)where the user can pass in an invalid
qp_num(say, -1 aka ffffffff) and have a new QP created, or a valid one to take a new ref on the existing rcv QP, and
unregister_xrc_rcv_qp(xrcd, qp_num).(along these lines, the structure in these patches:
(quoted diff) +14
-0+struct ib_uverbs_create_xrc_rcv_qp { + __u64 response; + __u64 user_handle; + __u32 xrcd_handle; + __u32 max_send_wr; + __u32 max_recv_wr; + __u32 max_send_sge; + __u32 max_recv_sge; + __u32 max_inline_data; + __u8 sq_sig_all; + __u8 qp_type; + __u8 reserved[6]; + __u64 driver_data[0]; +};has many fields we don't need. Pretty much all the fields after
xrcd_handleare ignored, exceptsq_sig_allis used -- and that is highly dubious since the rcv QP has no SQ! So I would propose something like just having:(quoted diff) +6
-0+struct ib_uverbs_reg_xrc_rcv_qp { + __u64 response; + __u32 xrcd_handle; + __u32 qp_num; + __u64 driver_data[0]; +};
Quoted 4 lines
where response is used to pass back the
qp_numin the create case.And then we just have
unreg_xrc_rcv_qpand no destroy method (since they are synonymous anyway).
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 2 lines
The uverbs layer DOES handle the counting/listing (see, for example,
list_add_tailat the end ofib_uverbs_create_xrc_rcv_qp.
But that is the per-process list of rcv QPs... not the reference counting for each rcv QP. Look at how trivial ib_uverbs_destroy_xrc_rcv_qp is -- there is no reference counting of the real object there.
Quoted 10 lines
However, I had an additional problem -- to distribute async events received for the
xrc_rcvQP to all registered processes (so that each could unregister and allow the QP to be destroyed -- the ref count going to zero).In my original implementation, the low-level driver was responsible for generating the events for all the processes. To move this mechanism to the core would require a fairly extensive re-write. I would need to introduce
ib_coremethods for create, reg, unreg, and destroy, since the uverbs layer operates per user process and does not track across multiple processes. I was concerned that modifications of this magnitude would introduce instability in XRC, and would require a significant QA cycle
It seems to me that it should, if anything, be easier to track all these lists at the uverbs layer. We already have a global xrcd structure for each xrcd that we could easily stick a list of rcv QPs in (and keep the list of rcv QP registrations per rcv QP).
I do see your point that the changes might be fairly large (although the total XRC code is not so big), but we shouldn't stick ourselves with a wrong implementation just because that implementation was already tested.
Quoted 3 lines
Finally, I do not believe that it is such a bad thing to have low-level driver procedures for reg/unreg here. If a given low-level driver has implementation details that it wishes to record, it should have the opportunity to do so.
Hmm. I'm having a hard time imagining what those details are -- I really do feel that this tracking of per-process reference counting etc is something that we should do once in the core, rather than hiding it in low-level drivers.
- R.
Signature · 6 lines
Roland Dreier <[email protected]> || For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/index.html -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): adaaasearf5.fsf-BjVyx320WGW9gfZ95n9DRSW4+XlvGpQz@public.gmane.org
Quoted 7 lines · Roland Dreier
> In my original implementation, the low-level driver was responsible for generating > the events for all the processes. To move this mechanism to the core would require > a fairly extensive re-write. I would need to introduce
ib_coremethods for create, > reg, unreg, and destroy, since the uverbs layer operates per user process and does > not track across multiple processes. I was concerned that modifications of this > magnitude would introduce instability in XRC, and would require a significant QA cycle
Quoted 5 lines
It seems to me that it should, if anything, be easier to track all these lists at the uverbs layer. We already have a global xrcd structure for each xrcd that we could easily stick a list of rcv QPs in (and keep the list of rcv QP registrations per rcv QP).
Roland,
While examining your proposed solution, I ran into the following difficulty. In order to avoid the reg/unreg verbs in the low-level driver, I need to move event handling for XRC RCV qp's to the core layer.
Currently, the low-level driver maintains, for each XRC RCV qp a list of user contexts which are registered to that QP -- and generates an event for each of those contexts. (this is so that each of the contexts may unregister, thus allowing the QP to be destroyed).
To move this to the core requires that I maintain a global list of all xrc_rcv QPs, and per QP, a list of contexts registered to it -- regardless of which xrc domain the xrc rcv QP is attached to (I do not have xrc domain information in the XRC RCV qp event).
Thus, I do not see how we can reasonably use the global xrcd structure for this purpose. (I don't see searching all xrc domains for the QP as a reasonable solution).
I am therefore back at my proposal above to introduce ib_core methods: ib_reg_xrc_rcv_qp and ib_unreg_xrc_rcv_qp (using the reg for create as well, and the unreg for destroy as well, as you suggested in a subsequent mail). That way, I can track xrc rcv QPs, and keep a list per QP of process files to signal an event to.
I have an initial implementation of this which I will clean up and send you for review (actually, an implementation which has the ib_create_xrc_rcv_qp/ib_destroy_xrc_rcv_qp, and which does not need the low-level driver implementations of reg/unreg. I started off with this implementation, and discontinued it when I noticed how different it was from the original XRC RCV implementation... but saved it just in case).
Comments?
-Jack
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 201005101301.43113.jackm-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org
Quoted 6 lines · Jack Morgenstein
I have an initial implementation of this which I will clean up and send you for review (actually, an implementation which has the ib_create_xrc_rcv_qp/ib_destroy_xrc_rcv_qp, and which does not need the low-level driver implementations of reg/unreg. I started off with this implementation, and discontinued it when I noticed how different it was from the original XRC RCV implementation... but saved it just in case).
I remember now why I discontinued developing this implementation. There is no provision for core-layer-only verbs in the core driver.
To implement ib_reg_xrc_rcv_qp/ib_unreg_xrc_rcv_qp (when I still had the create and destroy verbs), I needed to declare these in the uverbs_cmd_mask in the low-level driver.
(from procedure mlx4_ib_add, in file hw/mlx4/main.c:)
ibdev->ib_dev.uverbs_cmd_mask |= (1ull << IB_USER_VERBS_CMD_CREATE_XRC_SRQ) | (1ull << IB_USER_VERBS_CMD_OPEN_XRCD) | (1ull << IB_USER_VERBS_CMD_CLOSE_XRCD) | (1ull << IB_USER_VERBS_CMD_CREATE_XRC_RCV_QP) | (1ull << IB_USER_VERBS_CMD_MODIFY_XRC_RCV_QP) | (1ull << IB_USER_VERBS_CMD_QUERY_XRC_RCV_QP) | (1ull << IB_USER_VERBS_CMD_DESTROY_XRC_RCV_QP) |
==> (1ull << IB_USER_VERBS_CMD_REG_XRC_RCV_QP) |
==> (1ull << IB_USER_VERBS_CMD_UNREG_XRC_RCV_QP);
with use of this mask in ib_uverbs_write:
if (!(file->device->ib_dev->uverbs_cmd_mask & (1ull << hdr.command))) return -ENOSYS;
In order to fix this layering violation,I would have needed to do fairly ugly things in ib_register_device -- to test if, say, the IB_USER_VERBS_CMD_CREATE_XRC_RCV_QP bit is set -- and if yes, to also add bits at the core layer for IB_USER_VERBS_CMD_REG_XRC_RCV_QP and IB_USER_VERBS_CMD_UNREG_XRC_RCV_QP. Ugh.
However, with your suggestion of combining the create/reg and the destroy/unreg into a single verb, this difficulty goes away, and the low-level driver can still declare those verbs for its task of creating and destroying the XRC RCV QPs.
I will continue with the reg/unreg implementation.
-Jack
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html