IDLE Stacks Not Allocated via User Provided Stack Allocator

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Sep 30 05:39:42 UTC 2021


On 30/09/2021 00:43, Joel Sherrill wrote:
> Hi
> 
> In Feb 2020, idle thread stack memory was changed to be statically
> allocated which is good for most RTEMS deployments. However, it is
> broken when you REALLY need it to be allocated by the plugin stack
> allocator.
> 
> The paravirtualized environment that tripped over this provides stack
> memory protection. A special area of memory is reserved for stacks and
> the processor and host OS enforce that the stack pointer is always
> within the reserved memory segment. This was possible prior to 5
> branching which is what the current RTEMS support for that environment
> is based on.

Is the memory area known at link time? In this case you can use the 
linker script to place the idle stacks in this area. The idle stacks are 
allocated in a special section:

RTEMS_SECTION( ".rtemsstack.idle" )


> 
> The code which needs adjusting is a combination of threadcreateidle.c
> and confdefs/percpu.h which reserves the memory. My current thinking
> is to add another stack allocator hook for the idle stacks and have it
> default to a method which does the current mechanism. This default
> method would be defines in percpu.h and instantiated unless the user
> configures another method.

Yes, this sounds like a good approach if the memory needs to be 
allocated a run-time. We only need an allocator hook. Initialization of 
the allocator can be done via a system initialization handler. 
Deallocation is not needed. The allocator hook should have parameters 
for the idle task stack size and the idle task index.

-- 
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber at embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/


More information about the devel mailing list