[ofw] patch: [ibal] use safe function for working on mutex.

Tzachi Dar tzachid at mellanox.co.il
Mon Oct 27 07:58:28 PDT 2008


The unsafe functions can only be used from apc level. We call them from
passive level, so we use the safe functions.
 
Index: Q:/projinf3/trunk/core/bus/kernel/bus_port_mgr.c
===================================================================
--- Q:/projinf3/trunk/core/bus/kernel/bus_port_mgr.c (revision 3372)
+++ Q:/projinf3/trunk/core/bus/kernel/bus_port_mgr.c (revision 3373)
@@ -483,12 +483,12 @@
   */
  if ( !bus_globals.h_pnp_port )
  {
-  ExAcquireFastMutexUnsafe(&g_ControlMutex);
+  ExAcquireFastMutex(&g_ControlMutex);
   if ( !bus_globals.h_pnp_port ) {
    bus_globals.h_pnp_port = (ib_pnp_handle_t)1; /* block others */
    need_pnp_reg = TRUE;
   }
-  ExReleaseFastMutexUnsafe(&g_ControlMutex);
+  ExReleaseFastMutex(&g_ControlMutex);
 
   if ( need_pnp_reg )
   {
@@ -1005,10 +1005,10 @@
   if ( !p_bfi->p_bus_ext )
    continue;
   GO = FALSE;
-  ExAcquireFastMutexUnsafe(&g_ControlMutex);
+  ExAcquireFastMutex(&g_ControlMutex);
   if ( p_bfi->ca_guid && p_bfi->p_port_mgr )
    GO = TRUE;
-  ExReleaseFastMutexUnsafe(&g_ControlMutex);
+  ExReleaseFastMutex(&g_ControlMutex);
   if ( GO == FALSE )
    continue;
   status = _port_mgr_pkey_rem( pkeys, p_bfi->p_port_mgr );
@@ -1149,10 +1149,10 @@
   if ( !p_bfi->p_bus_ext )
    continue;
   GO = FALSE;
-  ExAcquireFastMutexUnsafe(&g_ControlMutex);
+  ExAcquireFastMutex(&g_ControlMutex);
   if ( p_bfi->ca_guid && p_bfi->p_port_mgr )
    GO = TRUE;
-  ExReleaseFastMutexUnsafe(&g_ControlMutex);
+  ExReleaseFastMutex(&g_ControlMutex);
   if ( GO == FALSE )
    continue;
   status = _port_mgr_pkey_add( pkeys, p_bfi, p_bfi->p_port_mgr );
Index: Q:/projinf3/trunk/core/bus/kernel/bus_pnp.c
===================================================================
--- Q:/projinf3/trunk/core/bus/kernel/bus_pnp.c (revision 3372)
+++ Q:/projinf3/trunk/core/bus/kernel/bus_pnp.c (revision 3373)
@@ -334,7 +334,7 @@
   return status;
  }
 
- ExAcquireFastMutexUnsafe(&g_ControlMutex);
+ ExAcquireFastMutex(&g_ControlMutex);
  if ( !gh_al ) {
   /* Initialize AL */
   ib_status = al_initialize();
@@ -343,12 +343,12 @@
    al_cleanup();
    BUS_TRACE_EXIT( BUS_DBG_ERROR, ("al_initialize returned %s.\n",
        ib_get_err_str(ib_status)) );
-   ExReleaseFastMutexUnsafe(&g_ControlMutex);
+   ExReleaseFastMutex(&g_ControlMutex);
    return STATUS_UNSUCCESSFUL;
   }
   AL_init_here = TRUE;
  }
- ExReleaseFastMutexUnsafe(&g_ControlMutex);
+ ExReleaseFastMutex(&g_ControlMutex);
 
  /* Initialize the port manager. */
  ib_status = create_port_mgr( p_ext->bus_filter, &p_ext->p_port_mgr );
@@ -1252,7 +1252,7 @@
 
  CL_ASSERT((obj_type == BFI_PORT_MGR_OBJ) || (obj_type ==
BFI_IOU_MGR_OBJ));
 
-    ExAcquireFastMutexUnsafe(&g_ControlMutex);
+    ExAcquireFastMutex(&g_ControlMutex);
 
  for(p_bfi=g_bus_filters; p_bfi < &g_bus_filters[MAX_BUS_FILTERS];
p_bfi++) {
 
@@ -1272,7 +1272,7 @@
    }
   }
  }
