Zephyr Project API 3.7.0
A Scalable Open Source RTOS
|
#include <zephyr/tc_util.h>
#include <zephyr/ztest.h>
#include <zephyr/kernel.h>
#include <ksched.h>
#include <zephyr/kernel_structs.h>
Data Structures | |
struct | thread_info |
Macros | |
#define | RUN_FACTOR (CONFIG_SMP_TEST_RUN_FACTOR / 100.0) |
#define | T2_STACK_SIZE (2048 + CONFIG_TEST_EXTRA_STACK_SIZE) |
#define | STACK_SIZE (384 + CONFIG_TEST_EXTRA_STACK_SIZE) |
#define | DELAY_US 50000 |
#define | TIMEOUT 1000 |
#define | EQUAL_PRIORITY 1 |
#define | TIME_SLICE_MS 500 |
#define | THREAD_DELAY 1 |
#define | SLEEP_MS_LONG ((int)(15000 * RUN_FACTOR)) |
#define | MAX_NUM_THREADS CONFIG_MP_MAX_NUM_CPUS |
#define | SPAWN_AB_PRIO K_PRIO_COOP(10) |
#define | LOOP_COUNT ((int)(20000 * RUN_FACTOR)) |
Enumerations | |
enum | sync_t { LOCK_IRQ , LOCK_SEM , LOCK_MUTEX } |
Functions | |
K_THREAD_STACK_DEFINE (t2_stack,(2048+CONFIG_TEST_EXTRA_STACK_SIZE)) | |
K_SEM_DEFINE (cpuid_sema, 0, 1) | |
K_SEM_DEFINE (sema, 0, 1) | |
static | K_THREAD_STACK_ARRAY_DEFINE (tstack, CONFIG_MP_MAX_NUM_CPUS,(384+CONFIG_TEST_EXTRA_STACK_SIZE)) |
static int | curr_cpu (void) |
static void | t2_fn (void *a, void *b, void *c) |
ZTEST (smp, test_smp_coop_threads) | |
Verify SMP with 2 cooperative threads. | |
static void | child_fn (void *p1, void *p2, void *p3) |
ZTEST (smp, test_cpu_id_threads) | |
Verify CPU IDs of threads in SMP. | |
static void | thread_entry_fn (void *p1, void *p2, void *p3) |
static void | spin_for_threads_exit (void) |
static void | spawn_threads (int prio, int thread_num, int equal_prio, k_thread_entry_t thread_entry, int delay) |
static void | abort_threads (int num) |
static void | cleanup_resources (void) |
static void __no_optimization | thread_ab_entry (void *p1, void *p2, void *p3) |
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. | |
static void | thread_wakeup_entry (void *p1, void *p2, void *p3) |
static void | wakeup_on_start_thread (int tnum) |
static void | check_wokeup_threads (int tnum) |
ZTEST (smp, test_wakeup_threads) | |
Test behavior of wakeup() in SMP case. | |
static void | thread_get_cpu_entry (void *p1, void *p2, void *p3) |
ZTEST (smp, test_get_cpu) | |
void | k_sys_fatal_error_handler (unsigned int reason, const struct arch_esf *esf) |
Test interprocessor interrupt. | |
void | entry_oops (void *p1, void *p2, void *p3) |
ZTEST (smp, test_fatal_on_smp) | |
Test fatal error can be triggered on different core. | |
static void | workq_handler (struct k_work *work) |
ZTEST (smp, test_workq_on_smp) | |
Test system workq run on different core. | |
static void | t1_mutex_lock (void *p1, void *p2, void *p3) |
static void | t2_mutex_lock (void *p1, void *p2, void *p3) |
ZTEST (smp, test_smp_release_global_lock) | |
Test scenario that a thread release the global lock. | |
static void | sync_lock_dummy (void *k) |
static void | sync_lock_irq (void *k) |
static void | sync_unlock_irq (void *k) |
static void | sync_lock_sem (void *k) |
static void | sync_unlock_sem (void *k) |
static void | sync_lock_mutex (void *k) |
static void | sync_unlock_mutex (void *k) |
static void | sync_init (int lock_type) |
static void | inc_global_cnt (void *a, void *b, void *c) |
static int | run_concurrency (void *p1, void *p2, void *p3) |
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 | signal_raise (void *arg0, void *arg1, void *arg2) |
ZTEST (smp, test_smp_switch_torture) | |
static void | check_affinity (void *arg0, void *arg1, void *arg2) |
Torture test for cpu affinity code. | |
ZTEST (smp, test_smp_affinity) | |
static void * | smp_tests_setup (void) |
ZTEST_SUITE (smp, NULL, smp_tests_setup, NULL, NULL, NULL) | |
Variables | |
struct k_thread | t2 |
volatile int | t2_count |
volatile int | sync_count = -1 |
static int | main_thread_id |
static int | child_thread_id |
volatile int | rv |
static struct k_mutex | smutex |
static struct k_sem | smp_sem |
static ZTEST_BMEM volatile struct thread_info | tinfo [CONFIG_MP_MAX_NUM_CPUS] |
static struct k_thread | tthread [CONFIG_MP_MAX_NUM_CPUS] |
static volatile int | thread_started [CONFIG_MP_MAX_NUM_CPUS - 1] |
static struct k_poll_signal | tsignal [CONFIG_MP_MAX_NUM_CPUS] |
static struct k_poll_event | tevent [CONFIG_MP_MAX_NUM_CPUS] |
static int | global_cnt |
static struct k_mutex | smp_mutex |
static void(* | sync_lock )(void *) |
static void(* | sync_unlock )(void *) |
#define DELAY_US 50000 |
#define EQUAL_PRIORITY 1 |
#define LOOP_COUNT ((int)(20000 * RUN_FACTOR)) |
#define MAX_NUM_THREADS CONFIG_MP_MAX_NUM_CPUS |
#define RUN_FACTOR (CONFIG_SMP_TEST_RUN_FACTOR / 100.0) |
#define SLEEP_MS_LONG ((int)(15000 * RUN_FACTOR)) |
#define SPAWN_AB_PRIO K_PRIO_COOP(10) |
#define STACK_SIZE (384 + CONFIG_TEST_EXTRA_STACK_SIZE) |
#define T2_STACK_SIZE (2048 + CONFIG_TEST_EXTRA_STACK_SIZE) |
#define THREAD_DELAY 1 |
#define TIME_SLICE_MS 500 |
#define TIMEOUT 1000 |
enum sync_t |
|
static |
|
static |
|
static |
|
static |
|
static |
void entry_oops | ( | void * | p1, |
void * | p2, | ||
void * | p3 | ||
) |
|
static |
K_SEM_DEFINE | ( | cpuid_sema | , |
0 | , | ||
1 | |||
) |
K_SEM_DEFINE | ( | sema | , |
0 | , | ||
1 | |||
) |
|
static |
K_THREAD_STACK_DEFINE | ( | t2_stack | , |
(2048+CONFIG_TEST_EXTRA_STACK_SIZE) | |||
) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
TESTPOINT: z_smp_release_global_lock() has been call during context switch but global_lock_cnt has not been decrease because no irq_lock() was called.
|
static |
|
static |
|
static |
TESTPOINT: call arch_curr_cpu() to get cpu struct
|
static |
|
static |
|
static |
ZTEST | ( | smp | , |
test_get_cpu | |||
) |
ZTEST | ( | smp | , |
test_smp_affinity | |||
) |
ZTEST | ( | smp | , |
test_smp_switch_torture | |||
) |
ZTEST_SUITE | ( | smp | , |
NULL | , | ||
smp_tests_setup | , | ||
NULL | , | ||
NULL | , | ||
NULL | |||
) |
|
static |
|
static |
|
static |
volatile int rv |
|
static |
|
static |
|
static |
volatile int sync_count = -1 |
|
static |
|
static |
struct k_thread t2 |
volatile int t2_count |
|
static |
|
static |
|
static |
|
static |
|
static |