Zephyr API Documentation
3.0.0
A Scalable Open Source RTOS
|
|
3.0.0 |
Tests for SMP. More...
Functions | |
void | test_smp_coop_threads (void) |
Verify SMP with 2 cooperative threads. More... | |
void | test_cpu_id_threads (void) |
Verify CPU IDs of threads in SMP. More... | |
void | test_coop_resched_threads (void) |
Test cooperative threads non-preemption. More... | |
void | test_preempt_resched_threads (void) |
Test preemptness of preemptive thread. More... | |
void | test_yield_threads (void) |
Validate behavior of thread when it yields. More... | |
void | test_sleep_threads (void) |
Test behavior of thread when it sleeps. More... | |
void | test_wakeup_threads (void) |
Test behavior of wakeup() in SMP case. More... | |
void | test_smp_release_global_lock (void) |
Test scenairo that a thread release the global lock. More... | |
void | test_inc_concurrency (void) |
Test if the concurrency of SMP works or not. More... | |
static void | process_events (void *arg0, void *arg1, void *arg2) |
Torture test for context switching code. More... | |
Tests for SMP.
|
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.
void test_coop_resched_threads | ( | void | ) |
#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.
void test_cpu_id_threads | ( | void | ) |
#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
void test_inc_concurrency | ( | void | ) |
#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 differenet 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 scenairo:
void test_preempt_resched_threads | ( | void | ) |
#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
void test_sleep_threads | ( | void | ) |
#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.
void test_smp_coop_threads | ( | void | ) |
#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
void test_smp_release_global_lock | ( | void | ) |
#include <tests/kernel/smp/src/main.c>
Test scenairo 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.
void test_wakeup_threads | ( | void | ) |
#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
void test_yield_threads | ( | void | ) |
#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