[ofa-general] Re: [PATCH V2 - libibverbs] Added reference count to completion event channels

Dotan Barak dotanb at dev.mellanox.co.il
Tue Mar 20 06:41:15 PDT 2007


Roland Dreier wrote:
> Thanks.  However, it seems racy to me to use the mutex as you do here.
> I think if a consumer calls ibv_create_cq() and ibv_destroy_comp_channel()
> simultaneously (for the same completion channel obviously), exactly
> one of the two calls should succeed.  As it stands now, you might have
> a comp channel that starts with a refcnt of 0, have the test in
> ibv_destroy_comp_channel() succeed, then have ibv_create_cq() use the
> completion channel and bump the refcnt too late and also return success.
>   
you are right - this is why i thought in the first place why this check 
need to be done in kernel level.

is there is any difference between check this check and the check that 
being done when destroying a CQ?
why do we check the CQ in kernel level and the completion channel in 
user level?

i think that need to do this check in kernel level for a cleaner code.


what do you think?

thanks
Dotan



More information about the general mailing list