Skip to content

pipeline: always begin scheduling from the source - #5000

Merged
lgirdwood merged 10 commits into
thesofproject:mainfrom
lyakh:sched_order
Nov 25, 2021
Merged

lgirdwood merged 10 commits into
thesofproject:mainfrom
lyakh:sched_order

Conversation

@lyakh

@lyakh lyakh commented Nov 17, 2021

Copy link
Copy Markdown
Collaborator

Pipeline tasks are scheduled in the order in which they're submitted to the scheduler. When audio streams cross several pipelines it makes sense to begin scheduling from the data source. I.e. for playback pipelines from the host pipeline, for capture pipelines from the DAI pipeline. Currently the DAI pipeline gets scheduled first for both playback and captuure, which for playback always results in a

WARN dai_copy(): nothing to copy

warning being printed for the first copy attempt. Also, this results in delayed scheduling: the first cycle will then only copy data from the host, so the first real DAI copying will only happen on the second tick.
On the contrary, when stopping to stream, the sink should be stopped first.
This patch takes the streaming direction and the command into account when scheduling tasks.

Comment thread src/audio/pipeline/pipeline-stream.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lets have a comment why we are doing this check

Comment thread src/audio/pipeline/pipeline-schedule.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

sorry, not following - this looks like we are changing where we insert this pipeline into the list of pipelines and how does this relate to copy direction and also to pipeline priority ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

no, this is not directly for scheduling yet, priorities will be taken into account later. This is a list, from which tasks will be taken one-by-one for submission to the scheduler, which then will order them by priority. So the order in this list only matters as long as they all have the same priority, and they do.

Comment thread src/audio/pipeline/pipeline-schedule.c Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@lyakh i think we should enhance the documentation about scheduling and how copy function works across pipeline components.
I was under the impression that with a normal Host -> Volume -> DAI pipeline the copy() function for Host() always got called first.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@dbaluta yes, you're right, this is not the final version yet (as the "draft" status is also saying ;-) ), please wait, I think I have a better one now, I'll clean it up and push tomorrow.

@lyakh
lyakh force-pushed the sched_order branch 4 times, most recently from bf7e93d to 91ff63d Compare November 19, 2021 07:00
@lyakh
lyakh marked this pull request as ready for review November 19, 2021 12:13
@lyakh

lyakh commented Nov 19, 2021

Copy link
Copy Markdown
Collaborator Author

the latest CI run with multiple-pipeline-pause-resume stress-testing passed, we can start reviewing now

@lyakh

lyakh commented Nov 19, 2021

Copy link
Copy Markdown
Collaborator Author

CI failures:

  1. CML_RVP_SDW reported "NA" for the simultaneous-playback-capture.sh test and timed out two suspend-resume tests
  2. APL_UP2_NOCODEC failed an alsabat test https://sof-ci.01.org/sofpr/PR5000/build11198/devicetest/?model=APL_UP2_NOCODEC&testcase=check-alsabat-headset-playback - should be unrelated
  3. BYT_MB_NOCODEC timed out the IPC flood test

@lgirdwood lgirdwood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you split this PR up, some can be merged now. i.e. we need the BYT fix for rc1.

Comment thread src/audio/pipeline/pipeline-stream.c Outdated
@lyakh

lyakh commented Nov 19, 2021

Copy link
Copy Markdown
Collaborator Author

Can you split this PR up, some can be merged now. i.e. we need the BYT fix for rc1.

@lgirdwood #5014

@lyakh

lyakh commented Nov 19, 2021

Copy link
Copy Markdown
Collaborator Author

removed the cherrytrail fixup commit from this PR again. This will temporarily break CI, until #5014 is merged

@XiaoyunWu6666

Copy link
Copy Markdown
Contributor

hi @lyakh FYI , I just run some multiple-pause-resume testcanses on some nocodec platforms
see inner result 8371
I found xrun failure reported on TGLU_RVP_NOCODEC

Currently when a multi-pipeline stream starts, the first scheduler
run will process the START trigger in the context of the first
pipeline, then the next pipeline task within the same scheduler run
will already attempt to copy data. This cannot work because the
first pipeline hasn't copied its data yet. Make sure to skip the
first scheduler run completely on all pipelines.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
When processing a PAUSE or a STOP trigger in the pipeline task, if
the pipeline aborts processing of the trigger, it has to proceed
executing the copy() flow instead of skipping the tick.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
schedule_task_cancel, schedule_task_free and schedule_task are
compulsory scheduler operations. Verify them once during scheduler
registration and don't check them afterwards when calling.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
@lyakh lyakh changed the title pipeline: always begin scheduling from the source [Do Not Merge] pipeline: always begin scheduling from the source Nov 24, 2021
@lyakh

lyakh commented Nov 24, 2021

Copy link
Copy Markdown
Collaborator Author

This version of the PR has commits from other PRs in it too for testing

@lyakh

lyakh commented Nov 24, 2021

Copy link
Copy Markdown
Collaborator Author

CI unrelated:
https://sof-ci.01.org/sofpr/PR5000/build11239/devicetest/?model=ADLP_RVP_NOCODEC&testcase=verify-kernel-boot-log is a "boot failure," but all tests after that successful
https://sof-ci.01.org/sofpr/PR5000/build11239/devicetest/?model=APL_UP2_NOCODEC&testcase=check-alsabat-headset-playback is an alsabat failure
additionally 3 suspend-resume failures
An internal pause-release stress test #8450 passed too!

@lyakh

lyakh commented Nov 25, 2021

Copy link
Copy Markdown
Collaborator Author

CI:
device-test: "only" a couple of suspend-resume tests failed
QuickBuild: @kkarask @wszypelt what happened to WHL_HDA?

Sometimes multiple tasks have to be scheduled together - one after
another and in a specific order. Add two order-enforcing functions
for that.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Add support for order-enforcing scheduling to the ll-scheduler.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
struct pipeline_task and pipeline_task_get() belong to the pipeline
API, not to the scheduler API. Move them to pipeline.h

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Tasks currently have 9 states defined for them, but they all can be
divided into two groups: active and passive. We define all tasks on a
scheduler queue as active. All other tasks are passive.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Connected pipelines have to be scheduled in a specific order,
depending on the direction of the data flow. Use the new
schedule_task_before() / schedule_task_after() API for that.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Current logic in schedule_ll_domain_set() checks a newly submitted
periodic task if it has to be scheduled before an existing one.
However, when doing this the algorithm might schedule the new task a
whole period earlier than would normally be acceptable. Fix this by
adding the missing period delay.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Sometimes multiple tasks must be scheduled on the same domain tick.
Use the reference task pointer for such cases.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
@lyakh lyakh changed the title [Do Not Merge] pipeline: always begin scheduling from the source pipeline: always begin scheduling from the source Nov 25, 2021
@lgirdwood
lgirdwood merged commit 1f0efba into thesofproject:main Nov 25, 2021
@lyakh
lyakh deleted the sched_order branch November 26, 2021 06:54
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