Skip to content

module: generic: allocate module IPC messages from coherent memory - #11277

Open
ujfalusi wants to merge 1 commit into
thesofproject:mainfrom
ujfalusi:peter/fix/mod-ipc-msg-coherent
Open

ujfalusi wants to merge 1 commit into
thesofproject:mainfrom
ujfalusi:peter/fix/mod-ipc-msg-coherent

Conversation

@ujfalusi

@ujfalusi ujfalusi commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

mod_ipc_msg_w_ext_init() allocates the ipc_msg and its tx_data with mod_zalloc(), which uses SOF_MEM_FLAG_USER only and thus returns cached memory. Before the conversion the message was allocated with SOF_MEM_FLAG_COHERENT.

msg->list is linked into the uncached ipc->msg_list by the module (possibly on a secondary core or DP thread) and unlinked by the IPC send worker on the primary core. With a cached msg the worker operates on stale list pointers, list_item_del() fails to unlink the message and the same notification is sent to the host over and over again.

Allocate the message and its payload with SOF_MEM_FLAG_COHERENT, as it was done before.

Fixes: 97dd710 ("ipc: make IPC message allocation userspace-safe")

mod_ipc_msg_w_ext_init() allocates the ipc_msg and its tx_data with
mod_zalloc(), which uses SOF_MEM_FLAG_USER only and thus returns
cached memory. Before the conversion the message was allocated with
SOF_MEM_FLAG_COHERENT.

msg->list is linked into the uncached ipc->msg_list by the module
(possibly on a secondary core or DP thread) and unlinked by the IPC
send worker on the primary core. With a cached msg the worker operates
on stale list pointers, list_item_del() fails to unlink the message
and the same notification is sent to the host over and over again.

Allocate the message and its payload with SOF_MEM_FLAG_COHERENT, as
it was done before.

Fixes: 97dd710 ("ipc: make IPC message allocation userspace-safe")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>

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.

Copilot review overview

🟢 Approval recommended

The focused change matches the established IPC allocation behavior and resolves the cross-core cache coherency regression.

Review effort: Balanced
Findings: None

What changed in this PR

Restores coherent memory allocation for module-owned IPC messages to prevent stale cross-core queue and payload data.

Changes:

  • Allocates IPC message structures and payloads with coherent memory flags.
  • Explicitly zero-initializes both allocations.
File Description
src/​include/​sof/​audio/​module_adapter/​module/​generic.h Restores coherent allocation in module IPC helpers.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@kv2019i kv2019i left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good. Tested on PTL and this fixes the end-of-stream ramp.

@jsarha jsarha 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.

Indeed. I do not think I would have made that error my self, but delegating code writing to AI has its caveats.

@intel-sofci

Copy link
Copy Markdown

PR 11277: test results

Run date: 2026-10-06 16:06 UTC

Tested commit: aac3ca927c96791c39b7ba0c07c3c635b451d621

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

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