Skip to content
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

[FEATURE] Support for scheduling long period tasks #5966

Open
ranj063 opened this issue Jun 29, 2022 · 11 comments
Open

[FEATURE] Support for scheduling long period tasks #5966

ranj063 opened this issue Jun 29, 2022 · 11 comments
Labels
Milestone

Comments

@ranj063
Copy link
Collaborator

ranj063 commented Jun 29, 2022

Is your feature request related to a problem? Please describe.
How do we support a pipeline with deep-buffering requirement connected to the mixer-dai pipeline that runs every 1ms.

This is required to support the multi-stream feature that needs pipeline with variable period sizes connected via mixer to the DAI.

@ranj063 ranj063 added the enhancement New feature or request label Jun 29, 2022
@ranj063
Copy link
Collaborator Author

ranj063 commented Jun 29, 2022

@lyakh @kv2019i @lgirdwood @plbossart FYI

@lgirdwood
Copy link
Member

@lenghonglin fyi

plbossart added a commit to plbossart/sound that referenced this issue Jul 1, 2022
When PCH-attached DMICs are used on a SoundWire-based platform, all
known devices pin-mux SoundWire link2 and link3 with DMIC, and only
use link0 and link1 for SoundWire.

The HP Omen16 is the first exception to the rule, with SoundWire using
link0 and link3. Rather than using a fixed mask, let's count the
number of SoundWire links used.

BugLink: thesofproject/sof#5966
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
@lenghonglin
Copy link
Contributor

@lenghonglin fyi

At first, From a design perspective, i think the task->startcalculation method should stay the same.

At Second, For my application scenario, I assumed audio formats of 16K,16bit,1ch, period_byte of 1KB, and almost 30ms. So this means I can execute pipe-task in less than 30ms. If long Period Tasks are not supported, this will slow down the CPU to do unnecessary work. In addition, I would like to be able to set period_bytes through the topology so that the sampling period can be configured more flexibly.

At third, my xtensa core not only run sof framework , there are other task need to run , though it not important than sof , but if not support long period tasks, it mean the other task hardly to be schedue.

@lgirdwood
Copy link
Member

So the Low Latency (LL) scheduler is designed for simple 1ms periodic synchronous work with tghe following rules

  1. tasks cannot be preempted.
  2. all tasks must execute in less than the 1ms time slice.

Providing 1 & 2 hold then we can execute less frequent tasks at any period.

This does not scale when the workload takes > 1 ms to execute and hence means we need to use a different scheduler algorithm for longer and higher latency work (aka the "EDF" preemptive scheduler on SOF xtos).

The xtos "EDF" preemptive on xtos could only support 1 priority and scheduling > 1 EDF task was non deterministic (i.e. we wold not guarantee execution order or scheduling start time). This all changes with Zephyr as all the old EDF preemptive tasks would be Zephyr preemptable threads (running with different priorities), there will also be more advanced scheduling available later too, but using the Zephyr thread preemption is the first step.

@lgirdwood lgirdwood added this to the v2.3 milestone Jul 4, 2022
@lenghonglin
Copy link
Contributor

So the Low Latency (LL) scheduler is designed for simple 1ms periodic synchronous work with tghe following rules

  1. tasks cannot be preempted.
  2. all tasks must execute in less than the 1ms time slice.

Providing 1 & 2 hold then we can execute less frequent tasks at any period.

This does not scale when the workload takes > 1 ms to execute and hence means we need to use a different scheduler algorithm for longer and higher latency work (aka the "EDF" preemptive scheduler on SOF xtos).

The xtos "EDF" preemptive on xtos could only support 1 priority and scheduling > 1 EDF task was non deterministic (i.e. we wold not guarantee execution order or scheduling start time). This all changes with Zephyr as all the old EDF preemptive tasks would be Zephyr preemptable threads (running with different priorities), there will also be more advanced scheduling available later too, but using the Zephyr thread preemption is the first step.

The other things is that Can we consider config period_byte by topology?

@plbossart
Copy link
Member

The other things is that Can we consider config period_byte by topology?

No. Period_bytes is related to the latency and expected buffering. It's not an indicator of the duration of the processing.

@ranj063
Copy link
Collaborator Author

ranj063 commented Jul 5, 2022

