diff --git a/tests/lib/lockfree/boards/qemu_cortex_a53_qemu_cortex_a53_smp.conf b/tests/lib/lockfree/boards/qemu_cortex_a53_qemu_cortex_a53_smp.conf new file mode 100644 index 0000000000000..9eb7d2bea94db --- /dev/null +++ b/tests/lib/lockfree/boards/qemu_cortex_a53_qemu_cortex_a53_smp.conf @@ -0,0 +1,2 @@ +# Configuration overlay for 4-CPU testing on QEMU Cortex-A53 +CONFIG_MP_MAX_NUM_CPUS=4 diff --git a/tests/lib/lockfree/boards/qemu_cortex_a53_qemu_cortex_a53_smp.overlay b/tests/lib/lockfree/boards/qemu_cortex_a53_qemu_cortex_a53_smp.overlay new file mode 100644 index 0000000000000..aa91adf0a64bb --- /dev/null +++ b/tests/lib/lockfree/boards/qemu_cortex_a53_qemu_cortex_a53_smp.overlay @@ -0,0 +1,22 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Device tree overlay to add 2 more CPUs to QEMU Cortex-A53 SMP + * for testing 4-CPU configurations + */ + +/ { + cpus { + cpu@2 { + device_type = "cpu"; + compatible = "arm,cortex-a53"; + reg = <2>; + }; + + cpu@3 { + device_type = "cpu"; + compatible = "arm,cortex-a53"; + reg = <3>; + }; + }; +}; diff --git a/tests/lib/lockfree/src/test_mpsc.c b/tests/lib/lockfree/src/test_mpsc.c index 2085d26b32d6f..35c278bc0f67e 100644 --- a/tests/lib/lockfree/src/test_mpsc.c +++ b/tests/lib/lockfree/src/test_mpsc.c @@ -127,7 +127,10 @@ static void mpsc_consumer(void *p1, void *p2, void *p3) nn = CONTAINER_OF(n, struct test_mpsc_node, n); - spsc_acquire(node_q[nn->id]); + /* Return node to producer's free queue - must retry if queue is full */ + while (spsc_acquire(node_q[nn->id]) == NULL) { + k_yield(); + } spsc_produce(node_q[nn->id]); } }