-
Notifications
You must be signed in to change notification settings - Fork 350
DP: userspace: dynamic domains #10491
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
lyakh
wants to merge
2
commits into
thesofproject:main
Choose a base branch
from
lyakh:dyndom
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.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
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 |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ | |
| #include <sof/common.h> | ||
| #include <sof/list.h> | ||
| #include <sof/llext_manager.h> | ||
| #include <sof/objpool.h> | ||
| #include <sof/schedule/dp_schedule.h> | ||
| #include <sof/schedule/ll_schedule_domain.h> | ||
|
|
||
|
|
@@ -27,7 +28,7 @@ | |
| LOG_MODULE_DECLARE(dp_schedule, CONFIG_SOF_LOG_LEVEL); | ||
| extern struct tr_ctx dp_tr; | ||
|
|
||
| static struct k_mem_domain dp_mdom[CONFIG_CORE_COUNT]; | ||
| static struct objpool_head dp_mdom_head = {.list = LIST_INIT(dp_mdom_head.list)}; | ||
|
|
||
| /* Synchronization semaphore for the scheduler thread to wait for DP startup */ | ||
| #define DP_SYNC_INIT(i, _) Z_SEM_INITIALIZER(dp_sync[i], 0, 1) | ||
|
|
@@ -384,14 +385,17 @@ void dp_thread_fn(void *p1, void *p2, void *p3) | |
| */ | ||
| void scheduler_dp_domain_free(struct processing_module *pmod) | ||
| { | ||
| unsigned int core = pmod->dev->task->core; | ||
| struct k_mem_domain *mdom = pmod->mdom; | ||
|
|
||
| llext_manager_rm_domain(pmod->dev->ipc_config.id, dp_mdom + core); | ||
| llext_manager_rm_domain(pmod->dev->ipc_config.id, mdom); | ||
|
|
||
| struct task_dp_pdata *pdata = pmod->dev->task->priv_data; | ||
|
|
||
| k_mem_domain_remove_partition(dp_mdom + core, pdata->mpart + SOF_DP_PART_HEAP); | ||
| k_mem_domain_remove_partition(dp_mdom + core, pdata->mpart + SOF_DP_PART_CFG); | ||
| k_mem_domain_remove_partition(mdom, pdata->mpart + SOF_DP_PART_HEAP); | ||
| k_mem_domain_remove_partition(mdom, pdata->mpart + SOF_DP_PART_CFG); | ||
lyakh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| pmod->mdom = NULL; | ||
| objpool_free(&dp_mdom_head, mdom); | ||
| } | ||
|
|
||
| /* Called only in IPC context */ | ||
|
|
@@ -497,6 +501,19 @@ int scheduler_dp_task_init(struct task **task, const struct sof_uuid_entry *uid, | |
| unsigned int pidx; | ||
| size_t size; | ||
| uintptr_t start; | ||
| struct k_mem_domain *mdom = objpool_alloc(&dp_mdom_head, sizeof(*mdom), | ||
|
Member
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. this is worth some comment explaining why its coherent when DP runs on a single core. i.e. to avoid any misunderstandings. |
||
| SOF_MEM_FLAG_COHERENT); | ||
|
|
||
| if (!mdom) | ||
| goto e_thread; | ||
|
|
||
| mod->mdom = mdom; | ||
|
|
||
| if (!mdom->arch.ptables) { | ||
| ret = k_mem_domain_init(mdom, 0, NULL); | ||
| if (ret < 0) | ||
| goto e_dom; | ||
| } | ||
|
|
||
| /* Module heap partition */ | ||
| mod_heap_info(mod, &size, &start); | ||
|
|
@@ -513,12 +530,12 @@ int scheduler_dp_task_init(struct task **task, const struct sof_uuid_entry *uid, | |
| }; | ||
|
|
||
| for (pidx = 0; pidx < SOF_DP_PART_TYPE_COUNT; pidx++) { | ||
| ret = k_mem_domain_add_partition(dp_mdom + core, pdata->mpart + pidx); | ||
| ret = k_mem_domain_add_partition(mdom, pdata->mpart + pidx); | ||
| if (ret < 0) | ||
| goto e_dom; | ||
| } | ||
|
|
||
| ret = llext_manager_add_domain(mod->dev->ipc_config.id, dp_mdom + core); | ||
| ret = llext_manager_add_domain(mod->dev->ipc_config.id, mdom); | ||
| if (ret < 0) { | ||
| tr_err(&dp_tr, "failed to add LLEXT to domain %d", ret); | ||
| goto e_dom; | ||
|
|
@@ -528,7 +545,7 @@ int scheduler_dp_task_init(struct task **task, const struct sof_uuid_entry *uid, | |
| * Keep this call last, able to fail, otherwise domain will be removed | ||
| * before its thread | ||
| */ | ||
| ret = k_mem_domain_add_thread(dp_mdom + core, pdata->thread_id); | ||
| ret = k_mem_domain_add_thread(mdom, pdata->thread_id); | ||
| if (ret < 0) { | ||
| tr_err(&dp_tr, "failed to add thread to domain %d", ret); | ||
| goto e_dom; | ||
|
|
@@ -554,8 +571,3 @@ int scheduler_dp_task_init(struct task **task, const struct sof_uuid_entry *uid, | |
| mod_free(mod, task_memory); | ||
| return ret; | ||
| } | ||
|
|
||
| int scheduler_dp_domain_init(void) | ||
| { | ||
| return k_mem_domain_init(dp_mdom + cpu_get_id(), 0, NULL); | ||
| } | ||
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
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.
The TODO comment states that flags consistency checks should be added, but the check already exists at line 63 in objpool.c. However, this TODO is still partially valid because the implementation is incomplete - the flags are checked but never stored. Consider updating this TODO to reflect the current state, or removing it once the flags storage issue is fixed.