Skip to content

ipc: ipc-helper: use list_mutex to guard buffer list in userspace LL#10762

Open
kv2019i wants to merge 1 commit into
thesofproject:mainfrom
kv2019i:202605-ipchelper-use-mutex
Open

ipc: ipc-helper: use list_mutex to guard buffer list in userspace LL#10762
kv2019i wants to merge 1 commit into
thesofproject:mainfrom
kv2019i:202605-ipchelper-use-mutex

Conversation

@kv2019i
Copy link
Copy Markdown
Collaborator

@kv2019i kv2019i commented May 11, 2026

In user-space LL builds (CONFIG_SOF_USERSPACE_LL), irq_local_disable() is a privileged operation. In ipc_comp_free(), use sys_mutex_lock/unlock on the per-component list_mutex to protect buffer list iteration instead.

This follows the same locking pattern as PPL_LOCK/PPL_UNLOCK used in pipeline_disconnect().

In user-space LL builds (CONFIG_SOF_USERSPACE_LL), irq_local_disable()
is a privileged operation. In ipc_comp_free(), use sys_mutex_lock/unlock
on the per-component list_mutex to protect buffer list iteration instead.

This follows the same locking pattern as PPL_LOCK/PPL_UNLOCK used in
pipeline_disconnect().

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Copilot AI review requested due to automatic review settings May 11, 2026 11:34
@kv2019i
Copy link
Copy Markdown
Collaborator Author

kv2019i commented May 11, 2026

For context, 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 updates ipc_comp_free() to avoid using irq_local_disable() in user-space LL builds (CONFIG_SOF_USERSPACE_LL), where disabling IRQs is a privileged operation, by guarding component buffer-list iteration with the per-component list_mutex instead.

Changes:

  • Add a CONFIG_SOF_USERSPACE_LL conditional path that locks/unlocks icd->cd->list_mutex around producer/consumer buffer list iteration in ipc_comp_free().
  • Keep the existing irq_local_disable()/irq_local_enable() path for non-user-space builds.

Comment thread src/ipc/ipc-helper.c
Comment on lines +341 to +345
#ifdef CONFIG_SOF_USERSPACE_LL
sys_mutex_lock(&icd->cd->list_mutex, K_FOREVER);
#else
irq_local_disable(flags);
#endif
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I wonder if we can just replace irq_local_disable() regardless of user or not.

Comment thread src/ipc/ipc-helper.c
Comment on lines +341 to +343
#ifdef CONFIG_SOF_USERSPACE_LL
sys_mutex_lock(&icd->cd->list_mutex, K_FOREVER);
#else
Copy link
Copy Markdown
Member

@lgirdwood lgirdwood left a comment

Choose a reason for hiding this comment

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

I'm good, but just wondered if we should just go full change here and have every config do the same. Not sure if you have already tried.

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