[ofa-general] CQ destory

Ganesh Sadasivan gsadasiv7 at gmail.com
Wed Nov 14 09:50:20 PST 2007


Here is what I think is happening:
There are a couple of cq-s registerd with the same completion channel.

ibv_cq_get_event is done in a thread. When this thread is woken up by
one or more completion events, ibv_poll_cq is done to extract each of
the completion  entry.
If the completion status is bad the cq is destroyed as part of processing this
completion entry. The question is will destroy of cq flush all the
completion events
for this cq? If not what is the way to get around this problem?

Thanks
Ganesh


On Nov 14, 2007 8:28 AM, Roland Dreier <rdreier at cisco.com> wrote:
>
>  >    Is there any way to figure out that a cq does not have any pending
>  > completion entries and thus
>  >    is safe to call ibv_destroy_cq. Or is it ok to call destroy
>  > regardless of whether there are completion
>  >    entries? I am seeing a seg fault in ibv_poll_cq if I adopt the
>  > latter approach.
>
> The only way to know that a CQ has no entries is to poll the CQ and
> not see any entries.  However, it is fine to destroy a CQ if there are
> entries present.  I don't understand how destroying a CQ could be
> connected to a seg fault in ibv_poll_cq, unless you are polling the CQ
> after calling ibv_destroy_cq() for that same CQ, which is a
> use-after-free bug in your code.
>
>  - R.
>



More information about the general mailing list