public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
To: "Hefty, Sean" <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: Or Gerlitz <or.gerlitz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	Roland Dreier <roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	linux-rdma <linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH 1/7] libibverbs: Add link layer field port attribute
Date: Tue, 19 Jul 2011 15:39:02 -0600	[thread overview]
Message-ID: <20110719213902.GH18090@obsidianresearch.com> (raw)
In-Reply-To: <1828884A29C6694DAF28B7E6B8A82373136EFE8F-P5GAC/sN6hlcIJlls4ac1rfspsVTdybXVpNB7YpNyf8@public.gmane.org>

On Tue, Jul 19, 2011 at 09:20:25PM +0000, Hefty, Sean wrote:
> > More clearly: what initializes the memory you've redefined to be
> > link_layer in libibverbs 1.1.5 ? I see nothing.
> 
> Why does the value in an older library cause an issue?

ABI compatability means if dynamic linking succeeds then the result
works, so the behavior of a new app, using new functionality when it
links to the old library must work.

The commit comment states the goal is to have new apps see
IBV_LINK_LAYER_UNSPECIFIED for all possible combinations of old stuff
underneath.

> Or, how will this library version interact with an older kernel?

The kernel interaction is not what I'm talking about - AFAIK, the
kernel interaction is OK. Old kernels zero the entire ib_port_attr
structure before copy_to_user so the reserved bytes are guaranteed to
be 0.

The problem is with the userspace ABI out of libibverbs. Current
libibverbs does not zero its ib_port_attr structure before returning.

Build this with Or's patch applied, then run it against libibverbs 1.1.5

 struct ibv_port_attr attr;
 attr.link_layer = 100;
 ibv_query_port(..,&attr);
 assert(attr.link_layer == IBV_LINK_LAYER_UNSPECIFIED); // Fails!

That is an ABI breaking issue that is not dealt with by Or's patch.

Couple choices:
 1) Require and document callers using ibv_query_port to zero attr
    before hand when using link_layer
 2) Crank the symbol version on ibv_query_port so dynamic linking
    fails
 3) Inline the memset in ibverbs.h:

    static inline int fixed_ibv_query_port(...)
    {
       attr->link_layer = 0;
       return ibv_query_port(...);
    }
    #define ibv_query_port(...) fixed_ibv_query_port(...)

#2 might be the best?

Jason
--
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-07-19 21:39 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-19  9:25 [PATCH 0/7] IBoE user space support Or Gerlitz
     [not found] ` <alpine.LRH.2.00.1107191223460.5580-VYr5/9ddeaGSIdy2EShu12Xnswh1EIUO@public.gmane.org>
2011-07-19  9:27   ` [PATCH 1/7] libibverbs: Add link layer field port attribute Or Gerlitz
     [not found]     ` <alpine.LRH.2.00.1107191226210.5580-VYr5/9ddeaGSIdy2EShu12Xnswh1EIUO@public.gmane.org>
2011-07-19 17:04       ` Jason Gunthorpe
     [not found]         ` <20110719170454.GD18090-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2011-07-19 19:36           ` Or Gerlitz
     [not found]             ` <CAJZOPZ+=3jr18x8Uxt73jAfT0bdPhntOez9dyZfmiHOF5REOSw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-07-19 19:50               ` Jason Gunthorpe
     [not found]                 ` <20110719195020.GE18090-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2011-07-19 20:22                   ` Or Gerlitz
     [not found]                     ` <CAJZOPZ+2S=agGurUC6393e7mqQy4Ob1jaseeoWxeZe2Yu-kCLg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-07-19 20:31                       ` Jason Gunthorpe
     [not found]                         ` <20110719203140.GG18090-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2011-07-19 21:20                           ` Hefty, Sean
     [not found]                             ` <1828884A29C6694DAF28B7E6B8A82373136EFE8F-P5GAC/sN6hlcIJlls4ac1rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2011-07-19 21:39                               ` Jason Gunthorpe [this message]
     [not found]                                 ` <20110719213902.GH18090-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2011-07-20 18:08                                   ` Or Gerlitz
     [not found]                                     ` <CAJZOPZ+HjKiSr=Q6ti9zPfx0YnGXK796xK+Y8fDtLLuM3SnKbA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-07-20 18:10                                       ` Jason Gunthorpe
     [not found]                                         ` <20110720181052.GI18090-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2011-07-20 18:20                                           ` Or Gerlitz
     [not found]                                             ` <CAJZOPZL9T2XK25BxtOBJj4vW3uSZz4yDWR4wfBxvUaeOgrWU3A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-07-20 18:23                                               ` Hefty, Sean
