[ofw] patch: Fix a race in the cl_timer code that caused deadlocks in opensm

Hefty, Sean sean.hefty at intel.com
Tue Jun 22 10:00:27 PDT 2010


>  static void CALLBACK
> 
>  __timer_callback(
> 
>                 IN cl_timer_t* const p_timer,
> 
>                 IN BOOLEAN timer_signalled )
> 
>  {
> 
>                 /* timer_signalled is always TRUE, and has no value. */
> 
> +
> 
> +             DWORD thread_id = GetCurrentThreadId();
> 
>                 CL_ASSERT( timer_signalled );
> 
> +
> 
>                 UNUSED_PARAM( timer_signalled );
> 
> 
> 
> +             CL_ASSERT(thread_id!=0);
> 
> +
> 
>                 p_timer->timeout_time = 0;
> 
> -              p_timer->thread_id = GetCurrentThreadId();
> 
> +             p_timer->thread_id = thread_id;
> 

This is touching cl_timer_t fields from a separate thread not under the user's control.  I'd feel happier if locking were added here as well.  Although if this callback can be invoked multiple times simultaneously, then what does saving the thread_id buy us?



More information about the ofw mailing list