[ofw][patch][ibal] make IBBUS start up synchronous.
Leonid Keller
leonid at mellanox.co.il
Wed Mar 25 11:25:28 PDT 2009
After your comments + fixed one bug ...
Index: core/al/al_ci_ca.h
===================================================================
--- core/al/al_ci_ca.h (revision 4194)
+++ core/al/al_ci_ca.h (working copy)
@@ -103,6 +103,9 @@
/* Array of port GUIDs on this CI CA. */
ib_net64_t *port_array;
+ /* "end of PnP handling" event */
+ cl_event_t event;
+
} al_ci_ca_t;
Index: core/al/al_ci_ca_shared.c
===================================================================
--- core/al/al_ci_ca_shared.c (revision 4193)
+++ core/al/al_ci_ca_shared.c (working copy)
@@ -74,6 +74,7 @@
cl_spinlock_destroy( &p_ci_ca->attr_lock );
cl_qpool_destroy( &p_ci_ca->event_pool );
+ cl_event_destroy( &p_ci_ca->event );
if( p_ci_ca->port_array )
cl_free( p_ci_ca->port_array );
Index: core/al/kernel/al_ci_ca.c
===================================================================
--- core/al/kernel/al_ci_ca.c (revision 4194)
+++ core/al/kernel/al_ci_ca.c (working copy)
@@ -112,6 +112,8 @@
cl_qlist_init( &p_ci_ca->shmid_list );
cl_qpool_construct( &p_ci_ca->event_pool );
p_ci_ca->verbs = *p_ci;
+ cl_event_construct( &p_ci_ca->event );
+ cl_event_init( &p_ci_ca->event, FALSE );
cl_status = cl_spinlock_init( &p_ci_ca->attr_lock );
if( cl_status != CL_SUCCESS )
Index: core/al/kernel/al_pnp.c
===================================================================
--- core/al/kernel/al_pnp.c (revision 4193)
+++ core/al/kernel/al_pnp.c (working copy)
@@ -994,6 +994,7 @@
/* Cleanup the event record. */
deref_al_obj( &gp_pnp->obj );
+ cl_event_signal( &p_event_rec->p_ci_ca->event );
cl_free( p_event_rec );
AL_EXIT( AL_DBG_PNP );
@@ -1137,6 +1138,7 @@
/* Cleanup the event record. */
deref_al_obj( &gp_pnp->obj );
+ cl_event_signal( &p_event_rec->p_ci_ca->event );
cl_free( p_event_rec );
AL_EXIT( AL_DBG_PNP );
@@ -1152,7 +1154,6 @@
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 );
@@ -1233,17 +1234,15 @@
}
/* Queue the event to the async processing manager. */
- ref_cnt = ref_al_obj( &gp_pnp->obj );
+ 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
+ /* wait 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);
- }
+ cl_status = cl_event_wait_on( &p_ci_ca->event,
+ EVENT_NO_TIMEOUT, AL_WAIT_ALERTABLE );
+ if (cl_status != CL_SUCCESS)
+ return IB_ERROR;
AL_EXIT( AL_DBG_PNP );
return IB_SUCCESS;
> -----Original Message-----
> From: Sean Hefty [mailto:sean.hefty at intel.com]
> Sent: Wednesday, March 25, 2009 8:06 PM
> To: Leonid Keller; ofw at lists.openfabrics.org
> Subject: RE: [ofw][patch][ibal] make IBBUS start up synchronous.
>
> >What about the following implementation ?
> >(The patch adds an event field to CI_CA object, and post the
> event at
> >the end of the callback (__pnp_process_add_ca).
>
> This looks better to me. See comments:
>
> >Index: core/al/kernel/al_ci_ca.c
> >===================================================================
> >--- core/al/kernel/al_ci_ca.c (revision 4194)
> >+++ core/al/kernel/al_ci_ca.c (working copy)
> >@@ -112,6 +112,8 @@
> > cl_qlist_init( &p_ci_ca->shmid_list );
> > cl_qpool_construct( &p_ci_ca->event_pool );
> > p_ci_ca->verbs = *p_ci;
> >+ cl_event_construct( &p_ci_ca->event );
> >+ cl_event_init( &p_ci_ca->event, FALSE );
>
> Is there a cl_event_destroy() that needs to be called?
>
> >
> > cl_status = cl_spinlock_init( &p_ci_ca->attr_lock );
> > if( cl_status != CL_SUCCESS )
> >Index: core/al/kernel/al_pnp.c
> >===================================================================
> >--- core/al/kernel/al_pnp.c (revision 4193)
> >+++ core/al/kernel/al_pnp.c (working copy)
> >@@ -994,6 +994,7 @@
> >
> > /* Cleanup the event record. */
> > deref_al_obj( &gp_pnp->obj );
> >+ cl_event_signal( &p_event_rec->p_ci_ca->event );
> > cl_free( p_event_rec );
> >
> > AL_EXIT( AL_DBG_PNP );
> >@@ -1152,7 +1153,6 @@
> > 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 );
> >
> >@@ -1233,17 +1233,15 @@
> > }
> >
> > /* Queue the event to the async processing manager. */
> >- ref_cnt = ref_al_obj( &gp_pnp->obj );
> >+ 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);
> >- }
> >+ cl_status = cl_event_wait_on(
> >+ &p_ci_ca->event, 3000, AL_WAIT_ALERTABLE );
> >+ if (cl_status != CL_SUCCESS)
> >+ return IB_ERROR;
>
> Any reason not to wait indefinitely? What would prevent the
> event from not being signaled or can we ensure that it will be?
>
> - Sean
>
>
More information about the ofw
mailing list