From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14814 invoked by alias); 1 Jul 2005 08:59:49 -0000 Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Received: (qmail 14748 invoked by uid 22791); 1 Jul 2005 08:59:38 -0000 Received: from micran.ru (HELO micran.ru) (217.29.80.82) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Fri, 01 Jul 2005 08:59:38 +0000 Received: from localhost (localhost [127.0.0.1]) by micran.ru (Postfix) with ESMTP id 45A60441B2D for ; Fri, 1 Jul 2005 15:59:35 +0700 (NOVST) Received: from micran.ru ([127.0.0.1]) by localhost (micran.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 05601-04 for ; Fri, 1 Jul 2005 15:59:34 +0700 (NOVST) Received: from Viola.home (Viola.home [192.168.1.157]) by micran.ru (Postfix) with ESMTP id EFC5D3B6BFA for ; Fri, 1 Jul 2005 15:59:34 +0700 (NOVST) Date: Fri, 01 Jul 2005 08:59:00 -0000 From: Yuriy Coureelo Reply-To: Yuriy Coureelo Message-ID: <526561229.20050701155934@micran.ru> To: ecos-discuss@sources.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: [ECOS] Task switching problem X-SW-Source: 2005-07/txt/msg00012.txt.bz2 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