Skip to content

pipeline: protect component connections with a mutex#10730

Open
kv2019i wants to merge 1 commit intothesofproject:mainfrom
kv2019i:202604-audio-ppl-list-mutex
Open

pipeline: protect component connections with a mutex#10730
kv2019i wants to merge 1 commit intothesofproject:mainfrom
kv2019i:202604-audio-ppl-list-mutex

Conversation

@kv2019i
Copy link
Copy Markdown
Collaborator

@kv2019i kv2019i commented Apr 28, 2026

In userspace LL builds, use a mutex to protect component connections. This code should work in kernel builds as well, but start with an incremental change that only affects LL builds, in which mutex use is mandatory.

Copilot AI review requested due to automatic review settings April 28, 2026 09:42
@kv2019i
Copy link
Copy Markdown
Collaborator Author

kv2019i commented Apr 28, 2026

For context, this is part of #10558

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces mutex-based protection for component buffer connection list updates in userspace LL builds, replacing the previous IRQ-disable critical section in those configurations.

Changes:

  • Add a per-component sys_mutex (userspace LL only) to guard buffer connection lists.
  • Initialize the new mutex during component initialization for userspace LL builds.
  • Use the mutex in pipeline_connect() / pipeline_disconnect() when CONFIG_SOF_USERSPACE_LL is enabled; otherwise keep IRQ-disable locking.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/include/sof/audio/component.h Adds and initializes a userspace-LL-only mutex in struct comp_dev to protect connection lists.
src/audio/pipeline/pipeline-graph.c Switches connect/disconnect list protection to a mutex in userspace LL builds (IRQ disable otherwise).

Comment thread src/audio/pipeline/pipeline-graph.c
Comment thread src/audio/pipeline/pipeline-graph.c
In userspace LL builds, use a mutex to protect component
connections. This code should work in kernel builds as well, but
start with an incremental change that only affects LL builds, in
which mutex use is mandatory.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
@kv2019i kv2019i force-pushed the 202604-audio-ppl-list-mutex branch from 12d7962 to 8a60add Compare April 28, 2026 12:45
@kv2019i
Copy link
Copy Markdown
Collaborator Author

kv2019i commented Apr 28, 2026

V2 pushed:

  • addressed copilot review comments

#ifdef CONFIG_SOF_USERSPACE_LL
#define PPL_LOCK_DECLARE
#define PPL_LOCK() { int ret = sys_mutex_lock(&comp->list_mutex, K_FOREVER); assert(ret == 0); }
#define PPL_UNLOCK() { int ret = sys_mutex_unlock(&comp->list_mutex); assert(ret == 0); }
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.

can we make these at least do {...} while (0) constructs?

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.

3 participants