[openib-general] Re: [PATCH] libibverbs: protect device list initialization

Roland Dreier rolandd at cisco.com
Wed Nov 9 11:33:54 PST 2005


    Michael> BTW I think this will or something like this will be
    Michael> needed even if we change the library API.

Yes, we definitely need to be thread-safe here.

    Michael> The problem I see with the API is with the re-entrancy of
    Michael> ibv_get_devices: for hotplug to work, it seems clear that
    Michael> we'll need to rescan the device list on each call to
    Michael> ibv_get_devices, so we will need something like
    Michael> ibv_put_devices to let the library know the user is not
    Michael> walking the list anymore.

    Michael> Given this assumption, it would seems better to let
    Michael> ibv_get_devices to just malloc and return an array of
    Michael> devices, and ibv_put_devices return it, than force
    Michael> everyone to use the sysfs dlist.

Yeah, the reason I've been avoiding this is that having
ibv_put_devices seems ugly to me.  And having the caller allocate a
buffer (and having to deal with resizing it etc) also seems ugly.
So I'm somewhat paralyzed ;)

 - R.



More information about the general mailing list