audio: module_adapter: use system user heap for allocs#10843
Conversation
When SOF is built with LL pipes in user-space, module adapter should allocate all resources from the user system heap. Add support for this by modifying allocs to use sof_heap_alloc() and initialize the heap with sof_sys_user_heap_get(). This will return a user-space heap in case SOF is built with CONFIG_SOF_USERSPACE_LL. 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 the SOF module adapter to allocate module-adapter-owned resources from the system “user” heap when SOF is built to run LL pipelines in user-space (CONFIG_SOF_USERSPACE_LL). This aligns module adapter allocations with the user-space execution/memory access model by switching relevant allocations to sof_heap_alloc() and using sof_sys_user_heap_get() for heap selection.
Changes:
- Select the LL user heap for module adapter allocations when
CONFIG_SOF_USERSPACE_LLis enabled. - Replace
rmalloc/rzalloc/rballoc/rfreeusages in module adapter paths withsof_heap_alloc/sof_heap_free. - Explicitly zero-initialize
input_buffers/output_buffersarrays after switching away fromrzalloc.
| @@ -101,7 +101,12 @@ static struct processing_module *module_adapter_mem_alloc(const struct comp_driv | |||
| } | |||
| mod_heap = NULL; | |||
There was a problem hiding this comment.
This is valid, but the USERSPACE_LL build doesn't yet support the DP usage, so this is not the only problem that would be faced. So I think better to leave it like now and not add steps to DP support (that we know already now are incomplete).
| list_for_item(blist, &dev->bsource_list) { | ||
| mod->input_buffers[i].data = rballoc(memory_flags, size); | ||
| mod->input_buffers[i].data = sof_heap_alloc(sof_sys_user_heap_get(), | ||
| memory_flags, size, 0); |
There was a problem hiding this comment.
these are potentially large allocations...
When SOF is built with LL pipes in user-space, module adapter should allocate all resources from the user system heap. Add support for this by modifying allocs to use sof_heap_alloc() and initialize the heap with sof_sys_user_heap_get(). This will return a user-space heap in case SOF is built with CONFIG_SOF_USERSPACE_LL.