@lgirdwood are you saying that the EDF tasks in xtos are not preemptible and thats the reason we cannot implement this feature with xtos?

plbossart added a commit to plbossart/sound that referenced this issue Jul 6, 2022
When PCH-attached DMICs are used on a SoundWire-based platform, all
known devices pin-mux SoundWire link2 and link3 with DMIC, and only
use link0 and link1 for SoundWire.

The HP Omen16 is the first exception to the rule, with SoundWire using
link0 and link3. Rather than using a fixed mask, let's count the
number of SoundWire links used.

BugLink: thesofproject/sof#5966
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
@lgirdwood
Copy link
Member

@lgirdwood are you saying that the EDF tasks in xtos are not preemptible and thats the reason we cannot implement this feature with xtos?

Sorry, I'm saying the EDF tasks in xtos are preemptable by LL tasks (as they are IRQ context) but not by other EDF tasks. i.e. all EDF tasks on xtos have the same priority. However on Zephyr we can have preemptable tasks with different priorities (where the scheduler will pick the highest priority task)

plbossart added a commit to plbossart/sound that referenced this issue Jul 11, 2022
When PCH-attached DMICs are used on a SoundWire-based platform, all
known devices pin-mux SoundWire link2 and link3 with DMIC, and only
use link0 and link1 for SoundWire.

The HP Omen16 is the first exception to the rule, with SoundWire using
link0 and link3. Rather than using a fixed mask, let's count the
number of SoundWire links used.

BugLink: thesofproject/sof#5966
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
plbossart added a commit to plbossart/sound that referenced this issue Jul 11, 2022
When PCH-attached DMICs are used on a SoundWire-based platform, all
known devices pin-mux SoundWire link2 and link3 with DMIC, and only
use link0 and link1 for SoundWire.

The HP Omen16 is the first exception to the rule, with SoundWire using
link0 and link3. Rather than using a fixed mask, let's count the
number of SoundWire links used.

BugLink: thesofproject/sof#5966
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
plbossart added a commit to thesofproject/linux that referenced this issue Jul 12, 2022
When PCH-attached DMICs are used on a SoundWire-based platform, all
known devices pin-mux SoundWire link2 and link3 with DMIC, and only
use link0 and link1 for SoundWire.

The HP Omen16 is the first exception to the rule, with SoundWire using
link0 and link3. Rather than using a fixed mask, let's count the
number of SoundWire links used.

BugLink: thesofproject/sof#5966
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
plbossart added a commit to thesofproject/linux that referenced this issue Jul 15, 2022
When PCH-attached DMICs are used on a SoundWire-based platform, all
known devices pin-mux SoundWire link2 and link3 with DMIC, and only
use link0 and link1 for SoundWire.

The HP Omen16 is the first exception to the rule, with SoundWire using
link0 and link3. Rather than using a fixed mask, let's count the
number of SoundWire links used.

BugLink: thesofproject/sof#5966
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
ammarfaizi2 pushed a commit to ammarfaizi2/linux-block that referenced this issue Jul 15, 2022
When PCH-attached DMICs are used on a SoundWire-based platform, all
known devices pin-mux SoundWire link2 and link3 with DMIC, and only
use link0 and link1 for SoundWire.

The HP Omen16 is the first exception to the rule, with SoundWire using
link0 and link3. Rather than using a fixed mask, let's count the
number of SoundWire links used.

BugLink: thesofproject/sof#5966
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20220715144144.274770-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
@kv2019i kv2019i modified the milestones: v2.3, v2.6 Feb 15, 2023
@kv2019i
Copy link
Collaborator

kv2019i commented Feb 15, 2023

One PR addressing this was just submitted #7089

@kv2019i kv2019i modified the milestones: v2.6, v2.5 Feb 15, 2023
@kv2019i
Copy link
Collaborator

kv2019i commented Mar 6, 2023

V2.5 branching this week and feature not ready, moving to v2.6.

@kv2019i kv2019i modified the milestones: v2.5, v2.6 Mar 6, 2023
@lgirdwood
Copy link
Member

Moved to v2.7 as DP multicore wont be upstream in time for v2.6

@lgirdwood lgirdwood removed this from the v2.6 milestone May 10, 2023
@lgirdwood lgirdwood added this to the v2.7 milestone May 10, 2023
@alex-cri alex-cri modified the milestones: v2.7, TBD Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants