Repository navigation
userspace_proxy: domain deinit - #11550
Open
abonislawski wants to merge 2 commits into
Open
abonislawski wants to merge 2 commits into
abonislawski wants to merge 2 commits into
Conversation
The Xtensa MMU code in Zephyr links the memory domains into a list that is walked on whichever core maps or unmaps memory. The domain of a userspace module was allocated through the cached alias, so another core could see stale contents. Allocate it from coherent memory, as the application variant of the DP scheduler already does. Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
userspace_proxy_destroy() freed the memory domain of a module without k_mem_domain_deinit(). The domain stayed on the Xtensa MMU domain list in Zephyr, so the DSP panicked once the freed memory was reused. Deinitialize the domain before freeing it. This fails while the domain has member threads, so destroy the proxy in the library manager, after module_adapter_free(), and move a surviving IPC worker thread back to the default domain first. Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
abonislawski
requested review from
dbaluta,
kv2019i,
lbetlej,
lgirdwood,
mmaka1 and
plbossart
as code owners
November 27, 2026 08:28
abonislawski
requested review from
softwarecki
and
a balanced review from Copilot
November 27, 2026 08:28
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
A timed-out free callback can still be running when its work item and module mappings are released, risking a shared-worker fault and breaking IPC for other modules.
1 open issue
What changed in this PR
This PR moves userspace proxy cleanup into the library manager so module memory domains outlive their processing threads and are properly deinitialized before release.
Changes:
- Defer proxy destruction until after module adapter teardown.
- Move the shared IPC worker out of a domain before deinitializing it.
- Allocate domain objects in coherent memory and document their lifetime requirements.
| File | Description |
|---|---|
src/kernel/library_manager/lib_manager.c |
Destroy the proxy after module adapter teardown. |
src/kernel/audio/module_adapter/library/userspace_proxy.c |
Add domain deinitialization, worker detachment, and coherent allocation. |
src/include/sof/audio/module_adapter/library/userspace_proxy.h |
Document the thread-termination requirement for proxy destruction. |
src/audio/module_adapter/library/README.md |
Explain proxy ownership, teardown ordering, and coherent domain storage. |
Review effort: Balanced
Comment on lines
+872
to
+873
| if (userspace) | ||
| userspace_proxy_destroy(drv, userspace); |
Member
Author
There was a problem hiding this comment.
The scenario is real, but it is not introduced here, on main that case already ends in a (different) fault, probably could be also fixed later
PR 11550: test resultsRun date: 2026-11-27 09:13 UTC Tested commit: 91dbd73ac98a4386b6b589aad8bd3cde5dfd1cee |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

No description provided.