Skip to content

[userspace LL] library manager commits from #10945 - #11139

Draft
lyakh wants to merge 2 commits into
thesofproject:mainfrom
lyakh:libman
Draft

[userspace LL] library manager commits from #10945#11139
lyakh wants to merge 2 commits into
thesofproject:mainfrom
lyakh:libman

Conversation

@lyakh

@lyakh lyakh commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

lib-manager and llext-manager commits from #10945

lyakh added 2 commits August 28, 2026 10:48
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>

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 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.h and introduced a syscall-capable lib_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_DRV build branch, z_impl_lib_manager_free_module() is defined as static, but sof/lib_manager.h now 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.

Comment thread src/library_manager/llext_manager.c
Comment on lines 426 to 428
#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

@lyakh lyakh Aug 28, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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

Comment on lines +775 to +782
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;
}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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.

@lyakh
lyakh marked this pull request as draft August 28, 2026 09:59
@softwarecki
softwarecki self-requested a review August 28, 2026 15:29
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.

2 participants