[ofw][patch][ibal] make IBBUS start up synchronous.

Leonid Keller leonid at mellanox.co.il
Wed Mar 25 07:01:36 PDT 2009


IBAL start up has by design two stages.
  - initialization and preparing for getting IBAL PnP events
(synchronous on fdo_start);
  - completing the start up upon receiving ADD_CA event (asynchronous,
after fdo_start).
 
It means, that IBBUS driver notifies the completion of the driver start
operation before it really has finished it.
It causes races in quick HCA disable/enable sequences.
 
This patch makes IBBUS start up synchronous by adding a wait in the
first stage till the end of the second stage.
 
 
Index: core/al/kernel/al_pnp.c
===================================================================
--- core/al/kernel/al_pnp.c (revision 2055)
+++ core/al/kernel/al_pnp.c (working copy)
@@ -1152,6 +1152,7 @@
  cl_status_t   cl_status;
  al_pnp_ca_event_t *p_event_rec;
  ib_ca_attr_t  *p_old_ca_attr;
+ uint32_t   ref_cnt, prev_cnt, i;
 
  AL_ENTER( AL_DBG_PNP );
 
@@ -1232,9 +1233,18 @@
  }
 
  /* Queue the event to the async processing manager. */
- ref_al_obj( &gp_pnp->obj );
+ ref_cnt = ref_al_obj( &gp_pnp->obj );
  cl_async_proc_queue( gp_async_pnp_mgr, &p_event_rec->async_item );
 
+ /* wait up to 3 seconds for the end of event propagation 
+ It is needed for enabling quick HCA disable/enable scenarios. */
+ prev_cnt = ref_cnt - 1;
+ for ( i = 0; i < 30; ++i ) {
+  if (ref_cnt <= prev_cnt)
+   break;
+  cl_thread_suspend(100);
+ }
+
  AL_EXIT( AL_DBG_PNP );
  return IB_SUCCESS;
 }

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20090325/78c4620b/attachment.html>


More information about the ofw mailing list