[userspace LL] library manager commits from #10945 - #11139
Conversation
Extract a privileged LLEXT-related part from lib_manager_module_create() into a separate function to be called from kernel context. At the same time lib_manager_mod_free_priv() already executes privileged operations; to make it callable in userspace, convert lib_manager_free_module() to a system call. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
If LL runs in userspace, it needs access to loaded LLEXT modules, running in DP more too. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
There was a problem hiding this comment.
Pull request overview
This PR brings in the lib-manager / llext-manager changes from #10945 to support userspace LL work by (a) exposing lib_manager_free_module() via Zephyr syscalls and (b) refactoring module creation logic to split “allocate/start-agent” into a helper that can be reused.
Changes:
- Added Zephyr syscall header generation for
include/sof/lib_manager.hand introduced a syscall-capablelib_manager_free_module()API. - Refactored library-manager module creation into
lib_manager_mod_create_priv()with shared error-path cleanup. - Updated LLEXT module domain handling in
llext_manager(currently with behavior changes for DP vs LL domains).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| zephyr/CMakeLists.txt | Adds lib_manager.h to Zephyr syscall header generation list. |
| src/library_manager/llext_manager.c | Changes how modules are added/removed from the LL memory domain. |
| src/library_manager/lib_manager.c | Refactors module creation and adds Zephyr syscall verify/marshalling glue for free-module. |
| src/include/sof/lib_manager.h | Exposes lib_manager_mod_create_priv() and declares lib_manager_free_module() as a syscall (full Zephyr app) or maps to z_impl_... otherwise. |
Suppressed comments (1)
src/library_manager/lib_manager.c:473
- In the
!CONFIG_MM_DRVbuild branch,z_impl_lib_manager_free_module()is defined asstatic, butsof/lib_manager.hnow declares it with external linkage. This causes a linkage mismatch (often a compile error like "static declaration follows non-static declaration") in non-MM builds. Make the definition non-static so it matches the header and syscall conventions.
static int z_impl_lib_manager_free_module(const uint32_t component_id)
{
/* Since we cannot allocate the freeing is not considered to be an error */
tr_warn(&lib_manager_tr, "Dynamic module freeing is not supported");
return 0;
}
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| #ifdef CONFIG_SOF_USERSPACE_LL | ||
| if (!mctx->domain_dp) | ||
| llext_manager_rm_mod_domain(mctx, zephyr_ll_mem_domain()); | ||
| llext_manager_rm_mod_domain(mctx, zephyr_ll_mem_domain()); | ||
| #endif |
There was a problem hiding this comment.
it's the purpose of this PR to change that behaviour, but it's the same issue as #11139 (comment) - so let's delay this PR
| if (config->proc_domain == COMP_PROCESSING_DOMAIN_DP || | ||
| !IS_ENABLED(CONFIG_SOF_USERSPACE_LL)) { | ||
| int ret = lib_manager_mod_create_priv(drv, config, spec, &adapter_priv, | ||
| &userspace, &ops); | ||
|
|
||
| if (ret < 0) | ||
| return NULL; | ||
| } |
There was a problem hiding this comment.
well, yes, in a sense it's a "regression," but a conscious one - it's then fixed in 0e183e9 . So, we can either hold this PR back or st least this commit and merge it in the last step, or merge it anyway, because it "only" breaks userspace LL which isn't functional nor enabled yet anyway.
lib-manager and llext-manager commits from #10945