[ofw] patch: [core, mlx4,mthca] Add debug prints.

Tzachi Dar tzachid at mellanox.co.il
Thu Nov 13 06:25:25 PST 2008


This patch add prints that are needed in order to debug a problem in the
pnp tests.
 
If we have a release today, this patch will only go into the trunk.
 
sign off by: Leonid
 
Thanks
Tzachi
 
Index: Q:/projinf4/trunk/core/complib/kernel/cl_pnp_po.c
===================================================================
--- Q:/projinf4/trunk/core/complib/kernel/cl_pnp_po.c (revision 3459)
+++ Q:/projinf4/trunk/core/complib/kernel/cl_pnp_po.c (revision 3460)
@@ -214,6 +214,9 @@
  {
   CL_TRACE_EXIT( CL_DBG_ERROR, p_ext->dbg_lvl, 
    ("IoAcquireRemoveLock returned %08x.\n", status) );
+  p_io_stack = IoGetCurrentIrpStackLocation( p_irp );
+  CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl, 
+   ("Minor function %x for %s\n", p_io_stack->MinorFunction,
p_ext->vfptr_pnp_po->identity) );
   p_irp->IoStatus.Status = status;
   IoCompleteRequest( p_irp, IO_NO_INCREMENT );
   return status;
@@ -245,7 +248,7 @@
 
  case IRP_MN_CANCEL_STOP_DEVICE:
   CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl, 
-   ("IRP_MN_START_DEVICE for %s\n", p_ext->vfptr_pnp_po->identity) );
+   ("IRP_MN_CANCEL_STOP_DEVICE for %s\n",
p_ext->vfptr_pnp_po->identity) );
   status = __cancel_stop( p_dev_obj, p_irp, &action );
   break;
 
@@ -396,6 +399,8 @@
  {
  case IrpPassDown:
   p_irp->IoStatus.Status = status;
+  CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl, ("IrpPassDown: passing down to
PDO %p, ext %p, status %#x\n",
+   p_ext->p_next_do, p_ext, p_irp->IoStatus.Status) );
   IoCopyCurrentIrpStackLocationToNext( p_irp );
   status = IoCallDriver( p_ext->p_next_do, p_irp );
   break;
@@ -404,23 +409,30 @@
   p_irp->IoStatus.Status = status;
 
  case IrpIgnore:
+  CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl, ("IrpSkip/IrpIgnore: passing
down to PDO %p, ext %p, status %#x\n",
+   p_ext->p_next_do, p_ext, p_irp->IoStatus.Status) );
   IoSkipCurrentIrpStackLocation( p_irp );
   status = IoCallDriver( p_ext->p_next_do, p_irp );
   break;
 
  case IrpComplete:
   p_irp->IoStatus.Status = status;
+  CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl, ("IrpComplete: complete IRP
with status %#x\n",
+   p_irp->IoStatus.Status) );
   IoCompleteRequest( p_irp, IO_NO_INCREMENT );
   break;
 
  case IrpDoNothing:
+  CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl, ("IrpDoNothing: do nothing\n")
);
   break;
  }
 
- if( action != IrpDoNothing )
+ if( action != IrpDoNothing ) {
+  CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl, ("IoReleaseRemoveLock: \n"));
   IoReleaseRemoveLock( &p_ext->remove_lock, p_irp );
+ }
 
