Skip to content

[userspace LL] Scheduling part of #10945 - #11138

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

[userspace LL] Scheduling part of #10945#11138
lyakh wants to merge 2 commits into
thesofproject:mainfrom
lyakh:sched

Conversation

@lyakh

@lyakh lyakh commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Most of the scheduling changes from the userspace LL PR #10945

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>

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 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) and scheduler_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_LL is 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.

Comment thread src/ipc/ipc-common.c Outdated
Comment on lines +472 to +476
struct ipc *ipc = ipc_get();
struct ipc_user *ipc_user = ipc->ipc_user_pdata;

return ipc_user->thread[core];
}

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.

right, so this one depends on 671a2cf

Comment on lines 159 to 163
struct task_dp_pdata *pdata = pmod->dev->task->priv_data;
unsigned int core = pmod->dev->task->core;
int ret;

if (!pmod) {
Comment thread src/schedule/zephyr_dp_schedule.c Outdated
Comment on lines +245 to +249
void z_vrfy_scheduler_dp_ll_tick(unsigned int core)
{
z_impl_scheduler_dp_ll_tick(core);
}
#include <zephyr/syscalls/scheduler_dp_ll_tick_mrsh.c>

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.

removing he argument

Comment on lines +660 to +665
K_OOPS(K_SYSCALL_MEMORY_WRITE(task, sizeof(*task)));

struct task_dp_pdata *pdata = task->priv_data;

K_OOPS(K_SYSCALL_OBJ(pdata->event, K_OBJ_EVENT));
K_OOPS(K_SYSCALL_OBJ_INIT(pdata->thread, K_OBJ_THREAD));
Comment on lines +82 to +86
#if defined(__ZEPHYR__) && CONFIG_SOF_FULL_ZEPHYR_APPLICATION
__syscall void scheduler_dp_internal_free(struct task *task);
__syscall void scheduler_dp_ll_tick(unsigned int core);
#include <zephyr/syscalls/dp_schedule.h>
#endif

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.

removing the core argument again, shouldn't be needed

@lyakh
lyakh marked this pull request as draft August 28, 2026 10:16
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>
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