Skip to content
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

Merged
merged 2 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/audio/module_adapter/module_adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
Copy link
Member

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.

mod->sources[i] = NULL;
for (int i = 0; i < mod->num_of_sinks; i++)
for (i = 0; i < mod->num_of_sinks; i++)
mod->sinks[i] = NULL;
mod->num_of_sinks = 0;
mod->num_of_sources = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/platform/mt8186/include/platform/lib/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

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.

Copy link
Contributor

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?

Copy link
Contributor Author

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.

#define HEAP_RT_COUNT1024 4
#define HEAP_RT_COUNT2048 2
#define HEAP_RT_COUNT4096 2
Expand Down
2 changes: 1 addition & 1 deletion src/platform/mt8188/include/platform/lib/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
#define HEAP_RT_COUNT1024 4
#define HEAP_RT_COUNT2048 2
#define HEAP_RT_COUNT4096 2
Expand Down
2 changes: 1 addition & 1 deletion src/platform/mt8195/include/platform/lib/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,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
#define HEAP_RT_COUNT1024 4
#define HEAP_RT_COUNT2048 2
#define HEAP_RT_COUNT4096 2
Expand Down