[PATCH 06/13] config: Add rtems_malloc_task_stack_for_idle()

Chris Johns chrisj at rtems.org
Fri Sep 30 21:39:04 UTC 2022


On 30/9/2022 7:21 pm, Sebastian Huber wrote:
> Update #4524.
> ---
>  cpukit/doxygen/appl-config.h                | 13 +++++
>  cpukit/include/rtems/rtems/config.h         | 29 +++++++++-
>  cpukit/include/rtems/score/interr.h         |  1 +
>  cpukit/sapi/src/interrtext.c                |  3 +-
>  cpukit/sapi/src/malloctaskstackforidle.c    | 59 +++++++++++++++++++++
>  spec/build/cpukit/librtemscpu.yml           |  1 +
>  spec/build/testsuites/sptests/grp.yml       |  2 +
>  spec/build/testsuites/sptests/spfatal36.yml | 19 +++++++
>  testsuites/sptests/spfatal36/init.c         | 52 ++++++++++++++++++
>  testsuites/sptests/spfatal36/spfatal36.doc  | 11 ++++
>  testsuites/sptests/spinternalerror02/init.c |  2 +-
>  testsuites/sptests/sptls04/init.c           |  2 +
>  12 files changed, 191 insertions(+), 3 deletions(-)
>  create mode 100644 cpukit/sapi/src/malloctaskstackforidle.c
>  create mode 100644 spec/build/testsuites/sptests/spfatal36.yml
>  create mode 100644 testsuites/sptests/spfatal36/init.c
>  create mode 100644 testsuites/sptests/spfatal36/spfatal36.doc
> 
> diff --git a/cpukit/doxygen/appl-config.h b/cpukit/doxygen/appl-config.h
> index aa6dbae648..ee647dc961 100644
> --- a/cpukit/doxygen/appl-config.h
> +++ b/cpukit/doxygen/appl-config.h
> @@ -4842,6 +4842,19 @@
>   * configuration options.  It is assumed that any memory allocated for the
>   * stack of an IDLE task will not be from the RTEMS Workspace or the memory
>   * statically allocated by default.
> + *
> + * For applications with a thread-local storage size which is completely
> + * unknown at the time the application configuration is defined, RTEMS provides
> + * an IDLE task stack allocator which uses rtems_malloc(). 

I thought the TLS size was static and set by the linker? Has this changed?

I am confused about the relationship between an unknown TLS size and IDLE task?
And the relationship of the TLS size and stack size?

> * * The size of the
> + * allocated thread storage area is the sum of stack size defined by the
> + * #CONFIGURE_IDLE_TASK_STACK_SIZE configuration option and the actual
> + * thread-local storage size of the application.

The label CONFIGURE_IDLE_TASK_STACK_SIZE provides no insight into it being
effected by the TLS size.

> * * Define this configuration
> + * option to ``rtems_malloc_task_stack_for_idle`` to use this allocator.  If
> + * the memory allocation fails, then the system terminates with the
> + * INTERNAL_ERROR_CORE fatal source and the
> + * INTERNAL_ERROR_NO_MEMORY_FOR_IDLE_TASK_STACK fatal code during system
> + * initialization.
> + * @endparblock

I am confused about the how and why I would use this change?

Thanks
Chris


More information about the devel mailing list