kernel/include: Put kernel stack memory in the right memory

The CONFIG_KERNEL_COHERENCE framework merged with a typo that left its
validation asserts disabled.  But it was written before the "kernel
stacks" feature merged, and so missed the K_KERNEL_STACK_* macros,
which need to put their stacks into __stackmem and not merely
__noinit.

Turning the asserts on exposed the bug.

Fixes #32112

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
Andy Ross 2021-02-09 11:43:20 -08:00 committed by Anas Nashif
commit 38195d5dd1
2 changed files with 6 additions and 4 deletions

View file

@ -44,9 +44,11 @@
#if defined(CONFIG_KERNEL_COHERENCE) #if defined(CONFIG_KERNEL_COHERENCE)
#define __incoherent __in_section_unique(cached) #define __incoherent __in_section_unique(cached)
#define __stackmem __incoherent #define __stackmem __incoherent
#define __kstackmem __stackmem
#else #else
#define __incoherent Z_GENERIC_SECTION(.user_stacks) #define __incoherent
#define __stackmem __incoherent #define __stackmem Z_GENERIC_SECTION(.user_stacks)
#define __kstackmem __noinit
#endif /* CONFIG_KERNEL_COHERENCE */ #endif /* CONFIG_KERNEL_COHERENCE */
#endif /* !_ASMLANGUAGE */ #endif /* !_ASMLANGUAGE */

View file

@ -134,7 +134,7 @@ static inline char *z_stack_ptr_align(char *ptr)
* @param size Size of the stack memory region * @param size Size of the stack memory region
*/ */
#define K_KERNEL_STACK_DEFINE(sym, size) \ #define K_KERNEL_STACK_DEFINE(sym, size) \
struct z_thread_stack_element __noinit \ struct z_thread_stack_element __kstackmem \
__aligned(Z_KERNEL_STACK_OBJ_ALIGN) \ __aligned(Z_KERNEL_STACK_OBJ_ALIGN) \
sym[Z_KERNEL_STACK_SIZE_ADJUST(size)] sym[Z_KERNEL_STACK_SIZE_ADJUST(size)]
@ -152,7 +152,7 @@ static inline char *z_stack_ptr_align(char *ptr)
* @param size Size of the stack memory region * @param size Size of the stack memory region
*/ */
#define K_KERNEL_STACK_ARRAY_DEFINE(sym, nmemb, size) \ #define K_KERNEL_STACK_ARRAY_DEFINE(sym, nmemb, size) \
struct z_thread_stack_element __noinit \ struct z_thread_stack_element __kstackmem \
__aligned(Z_KERNEL_STACK_OBJ_ALIGN) \ __aligned(Z_KERNEL_STACK_OBJ_ALIGN) \
sym[nmemb][Z_KERNEL_STACK_LEN(size)] sym[nmemb][Z_KERNEL_STACK_LEN(size)]