zephyr/subsys/testsuite/ztest
Peter Mitsis 87ca079e49 tests: z_test_1cpu_start() makes only CPU0 active
When z_test_1cpu_start() is called to ensure that only a single CPU
on an SMP system is available for use in a test, this commit will
ensure that that CPU is the primary CPU--CPU0. This is done because
some timer drivers only have the timer interrupt processed by one CPU.

A bit of a song and dance is performed to achieve this without enabling
the CPU mask/affinity pinning API. If the cpuhold thread is found to
be executing on CPU0, then a new copy of cpuhold thread is created. Once
the new copy is executing (incidentally guaranteed to be on another CPU)
then it informs the original copy and busy waits until it the original
copy is switched out of CPU0. At this point, we can create the next
cpuhold thread to occupy another CPU if needed.

During this song and dance, it is critical that the 'copy' not pend. If
it pends, we can not guarantee which CPU it will execute on when it
unpends. As the cpuhold threads have the highest priority, nothing is
going to cause them to execute on another CPU for as long as they do
not pend.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2024-03-26 18:07:41 -05:00
..
include/zephyr arch: move arch_interface.h under zephyr/arch 2024-03-25 09:58:35 +00:00
src tests: z_test_1cpu_start() makes only CPU0 active 2024-03-26 18:07:41 -05:00
CMakeLists.txt ztest: define _POSIX_C_SOURCE macro 2024-03-25 09:56:37 +00:00
Kconfig