[openib-general] Re: [PATCH] ipoib: device removal races

Michael S. Tsirkin mst at mellanox.co.il
Mon Aug 29 14:02:02 PDT 2005


Quoting r. Roland Dreier <rolandd at cisco.com>:
> Subject: Re: [PATCH] ipoib: device removal races
> 
>     Michael> Something like:
> 
>     Michael> Remove it from the idr before completing, under a
>     Michael> spinlock.  Now if its in idr its not completing.
> 
>     Michael> Could this work?
> 
> I think you have to hold the spinlock across the consumer callback to
> avoid all races.

Hmm. I think I see what you mean. Would setting the completion callback to NULL
in the query structure under the idr spinlock work?
It now seems to me it will.

> And that's kind of a bummer, because it means you
> can't do anything that might sleep (like modify a QP) from the
> callback.

Its an sa query, so I'm not sure why would you want to modify a QP
there.
Further, please note that in the current API the callback is
always called even if the query is cancelled.

And clearly you cant allow cancel under a spinlock and 
at the same time ensure callback is performed and is allowed to sleep.

I think its not a big problem to let cancel return a code meaning
"completion was cancelled, perform the callback yourself if you want
to". I imagine ulps may special-case cancellation, anyway.

Would such an API change be OK?

-- 
MST



More information about the general mailing list