Skip to content

Simultaneous playback and capture will cause IPC timed out #266

Closed

Description

@mengdonglin

This issue happens when running playback and capture at same time. Possibility: 5%~10%.

How to reproduce:

  1. repeat run: aplay -Dhw:0,1 test.wav -d 5 & arecord -Dhw:0,1 -f dat -c 2 test9.wav -d 5

Error log:
chronos@localhost ~ $ aplay -Dhw:0,1 /root/100sine.wav -d 5 & arecord -Dhw:0,1 -f dat -c 2 test9.wav -d 5
[1] 2489
Recording WAVE 'test9.wav' : Signed 16 bit Little Endian, Playing WAVE '/root/100sine.wav' : Rate 48000 Hz, Signed 16 bit Little Endian, StereoRate 48000 Hz,
Stereo
overrun!!! (at least 0.111 ms long)
aplay: pcm_write:2051: write error: Input/output error
[1]+ Exit 1 aplay -Dhw:0,1 /root/100sine.wav -d 5

Activity

  1. added
    bugSomething isn't working
    P2Critical bugs or normal features
    GLKApplies to Gemini Lake
    on Nov 9, 2018
  2. mengdonglin commented on Nov 9, 2018

    @mengdonglin
    Author

    Comments by Jakub:
    "we always are missing FW traces from faulty iteration and there are no more traces afterwards.
    Look at attached fw trace and dmesg logs and count ipc_glb_stream_message trigger start and ipc_glb_stream_message trigger stop pairs – there are two starts and two stops per iteration and in logs attached there were 10 iterations (tenth being faulty) but start and stop trigger pairs count is 9.

    You can find fw build I used attached in zip (it has clearer ipc triger presentation in fw logs so counting is easier). "
    log_trace_fw.txt
    log_trace_dmsg.txt
    sof-apl.zip

  3. dabekjakub commented on Nov 9, 2018

    @dabekjakub
    Member

    Comment to missing traces - @keqiaozhang did not see this issue and provided fw traces.
    In traces provided by him there was no timeout on FW side and every ipc was handled and responded to in time.

    Kernel side log on the other hand states that ipc replay was not sent in time. (inline)

    [ 92.037887] sof-audio sof-audio: pcm: trigger stream 1 dir 1 cmd 1
    [ 92.038044] sof-audio sof-audio: ipc tx succeeded: 0x60010000: GLB_STREAM_MSG: PCM_PARAMS
    [ 92.038115] sof-audio sof-audio: ipc tx: 0x60040000: GLB_STREAM_MSG: TRIG_START
    [ 92.039410] sof-audio sof-audio: ipc tx succeeded: 0x60040000: GLB_STREAM_MSG: TRIG_START
    [ 92.040194] sof-audio sof-audio: pcm: trigger stream 1 dir 0 cmd 1
    [ 92.040217] sof-audio sof-audio: ipc tx: 0x60040000: GLB_STREAM_MSG: TRIG_START - ipc sent on kernel side
    [ 92.344431] sof-audio sof-audio: error: ipc timed out for 0x60040000 size 0xc
    [ 92.344460] sof-audio sof-audio: status: fw entered - code 00000005
    [ 92.344606] sof-audio sof-audio: error: unexpected fault 0x00000000 trace 0x00004000
    [ 92.344611] sof-audio sof-audio: error: waking up any trace sleepers
    [ 92.344643] Headset: ASoC: trigger FE failed -110
    [ 92.344672] sof-audio sof-audio: pcm: trigger stream 1 dir 0 cmd 0
    [ 92.344758] sof-audio sof-audio: error: rx list empty but received 0x0 fw response recived for the ipc that timed out
    [ 92.344763] sof-audio sof-audio: error: can't find message header 0x60040000

  4. keyonjie commented on Nov 15, 2018

    @keyonjie

    I can still see this issue with latest codes.

  5. keyonjie commented on Nov 15, 2018

    @keyonjie

    @dabekjakub from the logs you pasted, looks FW received the trigger start msg, but handle/schedule too late?

  6. libinyang commented on Nov 16, 2018

    @libinyang

    Interesting bug.
    Let me keep an eye on it...
    BTW: Do you guys know how to watch an issue without send any message to others? Sorry for the garbage message.

  7. dabekjakub commented on Nov 16, 2018

    @dabekjakub
    Member

    I investigated the FW logs and every trigger was handled in the same time @keyonjie and there were no indications of timeout on FW side that is why i need someone from kernel to look at it. I am 99.99% sure that we write response correctly and in time.

  8. keyonjie commented on Nov 22, 2018

    @keyonjie

    it looks there is extra delay on some part:
    [ 92.040217] sof-audio sof-audio: ipc tx: 0x60040000: GLB_STREAM_MSG: TRIG_START - ipc sent on kernel side

    [ 92.344758] sof-audio sof-audio: error: rx list empty but received 0x0 fw response recieved for the ipc that timed out

    the response is too late, longer than 300ms.

  9. keyonjie commented on Nov 22, 2018

    @keyonjie

    it is not easy for me to reduplicate it now, with SOF glk-004-drop-stable and linux topic/cros-sof-v4.14-rebase, I tried the step #1 for more than 100 times, but no ipc timeout or xrun happens.

  10. dabekjakub commented on Nov 22, 2018

    @dabekjakub
    Member

    As i said before - i know that there is a timeout in log that points to fw. But when it comes to FW ipc handling i saw no delay in response in fw traces. So FW handled ipc (we handle it as IRQ) as fast as it was possible it was not even close to 300ms. That is why i ask for kernel dev to check it out. Maybe the response is already there but system has some kind of hickup on reading the memory window. So simply trace time between sending and reading response. If You try to read it many times during this 300ms then it means that fw either didn't recive or respond to in time and i can continiue.
    Overal really inprobable since in our python tests we never had a timeout issue on ipc.

  11. keyonjie commented on Nov 23, 2018

    @keyonjie

    we miss an interrupt here on driver side, under investigation about why this happens.

  12. keyonjie commented on Nov 26, 2018

    @keyonjie
    0      1          DAI          44637303.177083      1983.802124                dai.c:114 	dai_buffer_process() error: Insufficient free bytes for next period. comp_overrun()
    0      1          DAI          44637319.322917        16.145834                dai.c:98  	dai_buffer_process() error: Insufficient bytes for next period. comp_underrun()
    0      1          DAI          44639303.125000      1983.802124                dai.c:114 	dai_buffer_process() error: Insufficient free bytes for next period. comp_overrun()
    0      1          DAI          44639319.375000        16.250000                dai.c:98  	dai_buffer_process() error: Insufficient bytes for next period. comp_underrun()
    0      1         PIPE 3.18     44640223.541667       904.166687           pipeline.c:1221	pipeline_xrun_recover()
    0      1          DAI          44640388.125000       164.583328                dai.c:98  	dai_buffer_process() error: Insufficient bytes for next period. comp_underrun()
    0      1         PIPE 2.12     44640442.291667        54.166668           pipeline.c:1221	pipeline_xrun_recover()
    
  13. 4 remaining items

  14. keyonjie commented on Dec 10, 2018

    @keyonjie

    @ranj063 so for this kind of ipc timeout, we need to confirm what stage we actually failed:
    host not sent?
    host sent but fw not recieved?
    host sent, fw recieved, fw handled but not acked?
    host sent, fw recieved, fw handled and acked, but host didn't get the ack?

  15. keyonjie commented on Dec 12, 2018

    @keyonjie

    I found that sometimes scheduler crash before Xrun happens(looks like copy task is not scheduled then xrun happens), there might be scheduler bug.

  16. keyonjie commented on Dec 15, 2018

    @keyonjie

    I have done several optimizations, now it can pass 200 (2playback+1capture+1dma-trace) iterations.

    Still hit several corner cases after long enough try, e.g. 300 or 500 iterations, one classical one as below:

    [ 2418.681877] sof-audio sof-audio: ipc tx: 0x60050000: GLB_STREAM_MSG: TRIG_STOP
    [ 2418.682348] sof-audio sof-audio: ipc: firmware response, msg:0x60050000, msg_ext:0x0
    [ 2418.682450] sof-audio sof-audio: ipc tx succeeded: 0x60050000: GLB_STREAM_MSG: TRIG_STOP
    [ 2418.682510] sof-audio sof-audio: pcm: free stream 1 dir 1
    [ 2418.682540] sof-audio sof-audio: ipc tx: 0x60030000: GLB_STREAM_MSG: PCM_FREE
    [ 2418.682636] sof-audio sof-audio: ipc: firmware initiated, msg:0xdead00a, msg_ext:0x40800
    [ 2418.682644] sof-audio sof-audio: error : DSP panic!
    [ 2418.682658] sof-audio sof-audio: panic: dsp_oops_offset 788480 offset 788480
    [ 2418.682665] sof-audio sof-audio: status: fw entered - code 00000005
    [ 2418.682810] sof-audio sof-audio: error: invalid wait state
    [ 2418.682816] sof-audio sof-audio: error: trace point 00004000
    [ 2418.682823] sof-audio sof-audio: error: panic happen at /home/keyon/hdd/github/keyonjie/soun:1853190003
    [ 2418.682829] sof-audio sof-audio: error: DSP Firmware Oops
    [ 2418.682836] sof-audio sof-audio: error: Exception Cause: Level1InterruptCause, Level-1 interrupt as indicated by set level-1 bits in the INTERRUPT register
    [ 2418.682844] sof-audio sof-audio: EXCCAUSE 0x00000004 EXCVADDR 0x00000000 PS       0x00060122 SAR     0x00000000
    [ 2418.682852] sof-audio sof-audio: EPC1     0xbe012630 EPC2     0xbe012625 EPC3     0xbe01a8c6 EPC4    0x00000000
    [ 2418.682859] sof-audio sof-audio: EPC5     0xbe02a444 EPC6     0x00000000 EPC7     0x00000000 DEPC    0x00000000
    [ 2418.682866] sof-audio sof-audio: EPS2     0x00060720 EPS3     0x00060022 EPS4     0x00000000 EPS5    0x00050023
    [ 2418.682873] sof-audio sof-audio: EPS6     0x00000000 EPS7     0x00000000 INTENABL 0x00010198 INTERRU 0x0000023a
    [ 2418.682879] sof-audio sof-audio: stack dump from 0xbe07ef10
    [ 2418.682887] sof-audio sof-audio: 0xbe07ef10: 0x00000000 0x0000000a 0x6d6f682f 0x656b2f65
    [ 2418.682895] sof-audio sof-audio: 0xbe07ef14: 0x2f6e6f79 0x2f646468 0x68746967 0x6b2f6275
    [ 2418.682902] sof-audio sof-audio: 0xbe07ef18: 0x6e6f7965 0x2f65696a 0x6e756f73 0x706f2d64
    [ 2418.682910] sof-audio sof-audio: 0xbe07ef1c: 0x662d6e65 0x776d7269 0x2f657261 0x2f637273
    [ 2418.682917] sof-audio sof-audio: 0xbe07ef20: 0x68637261 0x6574782f 0x2f61736e 0x6c636e69
    [ 2418.682924] sof-audio sof-audio: 0xbe07ef24: 0x2f656475 0x68637261 0x6961772f 0x00682e74
    [ 2418.682932] sof-audio sof-audio: 0xbe07ef28: 0xbe01209b 0xbe07efa0 0xbe04c250 0x00000001
    [ 2418.682940] sof-audio sof-audio: 0xbe07ef2c: 0x08020006 0x00003200 0x00004180 0x00000080
    [ 2418.682948] sof-audio sof-audio: error: waking up any trace sleepers
    [ 2418.999751] sof-audio sof-audio: error: ipc timed out for 0x60030000 size 0xc
    [ 2418.999770] sof-audio sof-audio: status: fw entered - code 00000005
    [ 2418.999915] sof-audio sof-audio: error: invalid wait state
    [ 2418.999921] sof-audio sof-audio: error: trace point 00004000
    [ 2418.999928] sof-audio sof-audio: error: panic happen at /home/keyon/hdd/github/keyonjie/soun:1853190003
    [ 2418.999935] sof-audio sof-audio: error: DSP Firmware Oops
    [ 2418.999942] sof-audio sof-audio: error: Exception Cause: Level1InterruptCause, Level-1 interrupt as indicated by set level-1 bits in the INTERRUPT register
    [ 2418.999950] sof-audio sof-audio: EXCCAUSE 0x00000004 EXCVADDR 0x00000000 PS       0x00060122 SAR     0x00000000
    [ 2418.999957] sof-audio sof-audio: EPC1     0xbe012630 EPC2     0xbe012625 EPC3     0xbe01a8c6 EPC4    0x00000000
    [ 2418.999964] sof-audio sof-audio: EPC5     0xbe02a444 EPC6     0x00000000 EPC7     0x00000000 DEPC    0x00000000
    [ 2418.999971] sof-audio sof-audio: EPS2     0x00060720 EPS3     0x00060022 EPS4     0x00000000 EPS5    0x00050023
    [ 2418.999978] sof-audio sof-audio: EPS6     0x00000000 EPS7     0x00000000 INTENABL 0x00010198 INTERRU 0x0000023a
    [ 2418.999985] sof-audio sof-audio: stack dump from 0xbe07ef10
    [ 2418.999993] sof-audio sof-audio: 0xbe07ef10: 0x00000000 0x0000000a 0x6d6f682f 0x656b2f65
    [ 2419.000000] sof-audio sof-audio: 0xbe07ef14: 0x2f6e6f79 0x2f646468 0x68746967 0x6b2f6275
    [ 2419.000008] sof-audio sof-audio: 0xbe07ef18: 0x6e6f7965 0x2f65696a 0x6e756f73 0x706f2d64
    [ 2419.000016] sof-audio sof-audio: 0xbe07ef1c: 0x662d6e65 0x776d7269 0x2f657261 0x2f637273
    [ 2419.000023] sof-audio sof-audio: 0xbe07ef20: 0x68637261 0x6574782f 0x2f61736e 0x6c636e69
    [ 2419.000031] sof-audio sof-audio: 0xbe07ef24: 0x2f656475 0x68637261 0x6961772f 0x00682e74
    [ 2419.000038] sof-audio sof-audio: 0xbe07ef28: 0xbe01209b 0xbe07efa0 0xbe04c250 0x00000001
    [ 2419.000046] sof-audio sof-audio: 0xbe07ef2c: 0x08020006 0x00003200 0x00004180 0x00000080
    [ 2419.000052] sof-audio sof-audio: error: waking up any trace sleepers
    [ 2419.000195] sof-audio sof-audio: pcm: close stream 1 dir 1
    [ 2419.640430] sof-audio sof-audio: pcm: open stream 1 dir 1
    [ 2419.640434] sof-audio sof-audio: period min 192 max 16384 bytes
    [ 2419.640436] sof-audio sof-audio: period count 2 max 16
    [ 2419.640438] sof-audio sof-audio: buffer max 65536 bytes
    [ 2419.640602] sof-audio sof-audio: rate_min: 48000 rate_max: 48000
    [ 2419.640605] sof-audio sof-audio: channels_min: 2 channels_max: 2
    [ 2419.640608] sof-audio sof-audio: rate_min: 48000 rate_max: 48000
    [ 2419.640610] sof-audio sof-audio: channels_min: 2 channels_max: 2
    [ 2419.640612] sof-audio sof-audio: rate_min: 48000 rate_max: 48000
    [ 2419.640614] sof-audio sof-audio: channels_min: 2 channels_max: 2
    [ 2419.640617] sof-audio sof-audio: pcm: hw params stream 1 dir 1
    [ 2419.640621] sof-audio sof-audio: generating page table for 0000000060aab561 size 0xff00 pages 16
    [ 2419.640641] sof-audio sof-audio: period_bytes:0xfc0
    [ 2419.640643] sof-audio sof-audio: periods:16
    [ 2419.640675] sof-audio sof-audio: stream_tag 2
    [ 2419.959745] sof-audio sof-audio: error: ipc timed out for 0x60010000 size 0x6c
    [ 2419.959766] sof-audio sof-audio: status: fw entered - code 00000005
    [ 2419.959913] sof-audio sof-audio: error: invalid wait state
    [ 2419.959920] sof-audio sof-audio: error: trace point 00004000
    [ 2419.959928] sof-audio sof-audio: error: panic happen at /home/keyon/hdd/github/keyonjie/soun:1853190003
    [ 2419.959935] sof-audio sof-audio: error: DSP Firmware Oops
    [ 2419.959943] sof-audio sof-audio: error: Exception Cause: Level1InterruptCause, Level-1 interrupt as indicated by set level-1 bits in the INTERRUPT register
    [ 2419.959952] sof-audio sof-audio: EXCCAUSE 0x00000004 EXCVADDR 0x00000000 PS       0x00060122 SAR     0x00000000
    [ 2419.959961] sof-audio sof-audio: EPC1     0xbe012630 EPC2     0xbe012625 EPC3     0xbe01a8c6 EPC4    0x00000000
    [ 2419.959968] sof-audio sof-audio: EPC5     0xbe02a444 EPC6     0x00000000 EPC7     0x00000000 DEPC    0x00000000
    [ 2419.959976] sof-audio sof-audio: EPS2     0x00060720 EPS3     0x00060022 EPS4     0x00000000 EPS5    0x00050023
    [ 2419.959985] sof-audio sof-audio: EPS6     0x00000000 EPS7     0x00000000 INTENABL 0x00010198 INTERRU 0x0000023a
    [ 2419.959992] sof-audio sof-audio: stack dump from 0xbe07ef10
    
  17. keyonjie commented on Dec 18, 2018

    @keyonjie

    as this issue mostly happens in FW side now(e.g. FW hang, FW panic, FW can't get IPC interrupts, ...), let me duplicate this in sof issue.

  18. plbossart commented on Feb 8, 2019

    @plbossart
    Member

    @mengdonglin is this still open or can we close?

  19. plbossart commented on Mar 24, 2019

    @plbossart
    Member

    last call @mengdonglin I will close at the end of the week if there is no update.

  20. keqiaozhang commented on Mar 25, 2019

    @keqiaozhang

    Confirmed that this issue is fixed on GLK.
    @stevyan ,please help to check on APL and close it if you cannot reproduce it.

  21. stevyan commented on Mar 28, 2019

    @stevyan

    Summary
    Issue cannot be reproduced with daily build version after executed more than 800 times based on APL UP2 nocodec.

    Test Env
    sof master: 742f83b
    kernel sof-dev: 0367002
    tplg: sof-apl-nocodec.tplg

  22. added a commit that references this issue on May 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

APLApplies to ApolloLake platformGLKApplies to Gemini LakeP2Critical bugs or normal featuresbugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions