[ECOS] Doubt pertaining to scheduler locking in interrupt_end

Nick Garnett nickg@ecoscentric.com
Fri Sep 17 11:14:00 GMT 2004


sandeep <shimple0@yahoo.com> writes:

> hi nick,
> 
> I find the code in interrupt_end function in
> kernel/current/src/intr/intr.cxx bit confusing -
> 
> externC void interrupt_end(..args...)
> {
> .....
> #ifdef CYGPKG_KERNEL_SMP_SUPPORT
>     Cyg_Scheduler::lock();
> #endif
> .....
> #ifndef CYGIMP_KERNEL_INTERRUPTS_CHAIN
> .....
> #endif
> 
> #ifdef CYGDBG_KERNEL_DEBUG_GDB_THREAD_SUPPORT
> .....
> #endif
> 
>  // Now unlock the scheduler, which may also call DSRs
>  // and cause a thread switch to happen.
> 
>  Cyg_Scheduler::unlock();
> .....
> }
> 
> scheduler lock is taken in the beginning of the
> function only if SMP support is enabled, but it is
> unlocked irrespectively!
> 
> is there anything that I am missing here??

Yes, in non-SMP configurations the scheduler lock is taken in the
interrupt VSR -- it is just an increment of a location. For SMP we
want to avoid serializing ISRs on different CPUs so we take it at the
end of interrupt processing, in interrupt_end(). Also, since locking
the scheduler is more complex in SMP configurations, this avoids
having to do the locking in assembler.

-- 
Nick Garnett                    eCos Kernel Architect
http://www.ecoscentric.com/     The eCos and RedBoot experts


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list