public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Task switching problem
@ 2005-07-01  8:59 Yuriy Coureelo
  2005-07-01 10:53 ` Andrew Lunn
  0 siblings, 1 reply; 7+ messages in thread
From: Yuriy Coureelo @ 2005-07-01  8:59 UTC (permalink / raw)
  To: ecos-discuss

Good Day!

eCos: v2.0-20030509-0835
Architecture: ARM, AT91

PROBLEM DESCRIPTION
There are 4 active threads: system idle thread, thread A working with
FIQ, thread B working with IRQ, high-priority thread C just blinking
a LED. Starting hardware I see blinking LED (good) and working threads
A and B (fine). System works from couple of seconds upto couple of
minutes, then LED stops blinking.

I tried to find out a reason lot of times, and had following common info:

01.FIQ incoming
02.ISR and DSR called, DSR posted flags for thread A
03.Scheduler takes a decision to switch from idle to thread A
04.IRQ incoming but scheduler works yet, so ISR called and DSR just
  posted
05.Threads A start working but there is pending DSR (posted at step 04)
06.DSR called and posted flags for thread B
07.Scheduler takes a decision to switch from thread A to thread B
08.Thread B working and going to sleep
09.IRQ incoming but scheduler already works, so ISR called and DSR just
  posted
10.Scheduler takes a decision to switch from thread B to thread A,
   because thread B already sleeping, and IRQ (at step 09) posted DSR
   a bit later than scheduler checks DSRs at its beginning
11.After switching scheduler checks for DSRs again and detects DSR,
   posted at step 09:

if( Cyg_Interrupt::DSRs_pending() ) {
    inc_sched_lock();   // reclaim the lock
    continue;           // go back to head of loop
}

12.DSR called and posted flags for thread B
13.Scheduler takes a decision to switch from thread A to thread B
   (thread A didn't even continue)
14.Thread B working and going to sleep
15.Scheduler takes a decision to switch from thread B to thread A
16.Thread A working and going to sleep
17.Scheduler takes a decision to switch from thread A to idle
18.interrupt_end() at last exits,
   Cyg_Scheduler::get_sched_lock() returns 0 (my checkpoint)

But idle thread isn't called.
When new interrupt comes, interrupt_end() exits because sched_lock
already equals 1, althoug no calls to inc_sched_lock() and
set_sched_lock().
No more interrupts come after that (i think cpu got somewhere away).
Stacks seems are OK (I have memory dump over JTAG).

I guess it is extremely hard to find a reason of the problem, but
would you point me where or what I should search, please.

Yuriy Coureelo



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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-07-07  5:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-01  8:59 [ECOS] Task switching problem Yuriy Coureelo
2005-07-01 10:53 ` Andrew Lunn
2005-07-04 10:22   ` Re[2]: " Yuriy Coureelo
2005-07-04 11:13     ` Andrew Lunn
2005-07-05  3:51       ` Yuriy Coureelo
2005-07-05  7:24         ` Andrew Lunn
2005-07-07  5:33           ` Yuriy Coureelo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).