cafe04558c
Under FPU sharing mode, any thread is allowed to generate a Floating Point context (use FP registers in FP instructions), regardless of whether threads are pre-tagged with K_FP_REGS option when they are created. When building with MPU stack guard feature enabled, a large MPU stack guard is required to catch stack overflows, if lazy FP stacking is enabled. When lazy FP stacking is not enabled, a default 32 byte guard is sufficient. If lazy stacking is enabled by default, all threads may potentially generate FP context, so they would need to program a large MPU guard, carved out of their reserved stack memory. To avoid this memory waste, we modify the behavior, and make lazy stacking a dynamically enabled feature, implemented as follows: - threads that are not pre-tagged with K_FP_REGS, and have not generated an FP context use a default MPU guard and disable lazy stacking. As long as the threads do not have an active FP context, they won't stack FP registers, anyway, on ISRs and exceptions, while they will benefit from reserving a small MPU guard size - as soon as a thread starts using FP registers, ISR might temporarily experience some increased ISR latency due to lazy stacking being disabled. This will be the case until the next context switch, where the threads that have active FP context will be tagged with K_FP_REGS, enable lazy stacking, and program a wide MPU guard. The implementation is a tradeoff between performance (ISR latency) and memory consumption. Note that when MPU STACK GUARD feature is not enabled, lazy FP stacking is always activated. Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no> |
||
---|---|---|
.. | ||
core | ||
include | ||
CMakeLists.txt | ||
Kconfig |