This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Doubt pertaining to scheduler locking in interrupt_end
- From: Nick Garnett <nickg at ecoscentric dot com>
- To: sandeep <shimple0 at yahoo dot com>
- Cc: ecos-discuss at ecos dot sourceware dot org
- Date: 17 Sep 2004 12:14:11 +0100
- Subject: Re: [ECOS] Doubt pertaining to scheduler locking in interrupt_end
- References: <20040917102257.86327.qmail@web52709.mail.yahoo.com>
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