#1924 closed defect (fixed)

Enhanced stack allocator configuration

Reported by: Sebastian Huber Owned by: Sebastian Huber
Priority: normal Milestone: 4.11
Component: score Version: 4.11
Severity: normal Keywords:
Cc: joel.sherrill@…, gedare@… Blocked By:
Blocking:

Description

The RTEMS application configuration may provide a special task stack allocator:

http://rtems.org/onlinedocs/doc-current/share/rtems/html/c_user/c_user00419.html

CONFIGURE_TASK_STACK_ALLOCATOR may point to a user provided routine to allocate task stacks. The default value for this field is NULL which indicates that task stacks will be allocated from the RTEMS Workspace.

CONFIGURE_TASK_STACK_DEALLOCATOR may point to a user provided routine to free task stacks. The default value for this field is NULL which indicates that task stacks will be allocated from the RTEMS Workspace.

The current structure has two problems:

A) There is no standard way to initialize the allocator
B) The task stack area size is unknown to the allocator and the stack area size is accounted in the work space size estimate (thus the work space is larger than necessary).

To address problem A we should add an optional initialization function:

CONFIGURE_TASK_STACK_ALLOCATOR_INIT may point to a user provided routine to initialize the task stack allocator. The default value for this field is NULL which indicates that task stacks will be allocated from the RTEMS Workspace.

The prototype should be:

void (*stack_allocator_init_hook)(uintptr_t stack_area_size);

The function should be called right before _Thread_Create_idle() in rtems_initialize_data_structures().

To address problem B we should add an additional field to the Configuration:

typedef struct {

void *work_space_start;
uintptr_t work_space_size;
uintptr_t stack_space_size;
[...]
void (*stack_allocator_init_hook)( uintptr_t );
void * (*stack_allocate_hook)( size_t );
void (*stack_free_hook)( void *);
[...]

} rtems_configuration_table;

The confdefs.h must be modified to separate the stack area estimate from the overall work space estimate. In case no stack allocator is configured the work space size is increased by the stack space size.

Attachments (4)

config-cvs.patch (26.8 KB) - added by Sebastian Huber on 10/26/11 at 10:02:43.
Added stack_space_size field to Configuration.
config.patch (32.9 KB) - added by Sebastian Huber on 11/09/11 at 11:58:22.
Configuration changes.
config_v1.patch (11.7 KB) - added by Sebastian Huber on 12/13/11 at 16:01:09.
Configuration changes.
doc-conf.patch (15.1 KB) - added by Sebastian Huber on 12/14/11 at 15:21:03.
Documentation changes.

Download all attachments as: .zip

Change History (12)

comment:1 Changed on 09/30/11 at 08:28:24 by Sebastian Huber

Owner: changed from Joel Sherrill to Sebastian Huber

Changed on 10/26/11 at 10:02:43 by Sebastian Huber

Attachment: config-cvs.patch added

Added stack_space_size field to Configuration.

Changed on 11/09/11 at 11:58:22 by Sebastian Huber

Attachment: config.patch added

Configuration changes.

comment:2 Changed on 11/09/11 at 11:58:22 by Sebastian Huber

attachments.isobsolete: 01

comment:3 Changed on 11/09/11 at 13:38:58 by Gedare Bloom

Cc: Gedare Bloom added

comment:4 Changed on 11/10/11 at 14:33:27 by Joel Sherrill

Cc: Joel Sherrill added

Changed on 12/13/11 at 16:01:09 by Sebastian Huber

Attachment: config_v1.patch added

Configuration changes.

comment:5 Changed on 12/13/11 at 16:01:09 by Sebastian Huber

attachments.isobsolete: 01

Changed on 12/14/11 at 15:21:03 by Sebastian Huber

Attachment: doc-conf.patch added

Documentation changes.

comment:6 Changed on 12/14/11 at 15:21:03 by Sebastian Huber

attachments.isobsolete: 01

comment:7 Changed on 07/02/12 at 10:40:52 by Sebastian Huber

Resolution: fixed
Status: newclosed

comment:8 Changed on 11/24/14 at 18:58:28 by Gedare Bloom

Version: HEAD4.11

Replace Version=HEAD with Version=4.11 for the tickets with Milestone >= 4.11

Note: See TracTickets for help on using tickets.