So in order to safely call ibv_destroy_cq, I should call ibv_ack_cq_events *after* ibv_poll_cq? The example on the man page for ibv_get_cq_event calls it before, is it an error?

Flavio

Il 1/2/2012 17:39 PM, Hefty, Sean ha scritto:
If I understood correctly, when ibv_get_cq_event returns, it holds some sort
of lock over the completion queue, which is

ibv_get_cq_event will increment a reference count on the CQ that it is 
returning.

released when I call ibv_req_notify_cq. This lock is checked also in

You decrement the count with ibv_ack_cq_events.  ibv_req_notify_cq is used to 
arm the cq, so that a completion generates an interrupt and a new event.

ibv_destroy_cq, so that:
1) When ibv_destroy_cq returns, I am certain that there is no thread running
somewhere between ibv_get_cq_event and
ibv_req_notify_cq

ibv_destroy_cq will block until all outstanding references on the cq have been 
released.  The intent is to protect the user from ibv_get_cq_event from 
returning a reference to a cq that is being destroyed from another thread, 
which could result in a crash in the user's code.

2) When ibv_destroy_cq returns, I am certain that ibv_get_cq_event will not
return the destroyed cq any more.

correct

- Sean


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to