thread allocation blocked by stack size

Martin Werner martin.werner at aacmicrotec.com
Mon Nov 2 19:00:37 UTC 2015


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

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

getting a null stack address, which propagates upwards...

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
CONFIGURE_INIT_TASK_STACK_SIZE
CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE
CONFIGURE_UNIFIED_WORK_AREAS
CONFIGURE_UNLIMITED_OBJECTS
CONFIGURE_EXTRA_TASK_STACKS

to no effect but to create (expected) new issues when set to extremes.

I'm using rtems i386 at 4.11, git 74f5eaf, compiled from
rtems-source-builder with gcc at 4.9.2 and newlib-2_1_0 + git ebbb290;
and the equivalent pc386 bsp.

I'm running the whole thing on qemu, via

qemu-system-i386 -kernel example.exe -nodefaults -nographic -serial
stdio

(I've also tested adding a "-m 1G" flag just to check qemu isn't running
out of ram or so..).

* Does anyone know what might be going wrong here?
* Is there some other way to increase the stack size that I should be
using?
* Does the fact that I'm running on qemu possibly effect the issue?

-- 
Martin Erik Werner <martin.werner at aacmicrotec.com>
ÅAC Microtec AB




More information about the users mailing list