public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
To: "Hefty, Sean" <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: Jack Morgenstein
	<jackm-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>,
	Jason Gunthorpe
	<jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>,
	Roland Dreier <roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	"linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Liran Liss <liranl-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org>,
	Oren Duer <oren-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org>
Subject: Re: [PATCH 1/2] libibverbs: Allow 3rd party extensions to verb routines
Date: Thu, 29 Dec 2011 17:43:01 +0200	[thread overview]
Message-ID: <4EFC8A85.4020803@mellanox.com> (raw)
In-Reply-To: <1828884A29C6694DAF28B7E6B8A82373136F935C-P5GAC/sN6hmkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>

On 8/2/2011 7:28 PM, Hefty, Sean wrote:
>> If I understand correctly, the various additions which would normally be made
>> to libibverbs would then be made by third-party libraries which extend libibverbs to support their additions.
>
> It may help to read about extensions in opengl: http://www.opengl.org/registry/doc/rules.html
> Additions can be made to both.  Obviously Roland has the final say on any changes to ibverbs, but what I envision is:
>
> If a feature is based on an industry standard and all necessary kernel changes are upstream, then the feature should be integrated into ibverbs.  An application would simply call ibv_new_feature() to make use of the feature (or call an existing function with some new enum value).  Internally, ibverbs may need to obtain a new interface from the provider library.
>
> If there is no published specification for a feature (maybe it's still under development), kernel patches are needed, and there are customers who want to use the feature immediately, then a vendor can define an extension.  In this case, the application may call vendor_ops = ibv_get_ext_ops(), followed by vendor_ops->new_feature().  Or the app may call ibv_some_existing_function() using a vendor specific enum value.

Sean, All,

"Allow 3rd party extensions to verb routines" was posted couple of times 
over the last months, I'm replying here @ 
http://marc.info/?t=130815687800001&r=1&w=2 since there has been few 
emails exchanges with Q&A so maybe would be better to continue that, 
anyway,

I would suggest that we first and most see that the selected method to 
add extensions addresses the 1st use case, e.g a feature which is in the 
kernel, standard, etc and now needed to be added user space wise such 
that all parties involve in that game: libibverbs, provider libraries 
and 3rd party code which links against libibverbs (application and 
libraries) are okay:

So for new feature that uses new verb, new data structures, new kernel 
uverbs calls - the application would call ibv_new_feature() to make use 
of the feature - applications can require libibverbs version > X in 
their install RPM dependencies mechanism such that when the application 
is installed its ensured that it could load libibverbs they w.o hitting 
a failure. Provider libraries which issue ibv_cmd_new_feature() calls 
can (should?!) apply that mechanism, looking on libmlx4 rpm spec file 
I'm not sure this is done there - still, ibv_cmd_new_feature() could 
fail if the kernel doesn't support that feature yet, but assuming uverbs 
return a known/documented value e.g -ENOSYS on that case, someone up 
there application/system would realize that the kernel has to be updated 
or they can tweak the app to give up using on ibv_new_feature() calls.

AND, we are remained with the libibverbs --- new_feature() ---> provider 
library trail. Here since
the provider library is plugin, we can't add/track strict dependencies 
to libibverbs for all provider libraries. Sean, my understanding is that 
for the 1st case (feature in kernel,etc) - the essence of your 
suggestion is to address that.

Looking on the suggestion, it states that for each new_feature, 
libibverbs defines "struct ibv_new_feature_ops" and issues "n_f_ops_p = 
ibv_get_ext_ops(context, IBV_NEW_FEATURE_OPS)" call each time it needs 
to call into the provider library for that new feature.

Looking closely on applying that method for XRC extensions as use case, 
namely commit 563fb8c3e "Using extensions to define XRC support" on your 
libibverbs/xrc git tree/branch and commit 5c01e9f40c "mlx4: Add support 
for XRC extension" on your libmlx4/xrc git - this gets a bit more 
complicated (git://git.openfabrics.org/~shefty/libibverbs.git xrc and 
libmlx4.git xrc) here's some feedback:

1. for libibverbs some structures extended field is added at their end 
saying "Following fields only available if device supports extensions"e.g

> @@ -590,6 +634,13 @@ struct ibv_qp {
>         pthread_mutex_t         mutex;
>         pthread_cond_t          cond;
>         uint32_t                events_completed;
> +
> +       /* Following fields only available if device supports 
> extensions */
> +       union {
> +               struct {
> +                       struct ibv_xrcd *xrcd;
> +               } xrc_recv;
> +       } ext;
>  };

but this field is a -- union -- how would that work if more than one 
extension is to be applied for a structure?

2. indeed, reality wise, new features, much of the time will also 
interact with existing data structures... so what happens if we extend a 
structure but the the extended strucutre is actually a field within 
another existing structure e.g suppose we want to extend ibv_ah_attr 
which is within ibv_qp_attr e.g to be used for the RAW Ethernet QPs. I 
don't see how we can be backward compatible with apps linked against 
libibverbs with the internal structure size being smaller, correct? so 
extended fields must be on the END always - in the actual structure they 
are added and if this structure is a field of another structure then we 
can't just extend it and need to come up with new structure which is in 
turn used as the field?

3. The usage of "#ifdef IBV_NEW_FEATURE_OPS" (IBV_XRC_OPS) in libmlx4 
will become tireding to follow maybe and could be replaced by placing 
dependency on a version of libibverbs that supports IBV_NEW_FEATURE_OPS?

4. can we somehow come up with a method to avoid IBV_NEW_FEATURE_OPS for 
--every-- new feature?

> or call an existing function with some new enum value

5. what happens if we just want to enhance an -- existing -- function - 
suppose we want to enhance ibv_post_send / ibv_poll_cq to support 
features like LSO, checksum offload, masked atomic operations, fast 
memory remote invalidate, etc so we add IBV_WR_NEW_FEATURE / 
IB_WC_NEW_FEATURE enum values, this step is simple, again if we go the 
way of the applicayion ensuring through dependencies that they are 
loaded against libibverbs that supports IB_{WR,WC}_NEW_FEATURE.

Now we come up with a need to extend struct ibv_send_wr and struct 
ibv_wc - where we should be very careful - walking on glasses for the 
backward compatibility thing - so only adding at the end on as union 
field which doesn't change the size of the union, correct? for 
ibv_post_send we can rely on the provider library to return error if 
they don't support NEW_FEATURE, but this would happen in run time... is 
there a way to avoid that, should we better go and add 
ib_post_send_new_feature? this would be very tedious doing for each 
new_feature and not applicable to ibv_poll_cq - any idea what should be 
done here?

This is for now...

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

  parent reply	other threads:[~2011-12-29 15:43 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-15 16:54 [PATCH 1/2] libibverbs: Allow 3rd party extensions to verb routines Hefty, Sean
     [not found] ` <1828884A29C6694DAF28B7E6B8A8237302123C-P5GAC/sN6hmkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2011-06-16 15:14   ` Or Gerlitz
     [not found]     ` <4DFA1DDD.5020508-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2011-06-16 15:39       ` Hefty, Sean
     [not found]         ` <1828884A29C6694DAF28B7E6B8A823730217E1-P5GAC/sN6hmkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2011-06-16 18:12           ` Or Gerlitz
     [not found]             ` <BANLkTimwTs4EK19PiTq6yMzPCQrLt0bALw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-06-16 19:27               ` Hefty, Sean
     [not found]                 ` <1828884A29C6694DAF28B7E6B8A823730218F4-P5GAC/sN6hmkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2011-08-01 12:08                   ` Jack Morgenstein
     [not found]                     ` <201108011508.06521.jackm-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2011-08-01 19:11                       ` Hefty, Sean
2011-08-02  5:38                       ` Jason Gunthorpe
     [not found]                         ` <20110802053824.GA23512-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2011-08-02  7:53                           ` Jack Morgenstein
     [not found]                             ` <201108021053.05311.jackm-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2011-08-02 16:28                               ` Hefty, Sean
     [not found]                                 ` <1828884A29C6694DAF28B7E6B8A82373136F935C-P5GAC/sN6hmkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2011-12-29 15:43                                   ` Or Gerlitz [this message]
     [not found]                                     ` <4EFC8A85.4020803-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2011-12-31 11:01                                       ` Bart Van Assche
2012-01-01  5:13                                       ` Or Gerlitz
2012-01-02 17:34                                       ` Hefty, Sean
     [not found]                                         ` <1828884A29C6694DAF28B7E6B8A8237325662BCE-P5GAC/sN6hlcIJlls4ac1rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2012-01-03 16:08                                           ` Or Gerlitz
     [not found]                                             ` <4F03280A.80305-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2012-01-03 16:40                                               ` Hefty, Sean
2011-08-02 16:56                               ` Jason Gunthorpe

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=4EFC8A85.4020803@mellanox.com \
    --to=ogerlitz-vpraknaxozvwk0htik3j/w@public.gmane.org \
    --cc=jackm-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org \
    --cc=jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=liranl-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org \
    --cc=oren-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org \
    --cc=roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /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