[ofw][patch][ibal] make IBBUS start up synchronous.
Sean Hefty
sean.hefty at intel.com
Wed Mar 25 11:05:49 PDT 2009
>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