Repository navigation
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The tests make unsupported configuration assumptions, causing failures when DRAM execution is disabled and leaked references when syscall caller checking is disabled.
2 open issues
What changed in this PR
This PR restores shared, read-only fast-get copies for low-latency (LL) userspace modules, reducing duplicate coefficient storage while keeping allocation state in the kernel.
Changes:
- Adds a configurable LL fast-get area with bitmap allocation and read-only cached mappings.
- Introduces
fast_get_ll()/fast_put_ll()syscalls and module integration, with private-copy fallback when the area is full. - Adds standalone tests and updates userspace documentation; DP module behavior remains unchanged.
| File | Description |
|---|---|
zephyr/test/userspace/test_ll_user_heap.c |
Adds sharing, cache-reuse, access-control, and fallback tests. |
zephyr/test/userspace/README.md |
Documents the new fast-get test coverage. |
zephyr/lib/fast-get.c |
Implements LL syscalls, separate entry ownership, and cache invalidation. |
zephyr/Kconfig |
Configures the LL fast-get area size. |
src/kernel/schedule/zephyr_ll_user.c |
Allocates and maps the kernel-managed fast-get area. |
src/include/sof/userspace/README.md |
Updates the syscall map and shared-memory design documentation. |
src/include/sof/schedule/ll_schedule_domain.h |
Declares fast-get area allocation and accounting APIs. |
src/include/sof/lib/fast-get.h |
Declares LL syscalls and passthrough implementations. |
src/audio/module_adapter/module/generic.c |
Integrates shared LL copies with resource cleanup and private fallback. |
Review effort: Balanced
PR 11531: test resultsRun date: 2026-11-25 12:47 UTC Tested commit: e8857edf272109017dfc39cbbe825afe7239145a |
aff4e22 to
dd4e192
Compare
|
V2 pushed:
|
There was a problem hiding this comment.
🟡 Changes recommended
The Kconfig default unnecessarily reserves 32 KiB in passthrough builds, reducing the LL user heap from 104 KiB to 72 KiB and potentially causing pipeline allocation failures.
1 open issue
2 resolved since last review
Review effort: Balanced
LL modules get their fast_get() copies, such as SRC coefficients, as private copies in their own memory, since the fast_get() state is in kernel memory and the kernel must not allocate from the LL user heap. Copies of the same data are no longer shared, and LL threads can write them. Reserve a fast_get area in the LL memory region for these copies, 32 kB by default when fast_get() is enabled and the memory has mirrored cached and uncached aliases. Its allocator is a bitmap of 256-byte blocks in kernel memory. Only the cached alias of the area is mapped into the LL memory domain, read-only, so kernel code can write a copy through the uncached alias also in a system call from an LL thread, while LL threads only read it. The cache lines of the area are written back and invalidated at boot, so no dirty line can later overwrite a copy. The area is taken from the LL user heap, which shrinks by the same amount. The private copies that the area replaces came from that heap. Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
LL modules make their fast_get() copies in user mode, as private copies in their own memory, since the fast_get() state is in kernel memory. Add the fast_get_ll() and fast_put_ll() system calls for LL user threads instead, which share a copy between all users of the same data. The copies come from the fast_get area of the LL memory region, which LL threads can only read. Kernel code writes a copy through the uncached alias, and invalidates the cached alias on the calling core on every get, as the core may still hold lines of an earlier copy at the same address. The entries stay in kernel memory, marked as LL copies: fast_get() and fast_put() never use them, and the new calls use no other entries, so a user thread cannot make the kernel free a copy with the wrong allocator. Only the LL and IPC user threads may make the calls, and the data must be readable by the caller. Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
LL modules in user mode get a private copy of their fast_get data, such as SRC coefficients, in the module memory. Every instance makes its own copy, and LL threads can write it. Get the copies with fast_get_ll() instead, and release them with fast_put_ll(), so instances share a read-only copy in the fast_get area of the LL memory region. The resource is tracked as before, in user mode. When the area is full, fall back to a private copy. Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Add a standalone suite for the fast_get area of the LL memory region. An IPC user thread gets a copy of the same data twice and both users share it, the copy is in the area and is freed with its last user, and kernel code does not release it with fast_put(). A freed copy is reused for other data without stale cache lines, and a user thread that writes a copy faults. A thread in the LL memory domain that is not the LL or IPC user thread cannot get copies, nor can the IPC user thread get a copy of memory it cannot read. An LL module gets its copy from the area, and a private copy when the area is full. The suite shares the user thread of the LL user heap suite, as the standalone build has no thread ID left for another one. Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Describe the fast_get area of the LL memory region, how kernel code writes the shared copies of the LL modules and keeps their state, and the private copy when the area is full. Add the fast_get_ll() and fast_put_ll() system calls to the syscall map, and note where the copies of DP modules are. Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
dd4e192 to
e8857ed
Compare
|
V3 pushed:
|
There was a problem hiding this comment.
🟡 Changes recommended
The explicit copy-test invocation lacks a nonzero-area guard, so DRAM staging with CONFIG_SOF_ZEPHYR_LL_FG_AREA_SIZE=0 bypasses the skip predicate and fails assertions on NULL shared-copy acquisitions.
1 open issue
1 resolved since last review
Review effort: Balanced
| static int run_tests(void) | ||
| { | ||
| ztest_run_test_suite(userspace_ll_user_heap, false, 1, 1, NULL); | ||
| #if HAVE_LL_FAST_GET_COPIES |
There was a problem hiding this comment.
This is always defined for ll user builds, so not worth respinning the series.
|
Multiple fails in Intel sof-pr-test, but these are due to sof-logger check -> fix in thesofproject/sof-test#1371 |

With CONFIG_SOF_USERSPACE_LL, the fast_get() state is kernel memory, so since the LL user heap allocator moved to user mode, LL modules have made a private copy of their fast_get data, such as SRC coefficients, in their own memory. Every instance makes its own copy, and LL threads can write it. This series gives LL modules shared read-only copies again, managed by the kernel.
The userspace README and the syscall map are updated.
Known limitation: an LL thread can release a copy that other LL modules still use. This is acceptable limitation as LL modules are not protected from other LL modules in the same domain. This only affects LL modules, not kernel state.
Tested on PTL:
Every commit builds, and the mtl/lnl/ptl/imx8m/testbench builds are OK.