-
Notifications
You must be signed in to change notification settings - Fork 349
heap: more updates with some fixes. #10114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Allow the developer to set the maximum heap size so that power savings can be made when full memory is not required for device use cases. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
There was a problem hiding this comment.
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 replaces hard-coded heap size macros with configurable Kconfig options and updates memory allocation APIs and documentation to use flag-based terminology instead of zones.
- Introduce
SOF_ZEPHYR_HEAP_SIZEandSOF_ZEPHYR_VIRTUAL_HEAP_SIZEKconfig options and replaceHEAPMEM_SIZEdefines. - Update allocator and platform memory headers to switch from zone-based to
SOF_MEM_FLAG_*usage. - Refine function signatures, comments, and log messages across modules (alloc, DMA trace, probe, component, Google RTC mock, buffers).
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| zephyr/lib/alloc.c | Switched HEAPMEM_SIZE to CONFIG_SOF_ZEPHYR_VIRTUAL_HEAP_SIZE, updated error message and comments. |
| zephyr/include/rtos/alloc.h | Removed zone/capabilities parameters from allocator docs; updated parameter descriptions. |
| zephyr/Kconfig | Added SOF_USERSPACE, SOF_ZEPHYR_HEAP_SIZE, and SOF_ZEPHYR_VIRTUAL_HEAP_SIZE. |
| src/trace/dma-trace.c | Changed dma_sg_alloc calls to use SOF_MEM_FLAG_USER. |
| src/probe/probe.c | Similar update for dma_sg_alloc to use flags instead of zones. |
| src/platform/*/memory.h | Replaced #define HEAPMEM_SIZE with CONFIG_SOF_ZEPHYR_HEAP_SIZE. |
| src/include/sof/lib/dai-legacy.h | Updated comments to reference SOF_MEM_FLAG_COHERENT. |
| src/include/sof/audio/component.h | Removed outdated zone-based allocation guidance. |
| src/audio/google/google_rtc_audio_processing_mock.c | Changed SetFormats to return int, added error handling and updated call site. |
| src/audio/buffers/comp_buffer.c | Refined buf_err messages to clarify flags usage. |
| posix/include/rtos/alloc.h | Mirrored allocator documentation updates for POSIX build. |
Comments suppressed due to low confidence (4)
zephyr/lib/alloc.c:388
- [nitpick] The term 'addresses' may be misleading here; consider using 'memory' to clarify that only cached memory is allowed.
tr_err(&zephyr_tr, "L3_HEAP available for cached addresses only!");
src/audio/buffers/comp_buffer.c:333
- [nitpick] The phrase 'bytes of flags' is awkward; consider changing to 'bytes with flags' for readability.
buf_err(buffer, "resize can't alloc %u bytes of flags 0x%x",
src/audio/buffers/comp_buffer.c:391
- [nitpick] Similar to the earlier log, 'bytes of flags' is confusing; use 'with flags' instead.
buf_err(buffer, "resize can't alloc %zu bytes of flags 0x%x", new_size,
src/include/sof/audio/component.h:323
- [nitpick] The original guidance on using the runtime heap was removed; consider updating this comment to specify the new flag-based allocator (e.g., use
rmallocwith appropriateSOF_MEM_FLAG_*).
*
zephyr/Kconfig
Outdated
| help | ||
| SOF userspace modules support will enable modules to run in DP | ||
| processing mode as userspace code and data. This feature is WIP | ||
| and is not yest ready for production, for developers only. |
Copilot
AI
Jul 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct the typo 'yest' to 'yet' in the help text.
| and is not yest ready for production, for developers only. | |
| and is not yet ready for production, for developers only. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
| * @param zone Zone to allocate memory from, see enum mem_zone. | ||
| * @param flags Flags, see SOF_MEM_FLAG_... | ||
| * @param caps Capabilities, see SOF_MEM_CAPS_... | ||
| * @param flags Flags, see SOF_MEM_FLAG_.... |
Copilot
AI
Jul 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ellipsis '....' should use three dots '...' for consistency with other parameter docs.
Allow the developer to set the maximum virtual heap size so that power savings can be made when full memory is not required for device use cases. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add a Kconfig to be used for SOF userspace support. This will be a staging feature at the moment until its stable upstream. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Fix the log messages to show flags instead of type. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Currently the caller checks for allocation failure in the callee. Make the correct function check for allocation failure. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Zone was mentioned in many comments and one log message. Fix this to remove zone references. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Trace and probes were using ZONE macro instead of flags. Fix. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
f6b5e0c to
67b8ba2
Compare
|
@softwarecki fyi - this one has your review comments from memory API update PR in the list of patches. |
Add Kconfig for heap sizes instead of hard coding and remove all mentions of zone.