thread allocation blocked by stack size

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Nov 3 08:09:20 UTC 2015



On 02/11/15 20:00, Martin Werner wrote:
> 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

Use only:

#define CONFIGURE_UNIFIED_WORK_AREAS
#define CONFIGURE_UNLIMITED_OBJECTS

See testsuites/samples/fileio/system.h for an example.

>
> 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?

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

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.




More information about the users mailing list