[ofw][patch][ibal] make IBBUS start up synchronous.
Leonid Keller
leonid at mellanox.co.il
Wed Mar 25 11:00:33 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).
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/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 );
@@ -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;
AL_EXIT( AL_DBG_PNP );
return IB_SUCCESS;
> -----Original Message-----
> From: Sean Hefty [mailto:sean.hefty at intel.com]
> Sent: Wednesday, March 25, 2009 6:59 PM
> To: Leonid Keller; ofw at lists.openfabrics.org
> Subject: RE: [ofw][patch][ibal] make IBBUS start up synchronous.
>
> >+ /* 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);
> >+ }
>
> We should use an actual event mechanism here, rather than spinning.
>
> Also, I'm not a fan of
>
> while/for (...)
> if (x)
> break;
>
> just move 'x' into the while/for check.
>
> - Sean
>
>
More information about the ofw
mailing list