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

Hefty, Sean sean.hefty at intel.com
Wed Jun 23 12:28:15 PDT 2010


> > The thread ID needs to be protected using 'spinlock', since that lock
> > is held when reading it later.  Or maybe cb_serialize would work, as
> > long as thread_id is cleared after the callback returns...
> 
> Point was that if two callbacks are going to run, they should serialize
> before messing with the thread_id.

I agree, it just wasn't clear to me what the synchronization should be given its intended usage.  I think we need:

acquire(cb_serialization);
thread_id = GetId()
callback()
thread_id = 0
release(cb_serialization);

Reading thread_id in timer_stop should be okay without additional synchronization and timer_stop would always know if it were being invoked from the callback.



More information about the ofw mailing list