sof icon indicating copy to clipboard operation
sof copied to clipboard

[BUG] Zephyr ignores the topology setting for pipeline scheduling period

Open ranj063 opened this issue 2 years ago • 4 comments

Describe the bug Pipeline tasks are always scheduled every ms irrespective of what the topology requests.

To Reproduce Use https://github.com/thesofproject/sof/pull/5958 for setting the pipeline period in topology

Reproduction Rate 100%

Expected behavior Pipelines must be scheduled based on the period set in topology

Impact We cannot enable multi-stream feature with pipelines with variable period sizes

Environment

  1. Branch name and commit hash of the 2 repositories: sof (firmware/topology) and linux (kernel driver).
    • Kernel: topic/sof-dev
    • SOF: Use SOF PR: https://github.com/thesofproject/sof/pull/5958
  2. Name of the topology file
    • Topology: sof-tgl-nocodec.tplg with PR: https://github.com/thesofproject/sof/pull/5958
  3. Name of the platform(s) on which the bug is observed.
    • Platform: TGL, ADL

ranj063 avatar Jun 29 '22 17:06 ranj063

@lyakh @kv2019i @lgirdwood FYI

ranj063 avatar Jun 29 '22 17:06 ranj063

I don't think this blocks larger period multiple streams -> https://github.com/thesofproject/sof/pull/5958#discussion_r910692671 Still a missing bit in the scheduler.

kv2019i avatar Jun 30 '22 07:06 kv2019i

I think this PR should also be related to this issue:https://github.com/thesofproject/sof/pull/5912

hongshui3000 avatar Jun 30 '22 08:06 hongshui3000

@lyakh can you take care of this ?

lgirdwood avatar Jul 04 '22 14:07 lgirdwood

Is this issue still relevant @lyakh @ranj063 ? Or do we need to wait for IPC4 + DP processing to be available before the deep-buffer is used?

plbossart avatar Dec 13 '22 00:12 plbossart

This issue is only relevant with IPC3+zephyr+topology1. Not sure if this will ever be fixed though

ranj063 avatar Dec 13 '22 00:12 ranj063

This issue is only relevant with IPC3+zephyr+topology1. Not sure if this will ever be fixed though

@ranj063 why is this irrelevant for IPC4? IPC4 doesn't provide a scheduling period?

lyakh avatar Dec 13 '22 07:12 lyakh

@ranj063 why is this irrelevant for IPC4? IPC4 doesn't provide a scheduling period?

@lyakh the scheduling period is relevant of course, its just not set in topology as we do with IPC3+topology1. Im not sure how this should be done for IPC4

ranj063 avatar Dec 13 '22 17:12 ranj063

@mwasko how is LL scheduling period configured via IPC4 ?

lgirdwood avatar Dec 14 '22 14:12 lgirdwood

@mwasko how is LL scheduling period configured via IPC4 ?

In closed source FW (IPC4), scheduler analyze DMA buffer sizes on stream endpoints, and calculates global scheduling period itself, based on lowest active buffer size. When scheduling period > 1ms, scheduler use flexible scheduling to aggregate 1ms processing cycles together and go idle for the rest of scheduling period. When enabling multiple streams, FW use scheduling period required to service stream with lowest buffers. So driver does not have option to directly configure scheduling period, but may do this indirectly, by configuring appropriate DMA buffer sizes. As far as I know Converged FW does not support flexible scheduling. So it will schedule with 1ms period anyway.

There is also an option for local scheduling cycles for DP tasks. Then pipeline is scheduled with global scheduling period, but DP modules are executed only when enough data is available in input buffer. It is configurable by size of DP module IBS/OBS. This option is available only for DP modules. LL modules must have buffers maximum 1ms.

pblaszko avatar Dec 16 '22 10:12 pblaszko

ok, IIUC - for IPC4 the LL period is determine by the DMA buffer size in conjunction with the rate and frame size. I think we need to add an overide value in the topology for this (i.e. if 0 ignore) so that DMA configuration can be more loosely coupled to the scheduling period e.g. in the case where we need larger DMA buffers to deal with HW issues.

lgirdwood avatar Dec 19 '22 14:12 lgirdwood

@lyakh Still on track for V2.5 -- we aim to branch this week?

kv2019i avatar Mar 06 '23 10:03 kv2019i

No response, moving to v2.6.

kv2019i avatar Mar 09 '23 12:03 kv2019i

Should be addressed by DP. Move to v2.7

lgirdwood avatar May 10 '23 21:05 lgirdwood