Skip to content

[userspace LL] scheduling: LLEXT, DP & multicore - #10945

Merged
kv2019i merged 8 commits into
thesofproject:mainfrom
lyakh:llext-ull
Sep 4, 2026
Merged

[userspace LL] scheduling: LLEXT, DP & multicore#10945
kv2019i merged 8 commits into
thesofproject:mainfrom
lyakh:llext-ull

Conversation

@lyakh

@lyakh lyakh commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

This includes #10558 and my patches on top to enable LLEXT and multicore. Current status: passes simple tests with nocodec with both core 0 and core 1 streaming. 2 streams simultaneously run into a problem when the first of them terminates. WiP.

Update: now that #10558 has mostly been merged, this PR still carries remaining fixes for multicore, LLEXT, cold sections. At its peak this PR contained more than a 100 commits, as of today Aug 28th only 12 patches remain

Update: as of today Sep 2nd only 7 patches remain and this is now considered to be the final step (short of making userspace LL on by default on ACE3+)

@lyakh

lyakh commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator Author

After multiple PRs got merged we're down from 108 commits to 32

@lyakh

lyakh commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator Author

let me mark it "ready" to have some on-device testing

@lyakh
lyakh marked this pull request as ready for review August 27, 2026 13:40
Copilot AI lite review requested due to automatic review settings August 27, 2026 13:40
@intel-sofci

intel-sofci commented Sep 1, 2026

Copy link
Copy Markdown

PR 10945: test results

Run date: 2026-09-04 09:03 UTC

Tested commit: 6a70cdd8d32dfaab35b7dd602be7d6add461a79b

mtl pass rate lnl pass rate ptl pass rate wcl pass rate nvl pass rate

@lyakh lyakh changed the title [DNM][Do Not Review][WiP][PoC] userspace LL scheduling: LLEXT & multicore [userspace LL] scheduling: LLEXT, DP & multicore Sep 2, 2026
@lyakh
lyakh requested a lite review from Copilot September 2, 2026 08:26

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.

🟡 Changes recommended

Confirmed issues include unsafe userspace LL domain mapping for DP modules and uninitialized/per-core IPC state leading to potential deadlocks or invalid memory access.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (1)

src/ipc/ipc-common.c:619

  • ipc_user is allocated with sof_heap_alloc() but never zero-initialized; init_needed[] and the per-core thread/event pointers start as uninitialized heap garbage. This can cause ipc_user_forward_cmd() to deadlock (spurious init_needed[core]) or dereference invalid per-core pointers.
	struct ipc *ipc = ipc_get();
	struct ipc_user *ipc_user = sof_heap_alloc(sof_sys_user_heap_get(),
						   SOF_MEM_FLAG_USER | SOF_MEM_FLAG_COHERENT,
						   sizeof(*ipc_user), 0);
	int ret;
  • Files reviewed: 14/14 changed files
  • Comments generated: 2
  • Review effort level: Lite

Comment thread src/ipc/ipc-common.c
Comment thread src/library_manager/llext_manager.c

@kv2019i kv2019i left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good, some minor comments and usual nagging about z_vrfy code ...

Comment thread src/library_manager/lib_manager.c
Comment thread src/include/sof/ipc/common.h Outdated
#define IPC_TASK_POWERDOWN BIT(3)

#ifdef CONFIG_CORE_COUNT
#define CORE_COUNT CONFIG_CORE_COUNT

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Isn't CORE_COUNT a bit generic (and short) definition in a public header file?

Most places in SOF just use CONFIG_CORE_COUNT (defined in sof/src/platform/Kconfig), so this should be available for all builds. Maybe "ifndef CONFIG_CORE_COUNT" and set it 1 for the failing builds (library, cmocka, ztests?)

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.

uhm, rather not. Really don't think #define CONFIG_foo ... is a good thing. How about IPC_DSP_CORE_COUNT?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@lyakh I'm good with IPC_DSP_ prefix. Or alternatively pull in some header that will ensure CONFIG_CORE_COUNT is defined.

Comment thread src/schedule/zephyr_dp_schedule_application.c
Comment thread src/ipc/ipc4/helper.c
userspace/ksem.c
)
if(CONFIG_USERSPACE AND CONFIG_SOF_USERSPACE_INTERFACE_ALLOC)
if(CONFIG_USERSPACE AND CONFIG_SOF_USERSPACE_INTERFACE_ALLOC AND NOT CONFIG_SOF_USERSPACE_LL)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ack, filed #11147 to track this,

@lyakh

lyakh commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator Author

@kv2019i comments addressed

@lyakh

lyakh commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator Author

@lrudyX MTL test hung?

@kv2019i

kv2019i commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

@lyakh wrote:

@lrudyX MTL test hung?

I restarted the MTL test.

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>
Make scheduling LL thread and synchronisation objects per-core and
forward IPCs and scheduling events accordingly.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Checking pointer for non-NULL after dereferencing it makes no sense.
Swap the order.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Simplify code by using cached core ID values instead of querying the
hardware or re-evaluating expressions.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
In case of userspace LL scheduling the (also userspace) IPC thread
needs access rights to DP assets like the thread itself and its stack
and synchronisation primitives.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
When running in syscall context on behalf of a userspace thread
dynamically mapped memory doesn't automatically become accessible.
To make it accessible it has to be added to the thread memory domain.

This is a problem for loadable modules with executable cold sections.
To be able to execute them they have to be mapped to threads with the
executable bit set. While for linking that memory has to be mapped
writable. To solve the problem we perform linking from the kernel IPC
context before forwarding to the userspace IPC thread.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Re-enable LLEXT, DRAM execution and data, the DP scheduler and boot
time testing with userspace LL with a small restriction for the
latter - userspace allocation failure tests aren't currently working.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
@lyakh lyakh removed the DNM Do Not Merge tag label Sep 4, 2026
@kv2019i
kv2019i merged commit 90687ac into thesofproject:main Sep 4, 2026
44 of 46 checks passed
@lyakh
lyakh deleted the llext-ull branch September 4, 2026 10:38
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.

4 participants