tests/kernel/spinlock: No need to use MP API anymore
This test was written very early. Spinlocks are required for SMP implementation. They couldn't be tested in terms of it, so the test used the low level MP API instead. But of course that breaks if SMP is actually working and the CPU is already started. No need for that now. Just spawn a thread like any other, and filter the test to run only on SMP systems. Fixes #19319 Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
parent
41a72e4c00
commit
6214f81fed
3 changed files with 11 additions and 6 deletions
|
@ -1,2 +1 @@
|
|||
CONFIG_ZTEST=y
|
||||
CONFIG_SMP=y
|
||||
|
|
|
@ -9,9 +9,12 @@
|
|||
#include <kernel.h>
|
||||
#include <spinlock.h>
|
||||
|
||||
BUILD_ASSERT(CONFIG_MP_NUM_CPUS > 1);
|
||||
|
||||
#define CPU1_STACK_SIZE 1024
|
||||
|
||||
K_THREAD_STACK_DEFINE(cpu1_stack, CPU1_STACK_SIZE);
|
||||
struct k_thread cpu1_thread;
|
||||
|
||||
static struct k_spinlock bounce_lock;
|
||||
|
||||
|
@ -91,10 +94,11 @@ void bounce_once(int id)
|
|||
k_spin_unlock(&bounce_lock, key);
|
||||
}
|
||||
|
||||
void cpu1_fn(int key, void *arg)
|
||||
void cpu1_fn(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(key);
|
||||
ARG_UNUSED(arg);
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
while (1) {
|
||||
bounce_once(4321);
|
||||
|
@ -112,7 +116,9 @@ void test_spinlock_bounce(void)
|
|||
{
|
||||
int i;
|
||||
|
||||
z_arch_start_cpu(1, cpu1_stack, CPU1_STACK_SIZE, cpu1_fn, 0);
|
||||
k_thread_create(&cpu1_thread, cpu1_stack, CPU1_STACK_SIZE,
|
||||
cpu1_fn, NULL, NULL, NULL,
|
||||
0, 0, 0);
|
||||
|
||||
k_busy_wait(10);
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
tests:
|
||||
kernel.multiprocessing:
|
||||
platform_whitelist: esp32
|
||||
filter: CONFIG_SMP and CONFIG_MP_NUM_CPUS > 1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue