ipc4: pipeline: split trigger and copy processing - #11094
Open
serhiy-katsyuba-intel wants to merge 4 commits into
Open
ipc4: pipeline: split trigger and copy processing#11094serhiy-katsyuba-intel wants to merge 4 commits into
serhiy-katsyuba-intel wants to merge 4 commits into
Conversation
Change LL task priorities and scheduler initialization interfaces from uint16_t to int16_t. Lower numeric values continue to represent higher priorities, so existing task ordering remains unchanged. Pipelines can use priority 0. The signed range allows the IPC4 trigger tasks introduced by the following commit to use priority -1 and run before all pipeline copy tasks. Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
serhiy-katsyuba-intel
requested review from
LaurentiuM1234,
abonislawski,
dbaluta,
iuliana-prodan,
kv2019i,
lbetlej,
lgirdwood,
lyakh,
marcinszkudlinski,
mmaka1,
pblaszko and
plbossart
as code owners
August 13, 2026 18:04
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates SOF’s IPC4 low-latency pipeline scheduling to split trigger handling and copy processing into separate LL tasks, ensuring host-specified trigger order is preserved independently of pipeline priority, and removes the IPC-side blocking wait that was previously used to maintain ordering.
Changes:
- Introduces a dedicated IPC4 “trigger task” (priority
-1) alongside the existing copy task to preserve IPC trigger order while still allowing copy tasks to run by pipeline priority. - Switches LL task priority to a signed type (
int16_t) across schedulers and related APIs to support negative (higher-than-0) priorities. - Removes the IPC4 handler blocking wait for delayed triggers, relying on the new scheduling model instead.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| zephyr/test/userspace/test_ll_task.c | Extends userspace LL task test to validate negative priority preservation. |
| zephyr/include/rtos/task.h | Changes task priority to int16_t and documents “lower runs first”. |
| posix/include/rtos/task.h | Mirrors the int16_t task priority change for POSIX builds. |
| src/include/sof/schedule/schedule.h | Updates schedule_task_init() signature to accept signed priority. |
| src/include/sof/schedule/ll_schedule.h | Updates LL task init APIs to accept signed priority (and supports IPC4 usage). |
| src/schedule/schedule.c | Propagates signed priority through scheduler task initialization. |
| src/schedule/ll_schedule_xtos.c | Updates LL init signature to signed priority for XtOS LL scheduler. |
| src/schedule/zephyr_ll.c | Updates Zephyr LL init signature and clarifies priority ordering semantics. |
| src/platform/library/schedule/schedule.c | Updates library scheduler init signature to signed priority. |
| src/platform/library/schedule/ll_schedule.c | Updates library LL init signature (but currently still drops passed type/priority). |
| src/platform/library/include/platform/lib/ll_schedule.h | Updates library LL header signature to signed priority. |
| test/cmocka/src/common_mocks.c | Updates weak mock signatures for scheduler init functions to signed priority. |
| src/include/sof/audio/pipeline.h | Adds IPC4 trigger-task pointer to pipeline struct and exposes a task-free helper. |
| src/audio/pipeline/pipeline-schedule.c | Implements IPC4 trigger/copy split, delayed-trigger ownership gating, and task free helper. |
| src/audio/pipeline/pipeline-graph.c | Switches pipeline teardown to the new pipeline_comp_ll_task_free() helper. |
| src/ipc/ipc4/handler-user.c | Removes blocking wait previously used to preserve IPC trigger ordering. |
| uuid-registry.txt | Adds UUID entry for the new IPC4 pipeline trigger task. |
Suppressed comments (2)
src/platform/library/schedule/ll_schedule.c:112
- schedule_task_init_ll() ignores both the provided task type and priority, always initializing as SOF_SCHEDULE_LL_TIMER with priority 0. With the new signed priority support (e.g., -1 for trigger tasks), this makes library/standalone builds behave differently and can break ordering guarantees/tests.
int16_t priority, enum task_state (*run)(void *data),
void *data, uint16_t core, uint32_t flags)
{
return schedule_task_init(task, uid, SOF_SCHEDULE_LL_TIMER, 0, run,
data, core, flags);
src/audio/pipeline/pipeline-schedule.c:572
- pipeline_comp_ll_task_free() frees p->pipe_task but does not clear the pointer. This can leave a dangling task pointer if the pipeline object continues to exist after freeing tasks (the new helper is not limited to pipeline_free()).
if (p->pipe_task) {
#if !CONFIG_LIBRARY || UNIT_TEST
schedule_task_free(p->pipe_task);
#endif
sof_heap_free(p->heap, p->pipe_task);
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
serhiy-katsyuba-intel
force-pushed
the
separate_triggers_v2
branch
from
August 13, 2026 18:22
23a0786 to
229485f
Compare
Split IPC4 LL pipeline processing into two tasks: * A one-shot trigger task that normally returns TASK_COMPLETED, causing the LL scheduler to remove it from its task list. It is not strictly one-shot, as it can be rescheduled to support delayed triggers. * A copy task, with almost no changes to the existing implementation. When a pipeline starts, both tasks are added to the LL scheduler. Trigger tasks are appended with the highest priority, -1, regardless of their pipeline priority. They are therefore added in IPC order and run before any LL copy tasks. Copy tasks are added as before, respecting their pipeline priorities. Once a trigger task has completed, it returns TASK_COMPLETED and is removed from the LL scheduler's task list. The copy task is prevented from copying while its trigger task remains on the LL scheduler's list to support delayed triggering. When stopping a pipeline, only the trigger task needs to be added because the copy task is already scheduled. Once the trigger task changes the pipeline state to paused, both tasks return TASK_COMPLETED and are removed from the scheduler's task list. Separating trigger and copy processing preserves the pipeline trigger order specified by a multi-pipeline-set-state IPC, regardless of pipeline priorities, while allowing copy tasks to run according to pipeline priorities. This makes the blocking wait introduced by commit c5d638a ("ipc4: handler: maintain IPC set_pipeline_state order") unnecessary. Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
This reverts commit 05bffd7. Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
serhiy-katsyuba-intel
force-pushed
the
separate_triggers_v2
branch
from
August 13, 2026 18:40
229485f to
b9b1c68
Compare
Validate the requested core ID before dispatching pipeline creation. This prevents an out-of-bounds access found by IPC4 fuzzing. Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Split IPC4 LL pipeline processing into two tasks:
When a pipeline starts, both tasks are added to the LL scheduler. Trigger tasks are appended with the highest priority, -1, regardless of their pipeline priority. They are therefore added in IPC order and run before any LL copy tasks. Copy tasks are added as before, respecting their pipeline priorities.
Once a trigger task has completed, it returns TASK_COMPLETED and is removed from the LL scheduler's task list. The copy task is prevented from copying while its trigger task remains on the LL scheduler's list to support delayed triggering.
When stopping a pipeline, only the trigger task needs to be added because the copy task is already scheduled. Once the trigger task changes the pipeline state to paused, both tasks return TASK_COMPLETED and are removed from the scheduler's task list.
Separating trigger and copy processing preserves the pipeline trigger order specified by a multi-pipeline-set-state IPC, regardless of pipeline priorities, while allowing copy tasks to run according to pipeline priorities.
This makes the blocking wait introduced by commit c5d638a ("ipc4: handler: maintain IPC set_pipeline_state order") unnecessary.