tests/kernel/thread_stack: Fix KERNEL_COHERENCE interactions

Thread stack memory on coherence platforms needs to be linked into a
special section (so it can be cached).

Also, the test_idle_stack case just can't work with coherence.  It's
measuring the CPU's idle stack's unused data, which was initialized at
boot from CPU0, and not necessarily the CPU on which the test is
running.  In practice on intel_adsp_cavs15, our CPU has stale zeroes
in the cache for its unused stack area (presumably from a firmware
memory clear at boot or something?).  Making this work would require a
cache invalidate on all CPUs at boot time before the idle threads
start, we can't do it here in the test because we don't know where the
idle stack pointer is.

Too much work for an esoteric stack size test, basically.  Just
disable on these platforms.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
Andy Ross 2021-02-09 13:01:49 -08:00 committed by Anas Nashif
commit 95bcba5946

View file

@ -29,7 +29,7 @@ struct foo {
int baz;
};
struct foo stest_member_stack;
__kstackmem struct foo stest_member_stack;
void z_impl_stack_info_get(char **start_addr, size_t *size)
{
@ -441,6 +441,14 @@ void no_op_entry(void *p1, void *p2, void *p3)
*/
void test_idle_stack(void)
{
if (IS_ENABLED(CONFIG_KERNEL_COHERENCE)) {
/* Stacks on coherence platforms aren't coherent, and
* the idle stack may have been initialized on a
* different CPU!
*/
ztest_test_skip();
}
int ret;
#ifdef CONFIG_SMP
/* 1cpu test case, so all other CPUs are spinning with co-op