3 Jan 2006 11:40
Re: Subtle bug not calling DSRs.
Nick Garnett <nickg <at> ecoscentric.com>
2006-01-03 10:40:12 GMT
2006-01-03 10:40:12 GMT
Sergei Organov <osv <at> javad.com> writes: > Hello, > > I believe I've found bug when eCos doesn't call pended DSR(s) until > _next_ time the scheduler lock is released. The scenario I see is like > this: > > 1. Start single thread that is run as soon as scheduler is enabled. > 2. The thread suspends itself that way or another (wait on a primitive > or just sleep, -- it doesn't matter). > 3. The (2) results in context switch from this thread to the idle thread > from within Cyg_Scheduler::unlock_inner(0). > 4. During context switch interrupt happens that is requesting > corresponding DSR to be run. However, as scheduler is locked during > context switch, the DSR is not invoked on exit from the interrupt. > 5. Context switch continues and transfers control to the idle thread > entry address being Cyg_HardwareThread::thread_entry(). This is > because the idle thread had no chance to run before this point. > 6. Cyg_HardwareThread::thread_entry() has no code to check for pended > DSRs, so the DSR posted in (4) is not run. Good catch. This is a somewhat obscure bug since the number of applications that start the scheduler and then do nothing at all is very small. However, failing to handle DSRs across the context switch to start a thread is clearly wrong. >(Continue reading)
RSS Feed