[ECOS] cyg_scheduler_lock() understanding...
Andrew Lunn
andrew@lunn.ch
Tue Oct 18 16:48:00 GMT 2005
On Tue, Oct 18, 2005 at 04:42:57PM +0200, Stefan Sommerfeld wrote:
> Hi,
> >>
> >>I still search for the delay DSR and found it that the DSR will be
> >>permitted due to a scheduler_lock. I quickly have some question while
> >>going
> >>deeper into ecos.
> >>
> >>Does the scheduler_lock also permits the thread switching? Or is it
> >>possible that the scheduler switches to another thread while in lock
> >>mode?
> >>
> >>If thread switching is permitted, how could the scheduler_lock be higher
> >>than one if no dsr or isr calls scheduler_lock()?
> >
> >Actually, every ISR causes a scheduler lock (it's part of the entry
> >protocol into the system). So, if the scheduler was locked for some
> >other reason before the ISR happened, it will still be locked when it
> >finishes and DSR processing will be postponed until it is freed (i.e.
> >the scheduler lock value returns to zero).
> >
> >You can determine, in great detail, what's happening here by enabling
> >the system trace/log features. This will tell you when the scheduler
> >gets locked (and where), when interrupts occur, etc.
> >
> Aha... i see. So scheduler can only be locked by a thread (one time)
A thread can lock it multiple times.
> and by
> multiple irq's. What i see are sometimes delays above 10ms between lock and
> unlock. Is the unlock_inner() scheduler method save? Or can it be
> interrupted by in irq which then causes the lock counter to change?
IRQ can interrupt the unlock_inner() function. This ISR will then
increment the lock and decrement it when it is finished. The code
handles this and will execute any DSRs which got posted while
unlocking the schedular.
> My problems appear after a longer time (more then 10 mins), so heavy output
> would not help :).
The tracing can be into a circular buffer. If you have a way to detect
the problem has happened you can then either dump the buffers contents
imeadietely, or disable logging and then take your time to dump the
trace.
Take a look at
http://ecos.sourceware.org/docs-latest/user-guide/kernel-instrumentation.html
Andrew
--
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