public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Yuriy Coureelo <coureelo@micran.ru>
To: ecos-discuss@sources.redhat.com
Subject: [ECOS] Task switching problem
Date: Fri, 01 Jul 2005 08:59:00 -0000	[thread overview]
Message-ID: <526561229.20050701155934@micran.ru> (raw)

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

             reply	other threads:[~2005-07-01  8:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-01  8:59 Yuriy Coureelo [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=526561229.20050701155934@micran.ru \
    --to=coureelo@micran.ru \
    --cc=ecos-discuss@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).