Skip to content

[BUG] [TGL] XRUN on speaker/headset path with the IGO integrated firmware while starting the PCM99 capture #4418

Closed

Description

@RDharageswari

Describe the bug
With the IGO integrated firmware and topology, XRUN is observed in the playback pipeline, be it headset/the speaker path with DSM module.

To Reproduce
Start playback on one terminal(speaker with DSM or the headset pipeline)
localhost ~ # aplay -Dhw:0,0 Titanium_low1.wav -c2 -r48000 -fs24_le
start capture on other terminal:
localhost ~ # arecord -Dhw:0,99 try.wav -c4 -r48000 -fs32_le -d60 &
The moment the capture stream is opened
Playback returns I/O error:
aplay: pcm_write:2059: write error: Input/output error

Reproduction Rate
Always.
Very easy to repro.

Expected behavior
playback is on core 0 and IGO module runs on core 1.
The moment capture stream is started the playback on core 0 stalls.
Is it that core 0 is blocked here?

Impact
blocker for IGO integration

Environment
Tgl_13release + private patches in google repo+ Intelligo module(
have shared all the binaries through email as they are closed source.
Please let me know if you need more details.

Screenshots or console output
localhost ~ # ./sof-logger -l sof-tgl.ldc
TIMESTAMP (us) DELTA C# COMPONENT LOCATION CONTENT ktime=75.835s @ 2021-06-21 18:39:54 -0700 PDT
[ 105098936.344577] ( 0.000000) c0 dma-trace src/trace/dma-trace.c:335 ERROR FW ABI 0x3012001 DBG ABI 0x5003000 tag v1.8-rc2-45-gd143acb3ece8 src hash 0x38d78a96 (ldc hash 0x38d78a96)
[ 20826327.349519] ( 20826328.000000) c0 dw-dma src/drivers/dw/dma.c:1100 ERROR dw_dma_get_data_size(): xrun detected
[ 20826344.641185] ( 17.291666) c0 dai 1.5 src/audio/dai.c:1069 ERROR dai_report_xrun(): underrun due to no data available
[ 20826361.984935] ( 17.343750) c0 dai 1.5 src/audio/dai.c:686 ERROR comp_underrun(): dev->comp.id = 5, source->avail = 384, copy_bytes = 0
[ 20826481.412013] ( 119.427078) c0 pipe 1.6 ....../pipeline-stream.c:168 ERROR pipeline_copy(): ret = -61, start->comp.id = 5, dir = 1
[ 20826500.422429] ( 19.010416) c0 pipe 1.6 ..../pipeline-schedule.c:63 ERROR pipeline_task(): xrun recover failed! pipeline will be stopped!

Activity

  1. added
    bugSomething isn't working as expected
    P1Blocker bugs or important features
    blockedprogress blocked by something else, applies to either feature or bug
    TGLApplies to Tiger Lake
    multicoreIssues observed when not only core#0 is used.
    on Jun 28, 2021
  2. slawblauciak commented on Jun 29, 2021

    @slawblauciak
    Collaborator

    Here are my observations:

    I was successfully able to reproduce the issue. At the point of problem occurring (I/O error in aplay) I could see an xrun in the FW trace logs, followed by a constant flow of warnings from the system agent, which shows a consistent problem in the DSP core taking too long to process.

    [ 11611479.642768] ( 31989.634766) c0 sa src/lib/agent.c:79 WARN validate(), ll drift detected, delta = 370857

    I can get the same warnings to appear without aplay, just arecord running.

    @RDharageswari
    Reading the logs, it appears the period for this pipeline is 16 ms. Is that correct?


    Performance counters show that the IGO component takes upwards of 3.8M cycles to complete a copy. Now, if one would assume that each instruction takes exactly one cycle, that'd make it 9.5 ms, which is well below 16 ms. The problem is that very assumption however, since various instructions take different amounts of cycles to complete and it all depends on the state of the DSP pipeline.
    If we were to assume 1.5 cycles per instruction, that's already over 14 ms.

    This finding in conjunction with the agent constantly complaining every other period reinforces my suspicion that the IGO simply takes too long to complete, as a result making the DSP core unable to respond to various events properly, such as IDC communication, which in turn causes other cores trying to communicate with it to stall, in the end, manifesting itself as this xrun.

    I will continue debugging this, to ensure that the initial measurements are correct, this time using alternative method.

  3. fuyuntsuo commented on Jun 30, 2021

    @fuyuntsuo
    Contributor

    Thanks @slawblauciak . Your observation is correct that IGO component takes about 9.5 ms to complete. That's why we moved it to Core 1 (c32a0e0) so that other components and IDC shouldn't be affected by IGO's long computing time. We just don't understand why IDC (on Core 0) still complains and why smart-amp (on Core 0) turns out to be xrun even in this case.

    Here is a information might help. Before moving IGO to Core 1, we used to extend smart-amp period to 16ms (7769778), prolonging buffer so that no xrun occurs. Now since IGO is running on Core 1, there should be no need to apply such patch.

    To my surprise, this patch is still working after IGO moved to Core 1.

    I am working on integrating IGO component on SOF. Please ping me if needed. Thanks.

  4. fuyuntsuo commented on Jun 30, 2021

    @fuyuntsuo
    Contributor

    Another question: does the performance counter count cycle or instruction? If cycle then 3.5M cycles should be okay. If instruction, then cycle-per-instruction does matter as you pointed out.

  5. keyonjie commented on Jun 30, 2021

    @keyonjie
    Contributor

    @fuyuntsuo it's big information that the IGO component takes about 9.5 ms to complete each iteration, this will for sure blocks other tasks (e.g. 1ms SA task) regular runs.

  6. ranj063 commented on Jun 30, 2021

    @ranj063
    Collaborator

    @fuyuntsuo it's big information that the IGO component takes about 9.5 ms to complete each iteration, this will for sure blocks other tasks (e.g. 1ms SA task) regular runs.

    @keyonjie SA is disabled in the chrome prpducts.

  7. keyonjie commented on Jun 30, 2021

    @keyonjie
    Contributor

    @fuyuntsuo it's big information that the IGO component takes about 9.5 ms to complete each iteration, this will for sure blocks other tasks (e.g. 1ms SA task) regular runs.

    @keyonjie SA is disabled in the chrome prpducts.

    Okay, I see that from @slawblauciak 's comment:

    [ 11611479.642768] ( 31989.634766) c0 sa src/lib/agent.c:79 WARN validate(), ll drift detected, delta = 370857
    

    Anyway, we still have bunch of pipelines scheduled in 1ms period.

    @fuyuntsuo how could it happen to takes 9.5ms for each IGO .copy()? it's ~40 times of DSM or GHD!

  8. fuyuntsuo commented on Jun 30, 2021

    @fuyuntsuo
    Contributor

    Hi @keyonjie, let's make this assumption here if the answer is not blocking this issue. We could discuss why IGO takes much cycles via email since Intel has signed NDA with us. Can anyone from Intel bridge us?

  9. fuyuntsuo commented on Jun 30, 2021

    @fuyuntsuo
    Contributor

    May I know what does SA stand for? And why it is affected given IGO is running on Core 1.

  10. ranj063 commented on Jun 30, 2021

    @ranj063
    Collaborator

    May I know what does SA stand for? And why it is affected given IGO is running on Core 1.

    @fuyuntsuo SA is the system agent. It is not enabled in the chrome product FW. So its not a concern

  11. 53 remaining items

  12. keyonjie commented on Aug 16, 2021

    @keyonjie
    Contributor

    @fuyuntsuo @lgirdwood the draft PR with the W/A here: #4640

  13. fuyuntsuo commented on Aug 16, 2021

    @fuyuntsuo
    Contributor

    Hi @keyonjie @lgirdwood , I've tested it at my end and the XRUN doesn't occur anymore. Thank you both.

    Apologize for being pushy on this issue, whose root cause is totally beyond my expectation. Hopefully we could close all the other issues with help of this W/A.

  14. keyonjie commented on Aug 17, 2021

    @keyonjie
    Contributor

    @fuyuntsuo good that it fix the issue at your end.

    Yep, the root cause of the issue looks so interesting, we will not stop here, we need to go forward and pursue an explicit explanation of it.

  15. lgirdwood commented on Aug 17, 2021

    @lgirdwood
    Member

    @fuyuntsuo @keyonjie thanks, good effort from everyone, sometimes the reasons are not obvious at the beginning but I'm glad we have resolved it.

  16. keyonjie commented on Aug 17, 2021

    @keyonjie
    Contributor

    Hi @fuyuntsuo the PR is simplified and now looks much easier for us, can you help to verify if the new version work for you?

  17. fuyuntsuo commented on Aug 17, 2021

    @fuyuntsuo
    Contributor

    @keyonjie this version works too. I also raise a question there.

  18. lgirdwood commented on Aug 17, 2021

    @lgirdwood
    Member

    @RDharageswari can you arrange the full validation so we can close. Thanks !

  19. keyonjie commented on Aug 20, 2021

    @keyonjie
    Contributor

    @fuyuntsuo @lancedkhou I have just updated the PR #4640 , could you please help to check if it work at your end?

  20. lancedkhou commented on Aug 20, 2021

    @lancedkhou

    Hi @keyonjie,

    Though I can reproduce the panic, however, both headset and internal MIC are still working.
    The voice is still coming from both headset and internal MIC and I can hear the remote sound loud and clear.

  21. lancedkhou commented on Aug 20, 2021

    @lancedkhou
  22. mengdonglin commented on Jan 25, 2022

    @mengdonglin
    Collaborator

    Set it to P3 as with PR #4640, no impact on user experience.

  23. added
    P3Low-impact bugs or features
    and removed
    P1Blocker bugs or important features
    on Jan 25, 2022
  24. mengdonglin commented on Jan 25, 2022

    @mengdonglin
    Collaborator

    @lancedkhou Close this issue. Please create a new issue to track remaining problem if need.

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

Metadata

Metadata

Labels

Fix confirmedFix for the issue has been found and verifiedP3Low-impact bugs or featuresTGLApplies to Tiger Lakeblockedprogress blocked by something else, applies to either feature or bugbugSomething isn't working as expectedmulticoreIssues observed when not only core#0 is used.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions