Skip to content

schedule: ll: handle completed task state in library scheduler - #11128

Merged
kv2019i merged 1 commit into
thesofproject:mainfrom
singalsu:testbench_ll_schedule_fix
Aug 26, 2026
Merged

schedule: ll: handle completed task state in library scheduler#11128
kv2019i merged 1 commit into
thesofproject:mainfrom
singalsu:testbench_ll_schedule_fix

Conversation

@singalsu

Copy link
Copy Markdown
Collaborator

Update the library LL scheduler in schedule_ll_run_tasks() to check the task_run() return state and remove tasks returning SOF_TASK_STATE_COMPLETED from the scheduler list.

Following commit 002e499 ("ipc4: pipeline: split trigger and copy processing"), IPC4 uses a one-shot trigger task that returns SOF_TASK_STATE_COMPLETED upon trigger completion, while the copy task waits for task_is_active(p->trigger_task) to clear before copying. Previously, the library LL scheduler ignored the return value of task_run() and reset the task state back to SOF_TASK_STATE_QUEUED, leaving trigger_task permanently active and causing testbench pipeline copy tasks to stall indefinitely.

Update the library LL scheduler in schedule_ll_run_tasks() to check
the task_run() return state and remove tasks returning
SOF_TASK_STATE_COMPLETED from the scheduler list.

Following commit 002e499 ("ipc4: pipeline: split trigger and
copy processing"), IPC4 uses a one-shot trigger task that returns
SOF_TASK_STATE_COMPLETED upon trigger completion, while the copy task
waits for task_is_active(p->trigger_task) to clear before copying.
Previously, the library LL scheduler ignored the return value of
task_run() and reset the task state back to SOF_TASK_STATE_QUEUED,
leaving trigger_task permanently active and causing testbench pipeline
copy tasks to stall indefinitely.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
@singalsu
singalsu marked this pull request as ready for review August 25, 2026 15:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the testbench/library low-latency (LL) scheduler to respect a task’s task_run() return state, specifically removing tasks that report SOF_TASK_STATE_COMPLETED from the scheduler list. This aligns the library scheduler behavior with IPC4’s one-shot trigger tasks so completed triggers don’t remain “active” and block dependent copy tasks in the testbench.

Changes:

  • Capture task_run() return state in schedule_ll_run_tasks() and delete tasks that return SOF_TASK_STATE_COMPLETED from sched_list.
  • Prevent re-scheduling tasks that are already queued/running in schedule_ll_task().
  • Adjust cancel/free behavior to avoid deleting a task list node unless it is considered scheduled.
Suppressed comments (1)

src/platform/library/schedule/ll_schedule.c:101

  • schedule_ll_task_free() has the same active-state gap as schedule_ll_task_cancel(): tasks freed from states other than QUEUED/RUNNING would stay linked on sched_list. Using task_is_active() ensures all active states are unlinked safely.
	if (task->state == SOF_TASK_STATE_QUEUED ||
	    task->state == SOF_TASK_STATE_RUNNING)
		list_item_del(&task->list);

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +64 to +66
if (task->state == SOF_TASK_STATE_QUEUED ||
task->state == SOF_TASK_STATE_RUNNING)
return 0;
Comment on lines +86 to +88
if (task->state == SOF_TASK_STATE_QUEUED ||
task->state == SOF_TASK_STATE_RUNNING)
list_item_del(&task->list);
@kv2019i
kv2019i merged commit 1a0edd5 into thesofproject:main Aug 26, 2026
45 checks passed
@kv2019i

kv2019i commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Merged quickly as this was blocking testbench testing in CI and causing longrunning CI jobs running for hours...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants