thread allocation blocked by stack size

Martin Werner martin.werner at aacmicrotec.com
Tue Nov 3 12:40:41 UTC 2015


On Mon, 2015-11-02 at 13:11 -0600, Joel Sherrill wrote:
> On Mon, Nov 2, 2015 at 1:00 PM, Martin Werner
> <martin.werner at aacmicrotec.com> wrote:
>         Hi,
>         
>         I'm porting a linux application to rtems, and placing a set of
>         applications into rtems tasks. These tasks individually create
>         a set of
>         threads via pthread_create().
>         (...)
> So you have both a Classic API init task and a POSIX init thread?

Yes, at least for now.


On Mon, 2015-11-02 at 14:36 -0500, Gedare Bloom wrote:
> On Mon, Nov 2, 2015 at 2:00 PM, Martin Werner
> <martin.werner at aacmicrotec.com> wrote:
> > I'm running into issues with stack allocation, in that the second task
> > to start fails to start some of its threads with pthread_create()
> > reporting EAGAIN.
> >
> > I've dug down a bit and seen that this is fundamentally due to
> >
> > cpukit/score/src/threadstackallocate.c:38
> > stack_addr = (*stack_allocate_hook)( the_stack_size );
> >
> What is "the_stack_size"?

For the threads of this application it is set to 65536

> > I've experimented with tweaking task stack size argument in
> > rtems_task_create(...), and modifying the following defines in my
> > initialization:
> > CONFIGURE_EXECUTIVE_RAM_SIZE
> > CONFIGURE_MAXIMUM_TASKS
> > CONFIGURE_MAXIMUM_POSIX_THREADS
> > CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE
> > CONFIGURE_MINIMUM_TASK_STACK_SIZE
> What did you set this one to?

I've tested setting it to (10000*1024) (512*1024), (10*1024), (0), and leaving
it unconfigured.

> > * Is there some other way to increase the stack size that I should be
> > using?
> For pthreads you can set the attr->stacksize to request non-default size.

This would change the stack requirement of each thread, right? But I want to
accomodate those requirements, not change them.


On Tue, 2015-11-03 at 09:09 +0100, Sebastian Huber wrote:
> Use only:
> 
> #define CONFIGURE_UNIFIED_WORK_AREAS
> #define CONFIGURE_UNLIMITED_OBJECTS

I have tried doing this, with no visible change in behaviour.

> Build the samples (--enable-tests=samples) and run the ticker.exe on 
> Qemu. This must work.

The ticker sample works as expected on my qemu setup.


Thanks
--
Martin Erik Werner
<martin.werner at aacmicrotec.com>


More information about the users mailing list