- ExReleaseFastMutexUnsafe(&g_ControlMutex);
+ ExReleaseFastMutex(&g_ControlMutex);
 
  BUS_PRINT( BUS_DBG_PNP,
     ("%s() cl_obj %p type %s_MGR_OBJ --> bfi[%d] %p\n",
@@ -1302,7 +1302,7 @@
   return matched;
  }
 
- ExAcquireFastMutexUnsafe(&g_ControlMutex);
+ ExAcquireFastMutex(&g_ControlMutex);
 
  for(p_bfi=g_bus_filters; p_bfi < &g_bus_filters[MAX_BUS_FILTERS];
p_bfi++)
  {
@@ -1315,7 +1315,7 @@
    break;
   }
  }
- ExReleaseFastMutexUnsafe(&g_ControlMutex);
+ ExReleaseFastMutex(&g_ControlMutex);
 
 #if DBG
  if ( !matched )
@@ -1376,7 +1376,7 @@
   */
  if ( !matched )
  {
-  ExAcquireFastMutexUnsafe(&g_ControlMutex);
+  ExAcquireFastMutex(&g_ControlMutex);
 
   for(p_bfi=g_bus_filters; p_bfi < &g_bus_filters[MAX_BUS_FILTERS];
p_bfi++)
   {
@@ -1391,7 +1391,7 @@
     break;
    }
   }
-  ExReleaseFastMutexUnsafe(&g_ControlMutex);
+  ExReleaseFastMutex(&g_ControlMutex);
  }
 
  BUS_PRINT( BUS_DBG_PNP,
@@ -1413,7 +1413,7 @@
      * IoCreateDeviceSecure & IoCreateSymbolicLink must be called at
      * PASSIVE_LEVEL.
   */
- ExAcquireFastMutexUnsafe(&g_ControlMutex);
+ ExAcquireFastMutex(&g_ControlMutex);
 
  // find 1st unused bfi slot.
  for(p_bfi=g_bus_filters; p_bfi < &g_bus_filters[MAX_BUS_FILTERS];
p_bfi++)
@@ -1430,7 +1430,7 @@
    break;
   }
  }
- ExReleaseFastMutexUnsafe(&g_ControlMutex);
+ ExReleaseFastMutex(&g_ControlMutex);
 
 #if DBG
  RtlStringCbPrintfA ( p_bfi->whoami,
@@ -1453,11 +1453,11 @@
 {
  int remaining;
 
- ExAcquireFastMutexUnsafe(&g_ControlMutex);
+ ExAcquireFastMutex(&g_ControlMutex);
  p_bfi->p_bus_ext = NULL;
  p_bfi->ca_guid = 0ULL;
  remaining = --g_bfi_InstanceCount; // one less bfi in-use
- ExReleaseFastMutexUnsafe(&g_ControlMutex);
+ ExReleaseFastMutex(&g_ControlMutex);
 
  return remaining;
 }
@@ -1467,9 +1467,9 @@
 {
  int ic;
 
- ExAcquireFastMutexUnsafe(&g_ControlMutex);
+ ExAcquireFastMutex(&g_ControlMutex);
  ic = g_bfi_InstanceCount;
- ExReleaseFastMutexUnsafe(&g_ControlMutex);
+ ExReleaseFastMutex(&g_ControlMutex);
 
  return ic;
 }
Index: Q:/projinf3/trunk/core/bus/kernel/bus_iou_mgr.c
===================================================================
--- Q:/projinf3/trunk/core/bus/kernel/bus_iou_mgr.c (revision 3372)
+++ Q:/projinf3/trunk/core/bus/kernel/bus_iou_mgr.c (revision 3373)
@@ -483,13 +483,13 @@
   */
  if ( !bus_globals.h_pnp_iou )
  {
-  ExAcquireFastMutexUnsafe(&g_ControlMutex);
+  ExAcquireFastMutex(&g_ControlMutex);
   if ( !bus_globals.h_pnp_iou )
   {
    bus_globals.h_pnp_iou = (ib_pnp_handle_t)1; /* block others */ 
    need_pnp_reg = TRUE;
   }
-  ExReleaseFastMutexUnsafe(&g_ControlMutex);
+  ExReleaseFastMutex(&g_ControlMutex);
 
   if ( need_pnp_reg )
   {

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20081027/088f2e3a/attachment.html>


More information about the ofw mailing list