[ofa-general] Re: [PATCH 8/11] core: XRC receive-only QPs

Jack Morgenstein jackm at dev.mellanox.co.il
Wed Jul 2 08:04:10 PDT 2008


On Tuesday 24 June 2008 00:53, Roland Dreier wrote:
>  > @@ -769,6 +775,7 @@ struct ib_ucontext {
>  >  	struct list_head	srq_list;
>  >  	struct list_head	ah_list;
>  >  	struct list_head	xrc_domain_list;
>  > +	struct list_head	xrc_reg_qp_list;
>  >  	int			closing;
>  >  };
> 
> Wouldn't it be cleaner to keep the like of recv QPs per xrcd?  Then you
> wouldn't have to do stuff like:
> 
>  > +	list_for_each_entry(tmp, &file->ucontext->xrc_reg_qp_list, list)
>  > +		if (cmd.xrcd_handle == tmp->domain_handle) {
> 
> instead you could just do a list_empty() test.
> 
Currently, there is no per-process object for xrc domains. I needed a list
of qp's registered ***per-process***, so that I could prevent closing a domain (for that process)
while that process still had registered QPs on that domain.  This was especially true if
the current process was the last one using the domain -- so that the domain itself would be deleted
when close_domain was invoked.

With the check in place, if the user tried to close the domain while there were QPs registered,
he gets an error.  If the user does not close the domain, and does not unregister all the QPs
for that process, this gets done in ib_uverbs_cleanup_ucontext() (in the proper order), so there
are no resource leaks.

I think that here we have "6 of one, half a dozen of the other":
If I register QPs per xrcd, I either have to create and manage an xrcd
user-space specific object (e.g., struct ib_uxrcd_object) -- instead of the generic ib_uobject,
or I need to save the process ID per QP in an xrcd list of QPs -- and then I would need to
check for equality of PIDs, rather than domain handles.

I think the way things are now is relatively simpler.

- Jack



More information about the general mailing list