Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions src/schedule/schedule.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,20 @@ int schedule_task_init(struct task *task,
static void scheduler_register(struct schedule_data *scheduler)
{
struct schedulers **sch = arch_schedulers_get();
struct k_heap *heap = NULL;

#ifdef CONFIG_SOF_USERSPACE_LL
heap = sof_sys_user_heap_get();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

whats the split between kernel/user memory for scheduler APIs for LL user ?

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.

@lgirdwood The idea here is the audio schedulers (i.e. SOF schedule.h) are owned by the system LL thread (that can be now in user-space). This means we move other audio schedulers (DP, EDF) also to user-space. Only initial setup (and cleanup) is done from kernel.

#endif

if (!*sch) {
/* init schedulers list */
*sch = rzalloc(SOF_MEM_FLAG_KERNEL,
sizeof(**sch));
*sch = sof_heap_alloc(heap, 0, sizeof(**sch), 0);
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.

this would mean, that userspace code now effectively has access to all schedulers, also kernel ones

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.

Ack. This does leave a gap with EDF currently, so this is not safe yet for production use. So in short, generic scheduler logic (Zephyr scheduling) in kernel, audio task scheduling in user-space (if SOF built for LL userspace).

if (!*sch) {
tr_err(&sch_tr, "allocation failed");
return;
}
memset(*sch, 0, sizeof(**sch));
list_init(&(*sch)->list);
}

Expand All @@ -65,16 +70,22 @@ static void scheduler_register(struct schedule_data *scheduler)
void scheduler_init(int type, const struct scheduler_ops *ops, void *data)
{
struct schedule_data *sch;
struct k_heap *heap = NULL;

#ifdef CONFIG_SOF_USERSPACE_LL
heap = sof_sys_user_heap_get();
#endif

if (!ops || !ops->schedule_task || !ops->schedule_task_cancel ||
!ops->schedule_task_free)
return;

sch = rzalloc(SOF_MEM_FLAG_KERNEL, sizeof(*sch));
sch = sof_heap_alloc(heap, 0, sizeof(*sch), 0);
if (!sch) {
tr_err(&sch_tr, "allocation failed");
sof_panic(SOF_IPC_PANIC_IPC);
}
memset(sch, 0, sizeof(*sch));
list_init(&sch->list);
sch->type = type;
sch->ops = ops;
Expand Down
Loading