[openib-general] [PATCH/RFC] libibverbs: Improve driver loading

Michael S. Tsirkin mst at mellanox.co.il
Thu Jan 4 23:53:27 PST 2007


> > OK, at last here is a patch that implements the improvements to
> > libibverbs driver loading that we discussed back in October.
> > 
> > With this patch, instead of trying all the .so files in the
> > $(libdir)/infiniband directory as libibverbs 1.0 does, libibverbs
> > instead builds a list of drivers to load and dlopen() exactly that
> > list of libraries.  It uses relative paths rather than absolute paths,
> > so the linker uses the normal search path to find driver libraries.
> > 
> > (To get a list of drivers, libibverbs parses all the config files it
> > finds in $(sysconfdir)/libibverbs.d and also looks at the environment
> > variables RDMAV_DRIVERS and IBV_DRIVERS)
> > 
> > Then, instead of calling a specific entry point in the driver,
> > libibverbs assumes the driver will call ibv_register_driver() from an
> > __attribute__((constructor)) function.
> > 
> > This has a number of benefits:
> >  - multiple drivers can be linked statically into an executable
> >  - LD_LIBRARY_PATH can be used to manage which drivers to load
> >  - different versions of the driver can be selected automagically at
> >    runtime (eg i686/cmov on i386 distros)
> > 
> > I will post a libmthca patch to illustrate how driver libraries need
> > to change to work with this new libibverbs method.
> 
> I think this looked good, and probably best to do before the next
> major release.
> 
> Do you plan to merge this?

BTW, the question still stands. If I start trying to play with
static linking issues, I'd like to do this based on this patch,
not what's in master currently.

-- 
MST




More information about the general mailing list