-
Notifications
You must be signed in to change notification settings - Fork 349
Data processing scheduler - SOF tasks as Zephyr preemptive threads #7089
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
Merged
lgirdwood
merged 5 commits into
thesofproject:main
from
marcinszkudlinski:dp_scheduler_public
Mar 14, 2023
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
6367f09
kconfig: add DP_SCHEDULER kconfig def
marcinszkudlinski b9d1ab7
scheduling: add Data Processing scheduler type
marcinszkudlinski 3ede75e
IPC4: add processing domain - LL or DP to component context
marcinszkudlinski 77c5902
IPC4: add DP domain modules to pipeline scheduling
marcinszkudlinski 3b4f87a
IPC4: Workaround: Lock DP modules to same core as pipeline
marcinszkudlinski 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
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 |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| /* SPDX-License-Identifier: BSD-3-Clause */ | ||
marcinszkudlinski marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| /* | ||
| * Copyright(c) 2023 Intel Corporation. All rights reserved. | ||
| * | ||
| * Author: Marcin Szkudlinski | ||
| */ | ||
|
|
||
| #ifndef __SOF_SCHEDULE_DP_SCHEDULE_H__ | ||
| #define __SOF_SCHEDULE_DP_SCHEDULE_H__ | ||
|
|
||
| #include <rtos/task.h> | ||
| #include <sof/trace/trace.h> | ||
| #include <user/trace.h> | ||
| #include <stdint.h> | ||
|
|
||
| /** | ||
| * | ||
| * DP scheduler is a scheduler that creates a separate preemptible Zephyr thread for each SOF task | ||
| * There's only one instance of DP in the system, however, threads can be assigned and pinned | ||
| * to any core in the system for its execution, there's no SMP processing. | ||
| * | ||
| * The task execution may be delayed and task may be re-scheduled periodically | ||
| * NOTE: delayed start and rescheduling takes place in sync with LL scheduler, meaning the | ||
| * DP scheduler is triggered as the last task of LL running on a primary core. | ||
| * That implies a limitation: LL scheduler MUST be running on primary core in order to have | ||
| * this feature working. | ||
| * It is fine, because rescheduling is a feature used for data processing when a pipeline is | ||
| * running. | ||
| * | ||
| * Other possible usage of DP scheduler is to schedule task with DP_SCHEDULER_RUN_TASK_IMMEDIATELY | ||
| * as start parameter. It will force the task to work without any delays and async to LL. | ||
| * This kind of scheduling may be used for staring regular zephyr tasks using SOF api | ||
| * | ||
| * Task run() may return: | ||
| * SOF_TASK_STATE_RESCHEDULE - the task will be rescheduled as specified in scheduler period | ||
| * note that task won't ever be rescheduled if LL is not running | ||
| * SOF_TASK_STATE_COMPLETED - the task will be removed from scheduling, | ||
| * calling schedule_task will add the task to processing again | ||
| * task_complete() will be called | ||
| * SOF_TASK_STATE_CANCEL - the task will be removed from scheduling, | ||
| * calling schedule_task will add the task to processing again | ||
| * task_complete() won't be called | ||
| * other statuses - assert will go off | ||
| * | ||
| * NOTE: task - means a SOF task | ||
| * thread - means a Zephyr preemptible thread | ||
| * | ||
| * TODO - EDF: | ||
| * Threads run on the same priority, lower than thread running LL tasks. Zephyr EDF mechanism | ||
| * is used for decision which thread/task is to be scheduled next. The DP scheduler calculates | ||
| * the task deadline and set it in Zephyr thread properties, the final scheduling decision is made | ||
| * by Zephyr. | ||
| * | ||
| * Each time tick the scheduler iterates through the list of all active tasks and calculates | ||
| * a deadline based on | ||
| * - knowledge how the modules are bound | ||
| * - declared time required by a task to complete processing | ||
| * - the deadline of the last module | ||
| * | ||
| */ | ||
|
|
||
| /** \brief tell the scheduler to run the task immediately, even if LL tick is not yet running */ | ||
| #define SCHEDULER_DP_RUN_TASK_IMMEDIATELY ((uint64_t)-1) | ||
|
|
||
| /** | ||
| * \brief Init the Data Processing scheduler | ||
| */ | ||
| int scheduler_dp_init(void); | ||
|
|
||
| /** | ||
| * \brief Set the Data Processing scheduler to be accessible at secondary cores | ||
| */ | ||
| int scheduler_dp_init_secondary_core(void); | ||
|
|
||
| /** | ||
| * \brief initialize a DP task and add it to scheduling | ||
| * | ||
| * \param[out] task pointer, pointer to allocated task structure will be return | ||
| * \param[in] uid pointer to UUID of the task | ||
| * \param[in] ops pointer to task functions | ||
| * \param[in] data pointer to the thread private data | ||
| * \param[in] core CPU the thread should run on | ||
| * \param[in] stack_size size of stack for a zephyr task | ||
| * \param[in] task_priority priority of the zephyr task | ||
| */ | ||
| int scheduler_dp_task_init(struct task **task, | ||
| const struct sof_uuid_entry *uid, | ||
| const struct task_ops *ops, | ||
| void *data, | ||
| uint16_t core, | ||
| size_t stack_size, | ||
| uint32_t task_priority); | ||
|
|
||
| #endif /* __SOF_SCHEDULE_DP_SCHEDULE_H__ */ | ||
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
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.
Uh oh!
There was an error while loading. Please reload this page.