- CL_EXIT( CL_DBG_PNP, p_ext->dbg_lvl );
+ CL_TRACE_EXIT( CL_DBG_PNP, p_ext->dbg_lvl, ("returned with status
%#x\n", status) );
  return status;
 }
 
@@ -446,8 +458,10 @@
   * If we get the start request when we're already started, don't 
   * re-initialize the stop lock.
   */
- if( p_ext->last_pnp_state != Started )
+ if( p_ext->last_pnp_state != Started ) {
+  CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl, ("IoInitializeRemoveLock:
stop_lock %p[\n", &p_ext->stop_lock));
   IoInitializeRemoveLock( &p_ext->stop_lock, 'dtci', 0, 1000 );
+ }
 
  CL_EXIT( CL_DBG_PNP, p_ext->dbg_lvl );
  return status;
@@ -495,18 +509,18 @@
  if( p_ext->last_pnp_state == Started )
  {
   /* Acquire the lock so we can release and wait. */
-  CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl, ("IoAcquireRemoveLock: [\n"));
+  CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl, ("IoAcquireRemoveLock:
stop_lock %p[\n",&p_ext->stop_lock));
   status = IoAcquireRemoveLock( &p_ext->stop_lock, p_irp );
   if( !NT_SUCCESS( status ) )
   {
    CL_TRACE( CL_DBG_ERROR, p_ext->dbg_lvl, 
     ("IoAcquireRemoveLock returned %08x. Continue anyway ...\n",
status) );
   }
-  CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl, ("IoAcquireRemoveLock: ]\n"));
+  CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl, ("IoAcquireRemoveLock:
stop_lock ]\n"));
   /* Wait for all IO operations to complete. */
-  CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl, ("IoReleaseRemoveLockAndWait:
[\n"));
+  CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl, ("IoReleaseRemoveLockAndWait:
stop_lock %p[\n",&p_ext->stop_lock));
   IoReleaseRemoveLockAndWait( &p_ext->stop_lock, p_irp );
-  CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl, ("IoReleaseRemoveLockAndWait:
]\n"));
+  CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl, ("IoReleaseRemoveLockAndWait:
stop_lock]\n"));
  }
 
  status = p_ext->vfptr_pnp_po->pfn_query_stop( p_dev_obj, p_irp,
p_action );
@@ -575,21 +589,22 @@
  {
   NTSTATUS status1;
   /*
-   * Re-initialize the remove lock before rolling back the PnP
+   * Re-initialize the stop lock before rolling back the PnP
    * state so that there's no contention while it's uninitialized.
    */
+  CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl, ("IoInitializeRemoveLock:
stop_lock %p[\n", &p_ext->stop_lock));
   IoInitializeRemoveLock( &p_ext->stop_lock, 'dtci', 0, 1000 );
   /* 
    * Acquire the stop lock to allow releasing and waiting when
stopping.
    */
-  CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl, ("IoAcquireRemoveLock: [\n"));
+  CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl, ("IoAcquireRemoveLock:
stop_lock %p[\n", &p_ext->stop_lock));
   status1 = IoAcquireRemoveLock( &p_ext->stop_lock, NULL );
   if( !NT_SUCCESS( status1 ) )
   {
    CL_TRACE( CL_DBG_ERROR, p_ext->dbg_lvl, 
     ("IoAcquireRemoveLock returned %08x. Continue anyway ...\n",
status) );
   }
-  CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl, ("IoAcquireRemoveLock: ]\n"));
+  CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl, ("IoAcquireRemoveLock:
stop_lock ]\n"));
  }
 
  /* Return to the previous PnP state. */
@@ -1367,8 +1382,10 @@
   break;
  }
 
- if( action != IrpDoNothing )
+ if( action != IrpDoNothing ) {
+  CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl, ("IoReleaseRemoveLock: \n"));
   IoReleaseRemoveLock( &p_ext->remove_lock, p_irp );
+ }
 
  CL_EXIT( CL_DBG_PNP, p_ext->dbg_lvl );
  return status;
Index: Q:/projinf4/trunk/core/bus/kernel/bus_driver.c
===================================================================
--- Q:/projinf4/trunk/core/bus/kernel/bus_driver.c (revision 3459)
+++ Q:/projinf4/trunk/core/bus/kernel/bus_driver.c (revision 3460)
@@ -588,7 +588,7 @@
  p_io_stack = IoGetCurrentIrpStackLocation( p_irp );
 
  /* Acquire the stop lock. */
- BUS_TRACE( BUS_DBG_DRV, ("IoAcquireRemoveLock: [\n"));
+ BUS_TRACE( BUS_DBG_DRV, ("IoAcquireRemoveLock: stop_lock %p [\n",
&p_ext->cl_ext.stop_lock));
  status = IoAcquireRemoveLock( &p_ext->cl_ext.stop_lock, p_irp );
  if( !NT_SUCCESS( status ) )
  {
@@ -598,12 +598,13 @@
   BUS_EXIT( BUS_DBG_DRV );
   return status;
  }
- BUS_TRACE( BUS_DBG_DRV, ("IoAcquireRemoveLock: ]\n"));
+ BUS_TRACE( BUS_DBG_DRV, ("IoAcquireRemoveLock: stop_lock]\n"));
 
  /* Acquire the remove lock. */
  status = IoAcquireRemoveLock( &p_ext->cl_ext.remove_lock, p_irp );
  if( !NT_SUCCESS( status ) )
  {
+  BUS_TRACE( BUS_DBG_DRV, ("IoReleaseRemoveLock: stop_lock %p[\n",
&p_ext->cl_ext.stop_lock));
   IoReleaseRemoveLock( &p_ext->cl_ext.stop_lock, p_irp );
   p_irp->IoStatus.Status = status;
   p_irp->IoStatus.Information = 0;
@@ -622,7 +623,9 @@
  }
 
  /* Release the remove and stop locks. */
+ BUS_TRACE( BUS_DBG_DRV, ("IoReleaseRemoveLock:  [\n"));
  IoReleaseRemoveLock( &p_ext->cl_ext.remove_lock, p_irp );
+ BUS_TRACE( BUS_DBG_DRV, ("IoReleaseRemoveLock: stop_lock %p[\n",
&p_ext->cl_ext.stop_lock));
  IoReleaseRemoveLock( &p_ext->cl_ext.stop_lock, p_irp );
 
  BUS_EXIT( BUS_DBG_DRV );
Index: Q:/projinf4/trunk/core/bus/kernel/bus_pnp.c
===================================================================
--- Q:/projinf4/trunk/core/bus/kernel/bus_pnp.c (revision 3459)
+++ Q:/projinf4/trunk/core/bus/kernel/bus_pnp.c (revision 3460)
@@ -973,7 +973,7 @@
   switch( p_io_stack->Parameters.Power.State.SystemState )
   {
    case PowerSystemHibernate:
-   case PowerSystemSleeping1:  // STANDBY support
+   case PowerSystemSleeping1: // STANDBY support
    case PowerSystemWorking:
    case PowerSystemShutdown:
      break;
@@ -1033,6 +1033,7 @@
  /* Continue Power IRP processing. */
  PoStartNextPowerIrp( p_irp );
  IoCompleteRequest( p_irp, IO_NO_INCREMENT );
+ BUS_TRACE( BUS_DBG_PNP, ("IoReleaseRemoveLock:  [\n"));
  IoReleaseRemoveLock( &p_ext->remove_lock, p_irp );
  BUS_EXIT( BUS_DBG_PNP );
 }
@@ -1060,6 +1061,7 @@
  if( !NT_SUCCESS( p_irp->IoStatus.Status ) )
  {
   PoStartNextPowerIrp( p_irp );
+  BUS_TRACE( BUS_DBG_PNP, ("IoReleaseRemoveLock: [\n"));
   IoReleaseRemoveLock( &p_ext->cl_ext.remove_lock, p_irp );
   BUS_TRACE_EXIT( BUS_DBG_ERROR, 
    ("IRP_MN_SET_POWER for system failed by lower driver with %08x.\n",
@@ -1083,6 +1085,7 @@
   /* Propagate the failure. */
   p_irp->IoStatus.Status = status;
   IoCompleteRequest( p_irp, IO_NO_INCREMENT );
+  BUS_TRACE( BUS_DBG_PNP, ("IoReleaseRemoveLock: [\n"));
   IoReleaseRemoveLock( &p_ext->cl_ext.remove_lock, p_irp );
   BUS_TRACE( BUS_DBG_ERROR,
    ("PoRequestPowerIrp returned %08x.\n", status) );
Index: Q:/projinf4/trunk/core/bus/kernel/bus_iou_mgr.c
===================================================================
--- Q:/projinf4/trunk/core/bus/kernel/bus_iou_mgr.c (revision 3459)
+++ Q:/projinf4/trunk/core/bus/kernel/bus_iou_mgr.c (revision 3460)
@@ -1641,6 +1641,7 @@
  p_irp->IoStatus.Status = STATUS_SUCCESS;
  PoStartNextPowerIrp( p_irp );
  IoCompleteRequest( p_irp, IO_NO_INCREMENT );
+ BUS_TRACE( BUS_DBG_POWER, ("IoReleaseRemoveLock:  [\n"));
  IoReleaseRemoveLock( &p_ext->cl_ext.remove_lock, p_irp );
 
  BUS_EXIT( BUS_DBG_POWER );
Index: Q:/projinf4/trunk/core/iou/kernel/iou_pnp.c
===================================================================
--- Q:/projinf4/trunk/core/iou/kernel/iou_pnp.c (revision 3459)
+++ Q:/projinf4/trunk/core/iou/kernel/iou_pnp.c (revision 3460)
@@ -480,6 +480,7 @@
  /* Continue Power IRP processing. */
  PoStartNextPowerIrp( p_irp );
  IoCompleteRequest( p_irp, IO_NO_INCREMENT );
+ IOU_PRINT( TRACE_LEVEL_ERROR, IOU_DBG_PNP, ("IoReleaseRemoveLock:
\n"));
  IoReleaseRemoveLock( &p_ext->remove_lock, p_irp );
  IOU_EXIT( IOU_DBG_PNP );
 }
@@ -507,6 +508,7 @@
  if( !NT_SUCCESS( p_irp->IoStatus.Status ) )
  {
   PoStartNextPowerIrp( p_irp );
+  IOU_PRINT( TRACE_LEVEL_ERROR, IOU_DBG_PNP, ("IoReleaseRemoveLock:
\n"));
   IoReleaseRemoveLock( &p_ext->cl_ext.remove_lock, p_irp );
   IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,
    ("IRP_MN_SET_POWER for system failed by lower driver with %08x.\n",
@@ -530,6 +532,7 @@
   /* Propagate the failure. */
   p_irp->IoStatus.Status = status;
   IoCompleteRequest( p_irp, IO_NO_INCREMENT );
+  IOU_PRINT( TRACE_LEVEL_ERROR, IOU_DBG_PNP, ("IoReleaseRemoveLock:
\n"));
   IoReleaseRemoveLock( &p_ext->cl_ext.remove_lock, p_irp );
   IOU_PRINT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,
    ("PoRequestPowerIrp returned %08x.\n", status) );
Index: Q:/projinf4/trunk/hw/mlx4/kernel/bus/drv/drv.c
===================================================================
--- Q:/projinf4/trunk/hw/mlx4/kernel/bus/drv/drv.c (revision 3459)
+++ Q:/projinf4/trunk/hw/mlx4/kernel/bus/drv/drv.c (revision 3460)
@@ -1161,11 +1161,13 @@
  err = core_init();
  if (err) {
   status = errno_to_ntstatus(err);
+  MLX4_PRINT(TRACE_LEVEL_VERBOSE, MLX4_DBG_DRV, ("core_init failed with
status 0x%x (err %d)\n", status, -err));
   goto end;
  }
  err = mlx4_ib_init();
  if (err) {
   status = errno_to_ntstatus(err);
+  MLX4_PRINT(TRACE_LEVEL_VERBOSE, MLX4_DBG_DRV, ("mlx4_ib_init failed
with status 0x%x (err %d)\n", status, -err));
   goto end;
  }
 
Index: Q:/projinf4/trunk/hw/mlx4/kernel/hca/drv.c
===================================================================
--- Q:/projinf4/trunk/hw/mlx4/kernel/hca/drv.c (revision 3459)
+++ Q:/projinf4/trunk/hw/mlx4/kernel/hca/drv.c (revision 3460)
@@ -1180,7 +1180,7 @@
  }
 
  /* Inititalize the complib extension. */
- cl_init_pnp_po_ext( p_dev_obj, pNextDevObj, pPdo, 0,
+ cl_init_pnp_po_ext( p_dev_obj, pNextDevObj, pPdo, CL_DBG_ERROR |
CL_DBG_PNP,
   &vfptrHcaPnp, NULL );
 
  p_fdo->state = HCA_ADDED;
@@ -2275,6 +2275,7 @@
  /* Continue Power IRP processing. */
  PoStartNextPowerIrp( p_irp );
  IoCompleteRequest( p_irp, IO_NO_INCREMENT );
+ HCA_PRINT( TRACE_LEVEL_ERROR, HCA_DBG_PNP, ("IoReleaseRemoveLock:
\n"));
  IoReleaseRemoveLock( &p_fdo->remove_lock, p_irp );
  HCA_EXIT( HCA_DBG_PO );
 }
@@ -2336,6 +2337,7 @@
  goto exit;
 
 release: 
+ HCA_PRINT( TRACE_LEVEL_ERROR, HCA_DBG_PO, ("IoReleaseRemoveLock:
\n"));
  IoReleaseRemoveLock( &p_fdo->cl_ext.remove_lock, p_irp );
 exit:
  HCA_EXIT( HCA_DBG_PO );
@@ -2415,6 +2417,7 @@
 exit:
  PoStartNextPowerIrp( p_irp );
  IoCompleteRequest( p_irp, IO_NO_INCREMENT );
+ HCA_PRINT( TRACE_LEVEL_ERROR, HCA_DBG_PO, ("IoReleaseRemoveLock:
\n"));
  IoReleaseRemoveLock( &p_fdo->cl_ext.remove_lock, p_irp );
  HCA_EXIT( HCA_DBG_PO );
 }
@@ -2467,6 +2470,7 @@
  goto exit;
 
 release: 
+ HCA_PRINT( TRACE_LEVEL_ERROR, HCA_DBG_PO, ("IoReleaseRemoveLock:
\n"));
  IoReleaseRemoveLock( &p_fdo->cl_ext.remove_lock, p_irp );
 exit: 
  HCA_EXIT( HCA_DBG_PO );
@@ -2484,6 +2488,7 @@
  HCA_ENTER( HCA_DBG_PO );
 
  PoStartNextPowerIrp( p_irp );
+ HCA_PRINT( TRACE_LEVEL_ERROR, HCA_DBG_PO, ("IoReleaseRemoveLock:
\n"));
  IoReleaseRemoveLock( &p_fdo->cl_ext.remove_lock, p_irp );
 
  HCA_EXIT( HCA_DBG_PO );
Index: Q:/projinf4/trunk/hw/mthca/kernel/hca_pnp.c
===================================================================
--- Q:/projinf4/trunk/hw/mthca/kernel/hca_pnp.c (revision 3459)
+++ Q:/projinf4/trunk/hw/mthca/kernel/hca_pnp.c (revision 3460)
@@ -250,7 +250,7 @@
  }
 
  /* Inititalize the complib extension. */
- cl_init_pnp_po_ext( p_dev_obj, pNextDevObj, pPdo, 0,
+ cl_init_pnp_po_ext( p_dev_obj, pNextDevObj, pPdo, CL_DBG_ERROR |
CL_DBG_PNP,
   &vfptrHcaPnp, NULL );
 
  p_ext->state = HCA_ADDED;
@@ -1494,6 +1494,7 @@
  /* Continue Power IRP processing. */
  PoStartNextPowerIrp( p_irp );
  IoCompleteRequest( p_irp, IO_NO_INCREMENT );
+ HCA_PRINT( TRACE_LEVEL_ERROR, HCA_DBG_PO, ("IoReleaseRemoveLock:
\n"));
  IoReleaseRemoveLock( &p_ext->remove_lock, p_irp );
  HCA_EXIT( HCA_DBG_PO );
 }
@@ -1555,6 +1556,7 @@
  goto exit;
 
 release: 
+ HCA_PRINT( TRACE_LEVEL_ERROR, HCA_DBG_PO, ("IoReleaseRemoveLock:
\n"));
  IoReleaseRemoveLock( &p_ext->cl_ext.remove_lock, p_irp );
 exit:
  HCA_EXIT( HCA_DBG_PO );
@@ -1621,6 +1623,7 @@
 exit:
  PoStartNextPowerIrp( p_irp );
  IoCompleteRequest( p_irp, IO_NO_INCREMENT );
+ HCA_PRINT( TRACE_LEVEL_ERROR, HCA_DBG_PO, ("IoReleaseRemoveLock:
\n"));
  IoReleaseRemoveLock( &p_ext->cl_ext.remove_lock, p_irp );
  HCA_EXIT( HCA_DBG_PO );
 }
@@ -1673,6 +1676,7 @@
  goto exit;
 
 release: 
+ HCA_PRINT( TRACE_LEVEL_ERROR, HCA_DBG_PO, ("IoReleaseRemoveLock:
\n"));
  IoReleaseRemoveLock( &p_ext->cl_ext.remove_lock, p_irp );
 exit: 
  HCA_EXIT( HCA_DBG_PO );
@@ -1690,6 +1694,7 @@
  HCA_ENTER( HCA_DBG_PO );
 
  PoStartNextPowerIrp( p_irp );
+ HCA_PRINT( TRACE_LEVEL_ERROR, HCA_DBG_PO, ("IoReleaseRemoveLock:
\n"));
  IoReleaseRemoveLock( &p_ext->cl_ext.remove_lock, p_irp );
 
  HCA_EXIT( HCA_DBG_PO );

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20081113/f524690c/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dbg_print.patch
Type: application/octet-stream
Size: 14907 bytes
Desc: dbg_print.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20081113/f524690c/attachment.obj>


More information about the ofw mailing list