]> git.openfabrics.org - ~shefty/rdma-win.git/commitdiff
[OpenSM] - Fix race bug - looking at the qp0_mads_outstanding was done in a lock
authoreitan <eitan@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 31 Oct 2005 12:20:45 +0000 (12:20 +0000)
committereitan <eitan@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 31 Oct 2005 12:20:45 +0000 (12:20 +0000)
after decrementing it.
The signaling was done according to the value viewed on the qp0_mads_outstanding, and not on the new value updated.
As result - can receive a signal of NO_PENDING_TRANSACTIONS outside of its place.

git-svn-id: svn://openib.tc.cornell.edu/gen1@134 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

trunk/ulp/opensm/user/opensm/osm_sm_mad_ctrl.c
trunk/ulp/opensm/user/opensm/osm_vl15intf.c

index c01b808b8b27c2ec830fc1034e4a26e83aaa5590..9ae897cf6f17d875f2311bcf89764b790c2d2c0b 100644 (file)
@@ -102,10 +102,11 @@ __osm_sm_mad_ctrl_retire_trans_mad(
              "__osm_sm_mad_ctrl_retire_trans_mad: ERR 3120: "
              "Trying to dec qp0_mads_outstanding=0. "
              "Problem with transaction mgr!\n");
+    outstanding = 0;
   }
   else
   {
-    cl_atomic_dec( &p_ctrl->p_stats->qp0_mads_outstanding );
+    outstanding = cl_atomic_dec( &p_ctrl->p_stats->qp0_mads_outstanding );
   }
 
   if( osm_log_is_active( p_ctrl->p_log, OSM_LOG_DEBUG ) )
@@ -116,21 +117,6 @@ __osm_sm_mad_ctrl_retire_trans_mad(
              p_ctrl->p_stats->qp0_mads_outstanding );
   }
 
-  /*
-    Acquire the lock non-exclusively.
-    Other modules that send MADs grab this lock exclusively.
-    These modules that are in the process of sending MADs
-    will hold the lock until they finish posting all the MADs
-    they plan to send.  While the other module is sending MADs
-    the outstanding count may temporarily go to zero.
-    Thus, by grabbing the lock ourselves, we get an accurate
-    view of whether or not the number of outstanding MADs is
-    really zero.
-  */
-  CL_PLOCK_ACQUIRE( p_ctrl->p_lock );
-  outstanding = p_ctrl->p_stats->qp0_mads_outstanding;
-  CL_PLOCK_RELEASE( p_ctrl->p_lock );
-
   if( outstanding == 0 )
   {
     /*
index ae382851ba935dd16098c1b247990692f914f9c7..3eb14c540565dac11d78acc7b6bc5a6998cca66c 100644 (file)
@@ -178,28 +178,13 @@ __osm_vl15_poller(
            the cl_disp_post with OSM_SIGNAL_NO_PENDING_TRANSACTION (in order
            to wake up the state mgr).
         */
-        cl_atomic_dec( &p_vl->p_stats->qp0_mads_outstanding );
+        outstanding = cl_atomic_dec( &p_vl->p_stats->qp0_mads_outstanding );
         
         osm_log( p_vl->p_log, OSM_LOG_DEBUG,
                  "__osm_vl15_poller: "
                  "%u QP0 MADs outstanding.\n",
                  p_vl->p_stats->qp0_mads_outstanding );
         
-        /*
-          Acquire the lock non-exclusively.
-          Other modules that send MADs grab this lock exclusively.
-          These modules that are in the process of sending MADs
-          will hold the lock until they finish posting all the MADs
-          they plan to send.  While the other module is sending MADs
-          the outstanding count may temporarily go to zero.
-          Thus, by grabbing the lock ourselves, we get an accurate
-          view of whether or not the number of outstanding MADs is
-          really zero.
-        */
-        CL_PLOCK_ACQUIRE( p_vl->p_lock );
-        outstanding = p_vl->p_stats->qp0_mads_outstanding;
-        CL_PLOCK_RELEASE( p_vl->p_lock );
-
         if( outstanding == 0 )
         {
           /*