public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Michael Jones <mjones@linear.com>
To: ecos discuss <ecos-discuss@sourceware.org>
Subject: [ECOS] Scheduler interrupt_end starving and cause stack overflow
Date: Thu, 07 Nov 2013 01:18:00 -0000	[thread overview]
Message-ID: <9254F09D-0BE7-4FF8-A65B-9563496F1969@linear.com> (raw)

I am having trouble with overflowing the idle thread stack. I reduced my application down to a single thread + idle thread to test.

I am using the K70 hal.

The main thread is write/reading to flash, and so it uses a cond wait. All it does is loop on writes and reads for a very long time, like a minute or so. Basically the application uses a single thread for some initialization of the system and I don't care if it starves other threads during startup.

What happens is the idle thread and the main thread trade back and forth, but eventually there is an interrupt_end. This adds some values to the stack. And this happens multiple times.

It appears that the main thread so starves the time the idle thread gets that eventually the calls to interrupt_end overflow the stack. This is simply because starving the idle thread never lets it return.

I can call a wait to give more time for the idle thread, or I can initialize before I start my threads. 

But, does someone have a elegant solution that guarantees there is no overflow? Seems that for a robust system you would want to ensure that if a thread gets real busy due to some outside stimulus you would want to guarantee never to overflow the idle thread.
--
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:[~2013-11-07  1:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=9254F09D-0BE7-4FF8-A65B-9563496F1969@linear.com \
    --to=mjones@linear.com \
    --cc=ecos-discuss@sourceware.org \
    /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).