schedule: allocate the scheduler objects with sof_heap_alloc()#10821
schedule: allocate the scheduler objects with sof_heap_alloc()#10821kv2019i wants to merge 1 commit into
Conversation
Ensure the scheduler objects and lists of schedulers are allocated such that they can be used with both kernel and user-space LL scheduler implementations. The SOF_MEM_FLAG_KERNEL flag is remevod. This flag has been a no-op for a while, and given scheduler list is not always in kernel anymore, it would be highly confusing to keep it. When CONFIG_SOF_USERSPACE_LL is set, the context of all schedulers is managed in the LL user-space domain. Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
|
For context, part of #10558 |
There was a problem hiding this comment.
Pull request overview
This PR updates scheduler object allocation so scheduler state can reside in the appropriate heap for both kernel and userspace LL scheduler configurations.
Changes:
- Replaces
rzalloc(SOF_MEM_FLAG_KERNEL, ...)withsof_heap_alloc(...). - Selects the LL userspace heap when
CONFIG_SOF_USERSPACE_LLis enabled. - Adds explicit zero-initialization after allocation to preserve previous
rzalloc()behavior.
| struct k_heap *heap = NULL; | ||
|
|
||
| #ifdef CONFIG_SOF_USERSPACE_LL | ||
| heap = sof_sys_user_heap_get(); |
There was a problem hiding this comment.
whats the split between kernel/user memory for scheduler APIs for LL user ?
There was a problem hiding this comment.
@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.
| /* init schedulers list */ | ||
| *sch = rzalloc(SOF_MEM_FLAG_KERNEL, | ||
| sizeof(**sch)); | ||
| *sch = sof_heap_alloc(heap, 0, sizeof(**sch), 0); |
There was a problem hiding this comment.
this would mean, that userspace code now effectively has access to all schedulers, also kernel ones
There was a problem hiding this comment.
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).
Ensure the scheduler objects and lists of schedulers are allocated such that they can be used with both kernel and user-space LL scheduler implementations.
The SOF_MEM_FLAG_KERNEL flag is remevod. This flag has been a no-op for a while, and given scheduler list is not always in kernel anymore, it would be highly confusing to keep it.
When CONFIG_SOF_USERSPACE_LL is set, the context of all schedulers is managed in the LL user-space domain.