Skip to content

Commit 95bcba5

Browse files
Andy Rossnashif
authored andcommitted
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 <[email protected]>
1 parent 1d51e88 commit 95bcba5

File tree

1 file changed

+9
-1
lines changed
  • tests/kernel/threads/thread_stack/src

1 file changed

+9
-1
lines changed

tests/kernel/threads/thread_stack/src/main.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ struct foo {
2929
int baz;
3030
};
3131

32-
struct foo stest_member_stack;
32+
__kstackmem struct foo stest_member_stack;
3333

3434
void z_impl_stack_info_get(char **start_addr, size_t *size)
3535
{
@@ -441,6 +441,14 @@ void no_op_entry(void *p1, void *p2, void *p3)
441441
*/
442442
void test_idle_stack(void)
443443
{
444+
if (IS_ENABLED(CONFIG_KERNEL_COHERENCE)) {
445+
/* Stacks on coherence platforms aren't coherent, and
446+
* the idle stack may have been initialized on a
447+
* different CPU!
448+
*/
449+
ztest_test_skip();
450+
}
451+
444452
int ret;
445453
#ifdef CONFIG_SMP
446454
/* 1cpu test case, so all other CPUs are spinning with co-op

0 commit comments

Comments
 (0)