-
Notifications
You must be signed in to change notification settings - Fork 363
Add lock to mod resources tracking #10960
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
Open
jsarha
wants to merge
4
commits into
thesofproject:main
Choose a base branch
from
jsarha:add_lock_to_mod_resources_tracking
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+83
−49
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
8ff1c69
module: generic: turn mod_data_blob_handler_new() into a syscall
bdcd011
module: generic: turn mod_balloc_align() into a syscall
336aa1c
module: generic: add mutex to protect module_resources
1504a2c
module: generic: remove MEM_API_CHECK_THREAD debug mechanism
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,17 +13,14 @@ | |
| #ifndef __SOF_AUDIO_MODULE_GENERIC__ | ||
| #define __SOF_AUDIO_MODULE_GENERIC__ | ||
|
|
||
| #include <rtos/mutex.h> | ||
| #include <sof/objpool.h> | ||
| #include <sof/ut.h> | ||
| #include <sof/audio/component.h> | ||
| #include <sof/audio/sink_api.h> | ||
| #include <sof/audio/source_api.h> | ||
| #include "module_interface.h" | ||
|
|
||
| /* The __ZEPHYR__ condition is to keep cmocka tests working */ | ||
| #if CONFIG_MODULE_MEMORY_API_DEBUG && defined(__ZEPHYR__) | ||
| #include <zephyr/kernel/thread.h> | ||
| #endif | ||
| #include <sof/compiler_attributes.h> | ||
|
|
||
| /* | ||
|
|
@@ -129,13 +126,11 @@ struct module_param { | |
| * when the module unloads. | ||
| */ | ||
| struct module_resources { | ||
| struct k_mutex lock; | ||
| struct objpool_head objpool; | ||
| size_t heap_usage; | ||
| size_t heap_high_water_mark; | ||
| struct mod_alloc_ctx *alloc; | ||
| #if CONFIG_MODULE_MEMORY_API_DEBUG && defined(__ZEPHYR__) | ||
| k_tid_t rsrc_mngr; | ||
| #endif | ||
| }; | ||
|
|
||
| enum mod_resource_type { | ||
|
|
@@ -191,7 +186,12 @@ struct module_processing_data { | |
| /*****************************************************************************/ | ||
| int module_load_config(struct comp_dev *dev, const void *cfg, size_t size); | ||
| int module_init(struct processing_module *mod); | ||
| void *mod_balloc_align(struct processing_module *mod, size_t size, size_t alignment); | ||
| #if defined(__ZEPHYR__) && defined(CONFIG_SOF_FULL_ZEPHYR_APPLICATION) | ||
| __syscall void *mod_balloc_align(struct processing_module *mod, size_t size, size_t alignment); | ||
| #else | ||
| void *z_impl_mod_balloc_align(struct processing_module *mod, size_t size, size_t alignment); | ||
| #define mod_balloc_align z_impl_mod_balloc_align | ||
| #endif | ||
| void mod_resource_init(struct processing_module *mod); | ||
| void mod_heap_info(struct processing_module *mod, size_t *size, uintptr_t *start); | ||
| #if defined(__ZEPHYR__) && defined(CONFIG_SOF_FULL_ZEPHYR_APPLICATION) | ||
|
|
@@ -241,7 +241,12 @@ static inline void *mod_zalloc(struct processing_module *mod, size_t size) | |
| } | ||
|
|
||
| #if CONFIG_COMP_BLOB | ||
| struct comp_data_blob_handler *mod_data_blob_handler_new(struct processing_module *mod); | ||
| #if defined(__ZEPHYR__) && defined(CONFIG_SOF_FULL_ZEPHYR_APPLICATION) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not for this PR, but maybe we can drop globally the first part from these checks - I think we have a few of them across the code base |
||
| __syscall struct comp_data_blob_handler *mod_data_blob_handler_new(struct processing_module *mod); | ||
| #else | ||
| struct comp_data_blob_handler *z_impl_mod_data_blob_handler_new(struct processing_module *mod); | ||
| #define mod_data_blob_handler_new z_impl_mod_data_blob_handler_new | ||
| #endif | ||
| void mod_data_blob_handler_free(struct processing_module *mod, struct comp_data_blob_handler *dbh); | ||
| #endif | ||
| #if CONFIG_FAST_GET | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I'd protect this too