[openib-general] Re: [PATCH] hotplug support: selective removal notification

Michael S. Tsirkin mst at mellanox.co.il
Wed Aug 31 12:05:53 PDT 2005


Quoting r. Roland Dreier <rolandd at cisco.com>:
> Subject: Re: [PATCH] hotplug support: selective removal notification
> 
>     Michael> As a way of solving this, I propose the following patch.
>     Michael> The idea is that instead of setting client context
>     Michael> separately with ib_set_client_data, client's add method
>     Michael> will return ib_client_data object which is then kept in a
>     Michael> per-device list.  Returning NULL signals that the client
>     Michael> will not be interested in this device.
> 
> My first reaction was that this is a good idea.  But looking at the
> patch, I'm not sure if it actually improves the existing code.

You'll notice there are a couple of places (e.g. IPoIB)
which actually were forgetting to free the pointer.
So I'd go ahead and claim that the additional typesafety
is making it worth it.

> It
> seems there aren't any consumers that really benefit from this, and
> the MAD module actually has to invent a pointer to return.
> So I'm not sure whether this is worth it right now.
>
> (BTW, perhaps the MAD module could just return (void *) 1L instead of
> kmalloc'ing something it then has to kfree)
> 
>  - R.
> 

I agree its a problem.

Well, what the module returns currently needs to stay on the list,
to trigger calling the remove callback, so we cant just return 1
without additional work.

To solve the problem for the MAD module, or anyone who
does not want per-client data, what if we keep the
remove method in the client as is, and instead add a remove
method with two parameters to the client data?

This way, modules which dont need client data can
return NULL and still get called on module removal.

Makes sense? I'll code up the patch.

-- 
MST



More information about the general mailing list