From 13d3036e37bc40f3035d667e42b77237cabb4593 Mon Sep 17 00:00:00 2001 From: Andy Ross Date: Wed, 6 Oct 2021 09:56:38 -0700 Subject: [PATCH] tests/msgq_usage: Correct memory usage for cache-incoherent platforms When CONFIG_KERNEL_COHERENCE=y (e.g on the various intel_adsp platforms under SMP) it's not legal to share stack memory between CPUs, because the stack is cached, and the L1 cache is incoherent. The kernel will automatically detect the mistake when the memory contains a kernel object (spinlock, IPC object, etc...). But here the test was just passing async buffers into the msgq layer, and nothing watches that. The fix is simple: make them static. Fixes #35857 Signed-off-by: Andy Ross --- tests/kernel/msgq/msgq_usage/src/main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/kernel/msgq/msgq_usage/src/main.c b/tests/kernel/msgq/msgq_usage/src/main.c index 27a4f806f43..f80a7e2abda 100644 --- a/tests/kernel/msgq/msgq_usage/src/main.c +++ b/tests/kernel/msgq/msgq_usage/src/main.c @@ -50,7 +50,7 @@ enum message_info { static void service_manager_entry(void *p1, void *p2, void *p3) { - unsigned long data[2]; + static unsigned long data[2]; while (1) { k_msgq_get(&manager_q, data, K_FOREVER); @@ -96,7 +96,7 @@ static void start_service_manager(void) static void service1_entry(void *p1, void *p2, void *p3) { - unsigned long service_data[2]; + static unsigned long service_data[2]; struct k_msgq *client; int ret; @@ -127,7 +127,7 @@ static void service1_entry(void *p1, void *p2, void *p3) static void service2_entry(void *p1, void *p2, void *p3) { - unsigned long service_data[2]; + static unsigned long service_data[2]; struct k_msgq *client; int ret; @@ -174,8 +174,8 @@ static void register_service(void) static void client_entry(void *p1, void *p2, void *p3) { - unsigned long client_data[2]; - unsigned long service_data[2]; + static unsigned long client_data[2]; + static unsigned long service_data[2]; struct k_msgq *service1q; struct k_msgq *service2q; bool query_service = false;