[openib-general] [PATCH] cancel outstanding MADs when deregistering

Sean Hefty mshefty at ichips.intel.com
Wed Sep 29 09:25:50 PDT 2004


Thanks for the feedback.

On Tue, 28 Sep 2004 13:21:51 -0700 (PDT)
Krishna Kumar <krkumar at us.ibm.com> wrote:
> In cancel_mads() :
> > if (mad_send_wr->refcount <= 0) {
> 
> If there is no good reason for the refcount to drop below zero, it is
> better to put BUG_ON for such code to catch potential bugs much earlier,
> while keeping the check as "if (x == 0)", etc.

Can do.  The refcount should never fall below 0.
 
> Also, if timeout_ms is set, will those entries get removed from the
> list (since they have refcnt of two) ?

If the refcount is still two, they will not.  The second refcount is released once the work request posted to the QP is completed.  See my response to Roland for more details.  Unfortunately, I was trying to add in smaller patches, so the code that does request/response matching and would use the timeout_ms value is not in there yet.

> Finally, do you want to wake up threads waiting on mad_agent_priv->wait
> once finally out of the loop or each time when the refcnt drops to zero ?
> If there is no reason to do so each time, you can do once you finish the
> cancel list. BTW, in this case you can also call wake_up_nr() if you
> keep track of the number of times you want to wake up based on the return
> value of atomic_dec_* call.

Actually, I shouldn't try to wakeup the thread at all.  The mad_agent_priv->refcount must be at least 1 at the end of this function.  I'll fix.



More information about the general mailing list