From d44a98b455f75b1997b8a973053d18cb42dcdbbc Mon Sep 17 00:00:00 2001 From: Serhiy Katsyuba Date: Wed, 21 Oct 2026 16:21:28 +0200 Subject: [PATCH] audio: kpb: allocate component data from coherent memory struct comp_data embeds the draining task, whose Zephyr EDF implementation uses a struct k_work_delayable, and a struct k_mutex. Both are kernel objects and, with CONFIG_KERNEL_COHERENCE, must live in coherent memory. The structure was allocated with SOF_MEM_FLAG_USER only, i.e. from cached memory. This goes unnoticed as long as the draining task is rescheduled with no delay. Once draining in sync mode reschedules the task with a non-zero timeout, z_add_timeout() hits the sys_cache_is_mem_coherent() assertion and the DSP panics in the EDF work queue thread. Allocate the component data with SOF_MEM_FLAG_COHERENT. The history buffer is allocated separately and stays cached. Signed-off-by: Serhiy Katsyuba --- src/audio/kpb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/audio/kpb.c b/src/audio/kpb.c index 4eb5e75a9422..5f68ea19507e 100644 --- a/src/audio/kpb.c +++ b/src/audio/kpb.c @@ -541,7 +541,8 @@ static struct comp_dev *kpb_new(const struct comp_driver *drv, return NULL; dev->ipc_config = *config; - kpb = rzalloc(SOF_MEM_FLAG_USER, sizeof(*kpb)); + /* draining_task's delayed work and lock are kernel objects, must be coherent */ + kpb = rzalloc(SOF_MEM_FLAG_USER | SOF_MEM_FLAG_COHERENT, sizeof(*kpb)); if (!kpb) { comp_free_device(dev); return NULL;