-
Notifications
You must be signed in to change notification settings - Fork 321
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
mtk: fix memory allocation problem #8385
Conversation
When I was using xtensa to build mt8188 platform, I encountered an error: 'redefinition of i'. To fix the problem, I removed the declaration in the for loop. Signed-off-by: Trevor Wu <[email protected]>
Because the size of struct comp_buffer has increased, the current heap layout for the basic use case is not enough. Some use cases are experiencing out of memory issues, c0 memory src/lib/alloc.c:765 ERROR failed to alloc 0x180 bytes zone 0x4 caps 0x1 flags 0x0 To fix this issue, we increase the number of 512-byte heap blocks to 32. Signed-off-by: Trevor Wu <[email protected]>
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.
LGTM, but would like to get confirmation from @singalsu about prior fix for int i redefinition.
@@ -1450,9 +1450,9 @@ int module_adapter_reset(struct comp_dev *dev) | |||
#endif /* CONFIG_ZEPHYR_DP_SCHEDULER */ | |||
if (IS_PROCESSING_MODE_SINK_SOURCE(mod)) { | |||
/* for both LL and DP processing */ | |||
for (int i = 0; i < mod->num_of_sources; i++) | |||
for (i = 0; i < mod->num_of_sources; i++) |
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.
@singalsu @iuliana-prodan did we not recently change this in another place ? I think the newer xtensa compilers are possibly stricter here and hence we are hitting this now.
@@ -115,7 +115,7 @@ | |||
#define HEAP_RT_COUNT64 32 | |||
#define HEAP_RT_COUNT128 32 | |||
#define HEAP_RT_COUNT256 32 | |||
#define HEAP_RT_COUNT512 4 | |||
#define HEAP_RT_COUNT512 32 |
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.
Fwiw, Intel has not had to make a change like this since switching RTOS to Zephyr.
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.
https://github.com/thesofproject/sof/blob/main/src/platform/library/include/platform/lib/memory.h#L97
is this intel's definition? still used by ipc4 build?
Btw, 4-->32 too big? do you observe around 15k bytes needed to enlarge?
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.
After confirming that 15k is only a small portion of the heap buffer, I am uncertain whether there may be other use cases that require a larger buffer size. Therefore, I decided to follow the solution in #7982.
@wszypelt There is one Intel test case failing (test_003_01_kd_topology_host_gw), but as this PR doesn't really touch any Intel code, I can't see how this is related. So can I proceed to merge, or can you rerun the test just to be sure? |
@kv2019i I'll try to test PR again, results should be available within 30 minutes |
Similar to the issue described in #7982, MediaTek is also facing out-of-memory problems in our use cases. We have implemented the same solution to address this issue.
Additionally, I fixed the compilation error "redefinition of i" in module adaptor while using xtensa toolchain.