Skip to content
Commit 7019baf6 authored by Daniel Leung's avatar Daniel Leung Committed by Carles Cufí
Browse files

tests: kernel/smp: don't use stack to pass thread args



Inside test_get_cpu, the current CPU ID is stored in the test
thread's stack. Another thread is spawned with a pointer to
the variable holding this CPU ID, where this thread is supposed
to run on another CPU. On a cache incoherent platform, this
value of this variable may not have been updated on other CPU's
internal cache. Therefore when checking CPU IDs inside the newly
spawned thread, it is not checking the passed in CPU ID, but
actually whatever is on the another CPU's cache. This results in
random failure on the test_get_cpu test. Since for cache
incoherence architectures, CONFIG_KERNEL_COHERENCE is enabled by
default on SMP where shared data is placed in multiprocessor
coherent (generally "uncached") memory. The fix to this is to
simply make this variable as a global variable, as global
variable are consided shared data and will be placed in
multiprocessor coherent memory, and thus the correct value will
be referenced inside the newly spawned thread.

Fixes #49442

Signed-off-by: default avatarDaniel Leung <daniel.leung@intel.com>
parent dbe38740
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment