Skip to content

audio: module_adapter: remove unnecessary IRQ lock/unlock#10974

Open
kv2019i wants to merge 1 commit into
thesofproject:mainfrom
kv2019i:202607-module-adapter-remove-raw-buffer-list-locks
Open

audio: module_adapter: remove unnecessary IRQ lock/unlock#10974
kv2019i wants to merge 1 commit into
thesofproject:mainfrom
kv2019i:202607-module-adapter-remove-raw-buffer-list-locks

Conversation

@kv2019i

@kv2019i kv2019i commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

In the past, the module adapter prepare and free methods called buffer_attach() and buffer_detach() directly. To call these methods safely, it was required to disable IRQs. See commit 3e3d0cd ("buffer: prevent cache corruption") for history and rationale.

However, in commit ecc55f8 ("buf: split sink_list connector to 2 fields") the direct calls to buffer.h were removed. The locks were still kept.

Reviewing the code today, the protected operations work on buffer list maintained in "mod->raw_data_buffers_list". This list is used only by the module adapter itself. External connections go through component "dev->bsink_list" and "dev->bsource_list", which are separate objects and only used in prepare() by the module adapter.

As the pipeline code will ensure module's copy() is not called concurrently with prepare() and free(), it is no longer required to use locks to protect against list operations on the internal list. Removing direct calls to disable interrupts allows to run this code in user-space.

In the past, the module adapter prepare and free methods called buffer_attach()
and buffer_detach() directly. To call these methods safely, it was required
to disable IRQs. See commit 3e3d0cd ("buffer: prevent cache corruption")
for history and rationale.

However, in commit ecc55f8 ("buf: split sink_list connector to 2 fields")
the direct calls to buffer.h were removed. The locks were still kept.

Reviewing the code today, the protected operations work on buffer list
maintained in "mod->raw_data_buffers_list". This list is used only by
the module adapter itself. External connections go through component
"dev->bsink_list" and "dev->bsource_list", which are separate objects
and only used in prepare() by the module adapter.

As the pipeline code will ensure module's copy() is not called concurrently
with prepare() and free(), it is no longer required to use locks to
protect against list operations on the internal list. Removing direct calls
to disable interrupts allows to run this code in user-space.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
@kv2019i

kv2019i commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator Author

For context, related to #10558

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.

Pull request overview

This PR removes local IRQ disable/enable around internal raw_data_buffers_list list updates in the module adapter’s prepare()/free() paths. This aligns the implementation with the current design where these buffers are owned and managed solely by the module adapter, and helps enable running this code in user-space.

Changes:

  • Removed irq_local_disable()/irq_local_enable() guarding raw_data_buffers_list prepend/delete operations in module_adapter_prepare().
  • Removed the same IRQ guard around raw_data_buffers_list deletions in module_adapter_free().
  • Cleaned up now-unneeded flags locals associated with the removed IRQ locking.

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