<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2873" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial size=2><SPAN class=647334215-15052006>Hi
Fab,</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=647334215-15052006><FONT
size=2></FONT></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=647334215-15052006><FONT size=2>While
running a test which creates/destroys a lot of CQs from several threads, I get
an assertion 'ref_cnt != 1' from ref_al_obj() in one thread, while another
thread is in the middle of destroy_cq. It seems like a race between a process of
asyncronous cq destroy and other processes, using it.</FONT></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=647334215-15052006><FONT size=2>I see
also other failures like INVALID_CQ_HANDLE, which hints also on using a released
CQ.</DIV></FONT></SPAN></FONT>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><SPAN class=647334215-15052006><FONT face=Arial size=2>The assertion in
'ref_cnt != 1' suggests that its an invalid state, but ref_al_obj() doesn't tell
that to the caller.</FONT></SPAN></DIV>
<DIV><SPAN class=647334215-15052006><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=647334215-15052006><FONT face=Arial size=2>A patch below
makes ref_al_obj() to return the ref_cnt and checks this value in
__process_comp_cb() in order to skip the handling of a CQ, being
destroyed.</FONT></SPAN></DIV>
<DIV><SPAN class=647334215-15052006><FONT face=Arial size=2>I guess, there ore
more functions, that need to check the results of
ref_al_obj().</FONT></SPAN></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><SPAN class=647334215-15052006><FONT face=Arial size=2>Thoughts
?</FONT></SPAN></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Index:
E:/svn.openib/gen1/trunk/core/al/al_common.c<BR>===================================================================<BR>---
E:/svn.openib/gen1/trunk/core/al/al_common.c (revision 347)<BR>+++
E:/svn.openib/gen1/trunk/core/al/al_common.c (working copy)<BR>@@ -352,7
+352,7 @@<BR> * Increment a reference count on an object. This
object should not be<BR> * an object's parent.<BR>
*/<BR>-void<BR>+int32_t<BR> ref_al_obj(<BR> IN al_obj_t
* const p_obj )<BR> {<BR>@@ -365,6 +365,7
@@<BR> CL_ASSERT( ref_cnt != 1 );<BR> <BR> CL_EXIT(
AL_DBG_AL_OBJ, g_al_dbg_lvl );<BR>+ return ref_cnt;<BR> }</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Index:
E:/svn.openib/gen1/trunk/core/al/al_common.h<BR>===================================================================<BR>---
E:/svn.openib/gen1/trunk/core/al/al_common.h (revision 347)<BR>+++
E:/svn.openib/gen1/trunk/core/al/al_common.h (working copy)<BR>@@ -286,7
+286,7 @@<BR> /*<BR> * Increment the reference count on an AL
object.<BR> */<BR>-void<BR>+AL_EXPORT int32_t
AL_API<BR> ref_al_obj(<BR> IN al_obj_t *
const p_obj );<BR> <BR>Index:
E:/svn.openib/gen1/trunk/core/al/user/ual_mgr.c<BR>===================================================================<BR>---
E:/svn.openib/gen1/trunk/core/al/user/ual_mgr.c (revision 347)<BR>+++
E:/svn.openib/gen1/trunk/core/al/user/ual_mgr.c (working copy)<BR>@@
-690,13 +690,15
@@<BR> IN comp_cb_ioctl_info_t* p_comp_cb_info
)<BR> {<BR> ib_cq_handle_t h_cq;<BR>+ uint32_t ref_cnt;<BR> CL_ASSERT(
p_comp_cb_info->cq_context );<BR> h_cq =
(ib_cq_handle_t)(p_comp_cb_info->cq_context);<BR> <BR>- ref_al_obj(
&h_cq->obj );<BR>+ ref_cnt = ref_al_obj( &h_cq->obj
);<BR> <BR> CL_ASSERT( h_cq->pfn_user_comp_cb
);<BR>- h_cq->pfn_user_comp_cb( h_cq, (void*)h_cq->obj.context
);<BR>+ if (ref_cnt > 1)<BR>+ h_cq->pfn_user_comp_cb(
h_cq, (void*)h_cq->obj.context );<BR> <BR> deref_al_obj(
&h_cq->obj );<BR> }<BR></FONT></DIV></BODY></HTML>