This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Task switching problem


On Mon, Jul 04, 2005 at 05:21:47PM +0600, Yuriy Coureelo wrote:
> Dear Sir!
> 
> AL> You could try enabling the kernel instramentation.
> AL> Andrew
> 
> Attached file contains instrumentation info.
> I translated every byte from memory dump to textual representation.

There is a program to do that. See packages/kernel/current/host/instr

> Would take a look there and maybe catch something wrong, please.

> Num Thread Time                    Arg1       Arg2
> 
> 130 0e     0x2316 SCHED_UNLOCK     0x00000001 0x00000000
> 131 0e     0x2327 SCHED_LOCK       0x00000001 0x00000000
> 132 0e     0x232d SCHED_UNLOCK     0x00000001 0x00000000
> 133 0e     0x2344 ALARM_INIT       0x020f3080 0x00000000
> 134 0e     0x234a ALARM_TRIGGER    0x00000af6 0x00000000
> 135 0e     0x234f ALARM_INTERVAL   0x00000000 0x00000000
> 136 0e     0x2358 SCHED_LOCK       0x00000001 0x00000000
> 137 0e     0x2360 ALARM_ADD        0x020eb158 0x020f3080
> 138 0e     0x237f SCHED_UNLOCK     0x00000001 0x00000000
> 139 0e     0x2396 SCHED_LOCK       0x00000001 0x00000000
> 140 0e     0x239e SCHED_LOCK       0x00000002 0x00000000
> 141 0e     0x23a4 SCHED_UNLOCK     0x00000002 0x00000000
> 142 0e     0x23b0 THREAD_SLEEP     0x020ff280 0x00000000
> 143 0e     0x23b7 SCHED_LOCK       0x00000002 0x00000000
> 144 0e     0x23c2 SCHED_UNLOCK     0x00000002 0x00000000
> 145 0e     0x23cc SCHED_RESCHEDULE 0x00000001 0x00000000
> 146 0e     0x23d4 SCHED_RESCHEDULE 0x00000000 0x00000000
> 147 0e     0x23e5 THREAD_SWITCH    0x020ff280 0x0211dea0
> 
> 148 06     0x23fc INTR_RESTORE     0x00000012 0x00000000
> 149 06     0x24e9 SCHED_LOCK       0x00000001 0x00000000
> 150 06     0x24ef MUTEX_UNLOCK     0x0211de80 0x00000000
> 151 06     0x24f8 SCHED_UNLOCK     0x00000001 0x00000000
> 152 06     0x250c SCHED_LOCK       0x00000001 0x00000000
> 153 06     0x2514 SCHED_LOCK       0x00000002 0x00000000
> 154 06     0x251b SCHED_UNLOCK     0x00000002 0x00000000
> 155 06     0x2527 THREAD_SLEEP     0x0211dea0 0x00000000
> 156 06     0x252e SCHED_LOCK       0x00000002 0x00000000
> 157 06     0x2538 SCHED_UNLOCK     0x00000002 0x00000000
> 158 06     0x2543 SCHED_RESCHEDULE 0x00000001 0x00000000
> 159 06     0x254a SCHED_RESCHEDULE 0x00000000 0x00000000
> 160 06     0x2567 THREAD_SWITCH    0x0211dea0 0x0208cea4

It looks like you get into trouble at 152, 153. There is a
SCHED_UNLOCK missing. 

However its hard to tell what is going on here. You could change 
packages/kernel/current/include/sched.inl

CYG_INSTRUMENT_SCHED(LOCK,get_sched_lock(),0);
 
to

CYG_INSTRUMENT_SCHED(LOCK,get_sched_lock(),__builtin_return_address(0));

and the same with the UNLOCK call. You can then get the address of
what called the lock and unlock functions.

You might also want to enabled more instrumentation calls.

        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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]