Zephyr Project API 3.7.0
A Scalable Open Source RTOS
|
SMP. More...
Modules | |
SMP Integration Tests | |
SMP Module Tests | |
Functions | |
ZTEST (smp, test_smp_coop_threads) | |
Verify SMP with 2 cooperative threads. | |
ZTEST (smp, test_cpu_id_threads) | |
Verify CPU IDs of threads in SMP. | |
ZTEST (smp, test_coop_switch_in_abort) | |
Verify the code path when we do context switch in k_thread_abort on SMP system. | |
ZTEST (smp, test_coop_resched_threads) | |
Test cooperative threads non-preemption. | |
ZTEST (smp, test_preempt_resched_threads) | |
Test preemptness of preemptive thread. | |
ZTEST (smp, test_yield_threads) | |
Validate behavior of thread when it yields. | |
ZTEST (smp, test_sleep_threads) | |
Test behavior of thread when it sleeps. | |
ZTEST (smp, test_wakeup_threads) | |
Test behavior of wakeup() in SMP case. | |
ZTEST (smp, test_smp_release_global_lock) | |
Test scenario that a thread release the global lock. | |
ZTEST (smp, test_inc_concurrency) | |
Test if the concurrency of SMP works or not. | |
static void | process_events (void *arg0, void *arg1, void *arg2) |
Torture test for context switching code. | |
static void | check_affinity (void *arg0, void *arg1, void *arg2) |
Torture test for cpu affinity code. | |
SMP.
|
static |
#include <tests/kernel/smp/src/main.c>
Torture test for cpu affinity code.
Pin thread to a specific cpu. Once thread gets cpu, check the cpu id is correct and then thread will give up cpu.
|
static |
#include <tests/kernel/smp/src/main.c>
Torture test for context switching code.
Leverage the polling API to stress test the context switching code. This test will hammer all the CPUs with thread swapping requests.
ZTEST | ( | smp | , |
test_coop_resched_threads | |||
) |
#include <tests/kernel/smp/src/main.c>
Test cooperative threads non-preemption.
Spawn cooperative threads equal to number of cores supported. Main thread will already be running on 1 core. Check if the last thread created preempts any threads already running.
ZTEST | ( | smp | , |
test_coop_switch_in_abort | |||
) |
#include <tests/kernel/smp/src/main.c>
Verify the code path when we do context switch in k_thread_abort on SMP system.
test logic:
This was the test case for zephyrproject-rtos/zephyr#58040 issue where this test caused system hang.
ZTEST | ( | smp | , |
test_cpu_id_threads | |||
) |
#include <tests/kernel/smp/src/main.c>
Verify CPU IDs of threads in SMP.
Verify whether thread running on other core is parent thread from child thread
ZTEST | ( | smp | , |
test_inc_concurrency | |||
) |
#include <tests/kernel/smp/src/main.c>
Test if the concurrency of SMP works or not.
Validate the global lock and unlock API of SMP are thread-safe. We make 3 thread to increase the global count in different cpu and they both do locking then unlocking for LOOP_COUNT times. It shall be no deadlock happened and total global count shall be 3 * LOOP COUNT.
We show the 4 kinds of scenario:
ZTEST | ( | smp | , |
test_preempt_resched_threads | |||
) |
#include <tests/kernel/smp/src/main.c>
Test preemptness of preemptive thread.
Create preemptive thread and let it run on another core and verify if it gets preempted if another thread of higher priority is spawned
ZTEST | ( | smp | , |
test_sleep_threads | |||
) |
#include <tests/kernel/smp/src/main.c>
Test behavior of thread when it sleeps.
Spawn cooperative thread and call sleep() from main thread. After timeout, all threads has to be scheduled.
ZTEST | ( | smp | , |
test_smp_coop_threads | |||
) |
#include <tests/kernel/smp/src/main.c>
Verify SMP with 2 cooperative threads.
Multi processing is verified by checking whether 2 cooperative threads run simultaneously at different cores
ZTEST | ( | smp | , |
test_smp_release_global_lock | |||
) |
#include <tests/kernel/smp/src/main.c>
Test scenario that a thread release the global lock.
Validate the scenario that make the internal APIs of SMP z_smp_release_global_lock() to be called.
ZTEST | ( | smp | , |
test_wakeup_threads | |||
) |
#include <tests/kernel/smp/src/main.c>
Test behavior of wakeup() in SMP case.
Spawn number of threads equal to number of remaining cores and let them sleep for a while. Call wakeup() of those threads from parent thread and check if they are all running
ZTEST | ( | smp | , |
test_yield_threads | |||
) |
#include <tests/kernel/smp/src/main.c>
Validate behavior of thread when it yields.
Spawn cooperative threads equal to number of cores, so last thread would be pending, call yield() from main thread. Now, all threads must be executed