Skip to content

audio: kpb: allocate component data from coherent memory - #11328

Merged
lgirdwood merged 1 commit into
thesofproject:mainfrom
serhiy-katsyuba-intel:kpb_coherent_alloc
Oct 22, 2026
Merged

lgirdwood merged 1 commit into
thesofproject:mainfrom
serhiy-katsyuba-intel:kpb_coherent_alloc

Conversation

@serhiy-katsyuba-intel

Copy link
Copy Markdown
Contributor

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.

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 <serhiy.katsyuba@intel.com>
Copilot AI balanced review requested due to automatic review settings October 21, 2026 14:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused allocation change satisfies the embedded kernel objects’ coherence requirements without changing history-buffer allocation or cleanup.

No open issues 🎉

What changed in this PR

Allocates KPB component data in coherent memory to prevent DSP panics when the embedded draining task is rescheduled with a delay.

Changes:

  • Adds SOF_MEM_FLAG_COHERENT while retaining SOF_MEM_FLAG_USER.
  • Documents the kernel-object coherence requirement; history-buffer allocation remains unchanged.
File Description
src/​audio/​kpb.c Allocates component data containing kernel objects in coherent memory.

Review effort: Balanced

@intel-sofci

Copy link
Copy Markdown

PR 11328: test results

Run date: 2026-10-21 15:52 UTC

Tested commit: d44a98b455f75b1997b8a973053d18cb42dcdbbc

mtl pass rate lnl pass rate ptl pass rate wcl pass rate nvl pass rate

@lgirdwood
lgirdwood merged commit f0376b4 into thesofproject:main Oct 22, 2026
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants