public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Scheduler problems, thread delay
@ 2003-10-21 14:22 James Yates
  2003-10-21 14:28 ` Gary Thomas
  2003-10-21 14:30 ` Andrew Lunn
  0 siblings, 2 replies; 5+ messages in thread
From: James Yates @ 2003-10-21 14:22 UTC (permalink / raw)
  To: Ecos Discuss (E-mail)

I have been having problems trying to get timeslicing to work.
I have successfully created a two threaded app, both at the same priority, one waits on a semaphore, one it gets it, it flashes a led and posts a semaphore that the other is waiting for etc etc.
This all works fine and I can have 2 threads flashing 2 different leds, continually giving control to each other by 2 semaphores.
I tried removing the semaphores and placing a small delay after each  LED flash to see if the two threads would each be allowed to run. This didn't work and after some investigation, when I make a call to cyg_thread_delay, this never seems to return and so hangs.
I have read lots in the archives of the mailing lists regarding similar problems but nothing seems to work.
I have tried running some of the tests, basic and context HAL tests run. I tried running some of the kernel tests, bin_sem2 failed. I looked into the code for the test and have traced it hanging at a call to cyg_thread_delay.

Strangely, I have also tried testing hal_delay_us which works and provides me with the correct delay.

Does anyone have any idea what is wrong. I am really stuck again. Many thanks in advance.


		James Yates

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

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

* Re: [ECOS] Scheduler problems, thread delay
  2003-10-21 14:22 [ECOS] Scheduler problems, thread delay James Yates
@ 2003-10-21 14:28 ` Gary Thomas
  2003-10-21 14:30 ` Andrew Lunn
  1 sibling, 0 replies; 5+ messages in thread
From: Gary Thomas @ 2003-10-21 14:28 UTC (permalink / raw)
  To: James Yates; +Cc: Ecos Discuss (E-mail)

On Tue, 2003-10-21 at 08:23, James Yates wrote:
> I have been having problems trying to get timeslicing to work.
> I have successfully created a two threaded app, both at the same priority, one waits on a semaphore, one it gets it, it flashes a led and posts a semaphore that the other is waiting for etc etc.
> This all works fine and I can have 2 threads flashing 2 different leds, continually giving control to each other by 2 semaphores.
> I tried removing the semaphores and placing a small delay after each  LED flash to see if the two threads would each be allowed to run. This didn't work and after some investigation, when I make a call to cyg_thread_delay, this never seems to return and so hangs.
> I have read lots in the archives of the mailing lists regarding similar problems but nothing seems to work.
> I have tried running some of the tests, basic and context HAL tests run. I tried running some of the kernel tests, bin_sem2 failed. I looked into the code for the test and have traced it hanging at a call to cyg_thread_delay.
> 
> Strangely, I have also tried testing hal_delay_us which works and provides me with the correct delay.
> 
> Does anyone have any idea what is wrong. I am really stuck again. Many thanks in advance.

Have you checked that interrupts are working?  How about clock 
interrupts?  You can test these either using GDB and setting
a breakpoint, or by some simple "diag_printf()" calls.  

My guess is that either interrupts aren't working at all (they
would not need to be to get your two threads with semaphore
example to run), or your clock isn't generating interrupts.

-- 
Gary Thomas <gary@mlbassoc.com>
MLB Associates


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

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

* Re: [ECOS] Scheduler problems, thread delay
  2003-10-21 14:22 [ECOS] Scheduler problems, thread delay James Yates
  2003-10-21 14:28 ` Gary Thomas
@ 2003-10-21 14:30 ` Andrew Lunn
  1 sibling, 0 replies; 5+ messages in thread
From: Andrew Lunn @ 2003-10-21 14:30 UTC (permalink / raw)
  To: James Yates; +Cc: Ecos Discuss (E-mail)

On Tue, Oct 21, 2003 at 03:23:44PM +0100, James Yates wrote:
> I have been having problems trying to get timeslicing to work.

