From c4fd06095cc1bf1a39a51696c1bb3c03795ae209 Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Tue, 22 Mar 2022 18:30:25 +0200 Subject: [PATCH] zephyr: ll-scheduler: k_sem handle must be in coherent memory Allocate "struct zephyr_ll_pdata" in shared/coherent memory as it embeds a "struct k_sem" object. Zephyr kernel code assumes the object to be in cache coherent memory, so incorrect operation may result if condition is not met. Long test runs of all-core capture stress test on Intel cAVS2.5 platform show failures that are fixed with this change. Discovered via runtime assert in zephyr/kernel/sched.c:pend() that is hit without this patch. BugLink: https://github.com/thesofproject/sof/issues/5556 Signed-off-by: Kai Vehmanen --- src/schedule/zephyr_ll.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/schedule/zephyr_ll.c b/src/schedule/zephyr_ll.c index ba3b2d2c42f5..86182cfd0a9a 100644 --- a/src/schedule/zephyr_ll.c +++ b/src/schedule/zephyr_ll.c @@ -502,7 +502,7 @@ int zephyr_ll_task_init(struct task *task, if (ret < 0) return ret; - pdata = rzalloc(SOF_MEM_ZONE_SYS_RUNTIME, 0, SOF_MEM_CAPS_RAM, + pdata = rzalloc(SOF_MEM_ZONE_SYS_SHARED, 0, SOF_MEM_CAPS_RAM, sizeof(*pdata)); if (!pdata) { tr_err(&ll_tr, "zephyr_ll_task_init(): alloc failed");