[userspace LL] Scheduling part of #10945 - #11138
Conversation
There was a problem hiding this comment.
Pull request overview
This PR ports parts of the “userspace LL scheduling” work (from #10945) into the main scheduling code, primarily to allow user-space LL execution to trigger DP scheduling and to grant the required kernel object access across cores.
Changes:
- Expose DP scheduler hooks as Zephyr syscalls (notably
scheduler_dp_ll_tick(core)andscheduler_dp_internal_free()), and switch DP scheduler data lookup to the user-scheduler registry. - Wire LL → DP tick propagation with an explicit core parameter.
- Add a helper to retrieve the userspace IPC thread and extend access grants for DP task initialization when
CONFIG_SOF_USERSPACE_LLis enabled.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| zephyr/CMakeLists.txt | Adds DP scheduling header to Zephyr syscall header generation. |
| src/schedule/zephyr_ll.c | Updates DP tick invocation to pass a core ID. |
| src/schedule/zephyr_dp_schedule.h | Removes declarations now expected to come from the public DP schedule header/syscall layer. |
| src/schedule/zephyr_dp_schedule.c | Converts DP tick to a syscall-style implementation and switches to user scheduler data lookup. |
| src/schedule/zephyr_dp_schedule_thread.c | Converts internal free to syscall-style implementation (thread variant) with a verify stub. |
| src/schedule/zephyr_dp_schedule_application.c | Adds IPC-thread access grants and adds syscall verification for internal free (app variant). |
| src/ipc/ipc-common.c | Adds ipc_thread_user(core) accessor for the userspace IPC thread. |
| src/include/sof/schedule/dp_schedule.h | Updates DP scheduler public API to syscall declarations under Zephyr full-app builds. |
| src/include/sof/ipc/common.h | Adds prototype for ipc_thread_user(core). |
Suppressed comments (1)
src/schedule/zephyr_dp_schedule_application.c:641
- scheduler_dp_mod_vrfy() uses assert(alloc) in syscall verification code. If asserts are compiled out, a NULL alloc will be dereferenced, causing a kernel fault during syscall verification.
struct mod_alloc_ctx *alloc = mod->priv.resources.alloc;
assert(alloc);
if (alloc->heap) {
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| struct ipc *ipc = ipc_get(); | ||
| struct ipc_user *ipc_user = ipc->ipc_user_pdata; | ||
|
|
||
| return ipc_user->thread[core]; | ||
| } |
| struct task_dp_pdata *pdata = pmod->dev->task->priv_data; | ||
| unsigned int core = pmod->dev->task->core; | ||
| int ret; | ||
|
|
||
| if (!pmod) { |
85786db to
3973461
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Suppressed comments (1)
src/schedule/zephyr_dp_schedule.c:392
scheduler_get_task_info_dp()unconditionally usesscheduler_get_user_data(SOF_SCHEDULE_DP)and then dereferencesdp_schwithout a NULL check. WithCONFIG_SOF_USERSPACE_LL=n, DP is registered in the kernel scheduler list, so this can become a NULL dereference.
scheduler_props->processing_domain = COMP_PROCESSING_DOMAIN_DP;
struct scheduler_dp_data *dp_sch = scheduler_get_user_data(SOF_SCHEDULE_DP);
lock_key = scheduler_dp_lock(cpu_get_id());
scheduler_get_task_info(scheduler_props, data_off_size, &dp_sch->tasks);
The DP scheduler runs tasks in userspace mode, it's registered with the user scheduler list, therefore it should use scheduler_get_user_data(), not scheduler_get_data(). Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
scheduler_dp_ll_tick(() has to recalculate DP deadlines and reschedule DP threads. Make it a syscall to be able to call it from the userspace LL scheduler. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Make scheduler_dp_internal_free() a syscall in the "application" DP implementation. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
The LL userspace thread has to interact with the DP one. Grant required rights. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
| #if CONFIG_SOF_USERSPACE_LL | ||
| struct scheduler_dp_data *dp_sch = scheduler_get_user_data(SOF_SCHEDULE_DP); | ||
| #else | ||
| struct scheduler_dp_data *dp_sch = scheduler_get_data(SOF_SCHEDULE_DP); | ||
| #endif |
There was a problem hiding this comment.
I think longer term we could just call the single function here and have it do the right thing based on the Kconfig.
There was a problem hiding this comment.
@lgirdwood yep, will do something about this
|
One more comment regarding the PR description. It would be very helpful if mergeable PRs contained a description of the actual changes they introduce, instead of only linking to another draft PR. In this case, the description points to a draft #10945, which itself points to another draft #10558, and the only information available there is a very high-level overview of the planned functionality. For reviewers, it is much easier when each PR clearly explains what was changed, why it was changed, and what part of the functionality is covered by that specific PR. |
Most of the scheduling changes from the userspace LL PR #10945