> I have successfully created a two threaded app, both at the same
> priority, one waits on a semaphore, one it gets it, it flashes a led
> and posts a semaphore that the other is waiting for etc etc.  This
> all works fine and I can have 2 threads flashing 2 different leds,
> continually giving control to each other by 2 semaphores.  I tried
> removing the semaphores and placing a small delay after each LED
> flash to see if the two threads would each be allowed to run. This
> didn't work and after some investigation, when I make a call to
> cyg_thread_delay, this never seems to return and so hangs.  I have
> read lots in the archives of the mailing lists regarding similar
> problems but nothing seems to work.  I have tried running some of
> the tests, basic and context HAL tests run. I tried running some of
> the kernel tests, bin_sem2 failed. I looked into the code for the
> test and have traced it hanging at a call to cyg_thread_delay.

Its probably your clock is broken. Try running the clock* tests.
Check your setup of the timer, make sure you are getting timer
interrupts etc.
 
> Strangely, I have also tried testing hal_delay_us which works and provides me with the correct delay.

This busy waits so does not need interrupts.

     Andrew

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

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

* RE: [ECOS] Scheduler problems, thread delay
@ 2003-10-21 16:19 James Yates
  0 siblings, 0 replies; 5+ messages in thread
From: James Yates @ 2003-10-21 16:19 UTC (permalink / raw)
  To: Ecos Discuss (E-mail)

I have looked further into this problem and can see the RTC isr be installed. I turned on Asserts & Tracing to see what was going on and see the following as the scheduler is started:

TRACE: sched.cxx           [ 318] static void Cyg_Scheduler::start()  {{enter
TRACE: sched.cxx           [ 344] static void Cyg_Scheduler::start_cpu()  {{enter
TRACE: mlqueue.cxx         [ 119] Cyg_Thread* Cyg_Scheduler_Implementation::schedule()  {{enter
TRACE: mlqueue.cxx         [ 192] Cyg_Thread* Cyg_Scheduler_Implementation::schedule()  }}returning thread 00815650
TRACE: except.cxx          [ 247] void cyg_hal_deliver_exception() {{enter
TRACE: except.cxx          [ 207] void Cyg_Exception_Control::deliver_exception() {{enter
TRACE: except.cxx          [ 207] void Cyg_Exception_Control::deliver_exception() ((exception number=4, exception info=00815558))
TRACE: except.cxx          [  83] void cyg_null_exception_handler() {{enter
TRACE: except.cxx          [  83] void cyg_null_exception_handler() ((data=00000000, exception=4, info=00815558))
TRACE: except.cxx          [  86] void cyg_null_exception_handler() 'Uncaught exception: 4'

Would I be right in thinking that what is probably happen is that I am getting an RTC isr but due to an error with the VSR table, an exception is being raised which isn't handled? Does this then imply that my VSR table is wrong which is why cyg_thread_delay never returns.

		James Yates



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

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

* RE: [ECOS] Scheduler problems, thread delay
@ 2003-10-21 15:10 James Yates
  0 siblings, 0 replies; 5+ messages in thread
From: James Yates @ 2003-10-21 15:10 UTC (permalink / raw)
  To: Ecos Discuss (E-mail)

Andrew & gary,

I have ran the clock tests, only clock0 runs, which I see uses timers. All the rest need the RTC.

I have added some diagnostic output to where the RTC is initialised and the interrupt attached, 
which is output and also in the RTC isr which is never output. So you are correct in saying my 
rtc interrupt probably isn't working.

	Thanks for your help guys


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

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

end of thread, other threads:[~2003-10-21 16:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-21 14:22 [ECOS] Scheduler problems, thread delay James Yates
2003-10-21 14:28 ` Gary Thomas
2003-10-21 14:30 ` Andrew Lunn
2003-10-21 15:10 James Yates
2003-10-21 16:19 James Yates

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).