2011-07-20 18:33                                               ` Jason Gunthorpe
     [not found]                                                 ` <20110720183327.GJ18090-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2011-07-20 18:47                                                   ` Or Gerlitz
2011-07-20 19:37       ` [PATCH V1 " Or Gerlitz
2011-07-19  9:28   ` [PATCH 2/7] libibverbs: change kernel API to accept link layer Or Gerlitz
2011-07-19  9:30   ` [PATCH 3/7] libibverbs: add GID change event Or Gerlitz
     [not found]     ` <alpine.LRH.2.00.1107191229210.5580-VYr5/9ddeaGSIdy2EShu12Xnswh1EIUO@public.gmane.org>
2011-07-19 17:00       ` Jason Gunthorpe
     [not found]         ` <20110719170048.GC18090-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2011-07-19 19:39           ` Or Gerlitz
2011-07-20 19:38       ` [PATCH V1 " Or Gerlitz
2011-07-19  9:31   ` [PATCH 4/7] libibverbs: Update examples for IBoE Or Gerlitz
     [not found]     ` <alpine.LRH.2.00.1107191230350.5580-VYr5/9ddeaGSIdy2EShu12Xnswh1EIUO@public.gmane.org>
2011-07-19 16:52       ` Jason Gunthorpe
     [not found]         ` <20110719165236.GB18090-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2011-07-19 19:44           ` Or Gerlitz
2011-07-19  9:32   ` [PATCH 5/7] libmlx4: add IBoE support Or Gerlitz
     [not found]     ` <alpine.LRH.2.00.1107191231540.5580-VYr5/9ddeaGSIdy2EShu12Xnswh1EIUO@public.gmane.org>
2011-07-19 16:49       ` Jason Gunthorpe
     [not found]         ` <20110719164906.GA18090-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2011-07-19 19:34           ` Or Gerlitz
     [not found]         ` <CAJZOPZLsy-EcbCC3FSOLVGL05XBRcdKSYPpt4H+mwAHWrV73vA@mail.gmail.com>
     [not found]           ` <20110719195528.GF18090@obsidianresearch.com>
     [not found]             ` <20110719195528.GF18090-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2011-07-19 20:18               ` Or Gerlitz
2011-07-19  9:34   ` [PATCH 6/7] libmlx4: add IBoE UD/VLANs support Or Gerlitz
2011-07-19  9:36   ` [PATCH 7/7] libmlx4: align the list of ConnectX devices supported with the kernel Or Gerlitz
2011-07-20 19:43   ` [PATCH 0/7] IBoE user space support Or Gerlitz
     [not found]     ` <CAJZOPZJ0JF_biZ32Kf=p6xw4rkm=TzdoMY5AdqMpfWfDRbg69Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-09-05 18:36       ` Or Gerlitz
     [not found]         ` <CAJZOPZJRRZX+B=eXKUNTLh684up3_bYievh3PVD_u8QZe3Qb5w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-09-06 15:59           ` Roland Dreier
     [not found]             ` <CAL1RGDVoCkNRchEtCGeTEJ7Y4-Y-bawCPxxErJ8x9-GrWBbK2g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-09-06 19:58               ` Or Gerlitz

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=20110719213902.GH18090@obsidianresearch.com \
    --to=jgunthorpe-epgobjl8dl3ta4ec/59zmfatqe2ktcn/@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=or.gerlitz-Re5JQEeQqe8AvxtiuMwx3w@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