Skip to content

[BUG] IPC error during pause/start test with multiple mixer sources #3522

Closed

Description

@plbossart

Initially filed as a Linux bug since the result is an IPC error, now transferred to SOF.

I've seen this error multiple times with sof-test, this is not a random error but a mixer issue from the logs.

@lgirdwood @lyakh @singalsu FYI

Log files: multiple-pause-resume.tar.gz

excerpts:
dmesg:

kernel: [  531.157632] sof-audio-acpi 808622A8:00: ipc tx: 0x60040000: GLB_STREAM_MSG: TRIG_START
kernel: [  531.157787] sof-audio-acpi 808622A8:00: ipc tx succeeded: 0x60040000: GLB_STREAM_MSG: TRIG_START
kernel: [  531.317334] sof-audio-acpi 808622A8:00: pcm: trigger stream 0 dir 0 cmd 3
kernel: [  531.317358] sof-audio-acpi 808622A8:00: ipc tx: 0x60060000: GLB_STREAM_MSG: TRIG_PAUSE
kernel: [  531.317486] sof-audio-acpi 808622A8:00: ipc tx succeeded: 0x60060000: GLB_STREAM_MSG: TRIG_PAUSE
kernel: [  531.417219] sof-audio-acpi 808622A8:00: pcm: trigger stream 1 dir 0 cmd 1
kernel: [  531.417276] sof-audio-acpi 808622A8:00: ipc tx: 0x60040000: GLB_STREAM_MSG: TRIG_START
kernel: [  531.417408] sof-audio-acpi 808622A8:00: error: ipc error for 0x60040000 size 12
kernel: [  531.417435] sof-audio-acpi 808622A8:00: ASoC: error at snd_soc_pcm_component_trigger on 808622A8:00: -22
kernel: [  531.417450]  PCM Deep Buffer: ASoC: trigger FE cmd: 1 failed: -22
kernel: [  531.417472] sof-audio-acpi 808622A8:00: pcm: trigger stream 1 dir 0 cmd 0

etrace:

        TIMESTAMP              DELTA C# COMPONENT          LOCATION                      CONTENT
[  8250820.781250] (  8250821.000000) c0 dma-trace             src/trace/dma-trace.c:327  ERROR FW ABI 0x3012000 DBG ABI 0x5002001 tag v1.5-rc1-778-ge5d17f3c10f3 src hash 0xa3b71c81 (ldc hash 0xa3b71c81\
)
[531415530.364583] (523164704.000000) c0 mixer        1.1      src/audio/component.c:190  ERROR comp_set_state(): wrong state = 4, COMP_TRIGGER_START
[531415540.364583] (       10.000000) c0 pipe         4.25      src/audio/pipeline.c:884  ERROR pipeline_trigger(): ret = -22, host->comp.id = 21, cmd = 1
[531415563.750000] (       23.385416) c0 ipc                       src/ipc/handler.c:443  ERROR ipc: comp 21 trigger 0x40000 failed -22
```

Activity

  1. changed the title [-][BUG][CHT] IPC error during multiple pause-push/pause-release test with Deep Buffer PCM[/-] [+][BUG][CHT] IPC error during multiple pause/resume test with Deep Buffer PCM[/+] on Oct 14, 2020
  2. plbossart commented on Oct 14, 2020

    @plbossart
    MemberAuthor

    This seems like a fundamental flaw in the mixer logic. The error is that a TRIGGER_START is send while the component is in COMP_STATE_PAUSED state (value 4)

    #define COMP_STATE_INIT		0	/**< Component being initialised */
    #define COMP_STATE_READY	1	/**< Component inactive, but ready */
    #define COMP_STATE_SUSPEND	2	/**< Component suspended */
    #define COMP_STATE_PREPARE	3	/**< Component prepared */
    #define COMP_STATE_PAUSED	4	/**< Component paused */
    #define COMP_STATE_ACTIVE	5	/**< Component active */
    

    This is however perfectly possible that an existing mixer source is paused, and a new mixer source starts with a TRIGGER_START.

  3. plbossart commented on Oct 14, 2020

    @plbossart
    MemberAuthor

    This bug is 100% reproducible.

    Connect with the target with two terminals.
    Terminal1:

    root@Zotac:~# aplay -Dhw:0,0 -r 48000 -c 2 -f S16_LE -d 100 /dev/zero -v -q -i

    then press space to pause

    Terminal 2:

    root@Zotac:~# aplay -Dhw:0,1 -r 48000 -c 2 -f S16_LE -d 100 /dev/zero -v -q
    

    that should start playback for the second device, however the results are an error

    aplay: set_params:1407: Unable to install hw params:
    ACCESS:  RW_INTERLEAVED
    FORMAT:  S16_LE
    SUBFORMAT:  STD
    SAMPLE_BITS: 16
    FRAME_BITS: 32
    CHANNELS: 2
    RATE: 48000
    PERIOD_TIME: 85000
    PERIOD_SIZE: 4080
    PERIOD_BYTES: 16320
    PERIODS: (4 5)
    BUFFER_TIME: 341000
    BUFFER_SIZE: 16368
    BUFFER_BYTES: 65472
    TICK_TIME: 0
    

    dmesg log

    root@Zotac:~# dmesg
    [   39.105756] rfkill: input handler disabled
    [  124.230440] sof-audio-acpi 808622A8:00: pcm: open stream 0 dir 0
    [  124.230458] sof-audio-acpi 808622A8:00: period min 192 max 16384 bytes
    [  124.230469] sof-audio-acpi 808622A8:00: period count 2 max 16
    [  124.230478] sof-audio-acpi 808622A8:00: buffer max 65536 bytes
    [  124.231325] sof-audio-acpi 808622A8:00: rate_min: 48000 rate_max: 48000
    [  124.231338] sof-audio-acpi 808622A8:00: channels_min: 2 channels_max: 2
    [  124.233484] sof-audio-acpi 808622A8:00: rate_min: 48000 rate_max: 48000
    [  124.233496] sof-audio-acpi 808622A8:00: channels_min: 2 channels_max: 2
    [  124.233521] sof-audio-acpi 808622A8:00: rate_min: 48000 rate_max: 48000
    [  124.233531] sof-audio-acpi 808622A8:00: channels_min: 2 channels_max: 2
    [  124.233551] sof-audio-acpi 808622A8:00: pcm: hw params stream 0 dir 0
    [  124.233569] sof-audio-acpi 808622A8:00: generating page table for 00000000b8738a6d size 0xffc0 pages 16
    [  124.233581] sof-audio-acpi 808622A8:00: stream_tag 0
    [  124.233605] sof-audio-acpi 808622A8:00: ipc tx: 0x60010000: GLB_STREAM_MSG: PCM_PARAMS
    [  124.234119] sof-audio-acpi 808622A8:00: ipc tx succeeded: 0x60010000: GLB_STREAM_MSG: PCM_PARAMS
    [  124.234147] sof-audio-acpi 808622A8:00: pcm: stream dir 0, posn mailbox offset is 1329816
    [  124.259239] sof-audio-acpi 808622A8:00: ipc rx: 0x90020000: GLB_TRACE_MSG
    [  124.259273] sof-audio-acpi 808622A8:00: ipc rx done: 0x90020000: GLB_TRACE_MSG
    [  124.619186] sof-audio-acpi 808622A8:00: pcm: trigger stream 0 dir 0 cmd 1
    [  124.619213] sof-audio-acpi 808622A8:00: ipc tx: 0x60040000: GLB_STREAM_MSG: TRIG_START
    [  124.619365] sof-audio-acpi 808622A8:00: ipc tx succeeded: 0x60040000: GLB_STREAM_MSG: TRIG_START
    [  124.759204] sof-audio-acpi 808622A8:00: ipc rx: 0x90020000: GLB_TRACE_MSG
    [  124.759232] sof-audio-acpi 808622A8:00: ipc rx done: 0x90020000: GLB_TRACE_MSG
    [  125.971863] sof-audio-acpi 808622A8:00: pcm: trigger stream 0 dir 0 cmd 3
    [  125.971886] sof-audio-acpi 808622A8:00: ipc tx: 0x60060000: GLB_STREAM_MSG: TRIG_PAUSE
    [  125.972317] sof-audio-acpi 808622A8:00: ipc tx succeeded: 0x60060000: GLB_STREAM_MSG: TRIG_PAUSE
    [  126.259212] sof-audio-acpi 808622A8:00: ipc rx: 0x90020000: GLB_TRACE_MSG
    [  126.259242] sof-audio-acpi 808622A8:00: ipc rx done: 0x90020000: GLB_TRACE_MSG
    [  182.541278] sof-audio-acpi 808622A8:00: pcm: open stream 1 dir 0
    [  182.541296] sof-audio-acpi 808622A8:00: period min 192 max 16384 bytes
    [  182.541307] sof-audio-acpi 808622A8:00: period count 2 max 16
    [  182.541316] sof-audio-acpi 808622A8:00: buffer max 65536 bytes
    [  182.542064] sof-audio-acpi 808622A8:00: rate_min: 48000 rate_max: 48000
    [  182.542091] sof-audio-acpi 808622A8:00: channels_min: 2 channels_max: 2
    [  182.542113] sof-audio-acpi 808622A8:00: pcm: hw params stream 1 dir 0
    [  182.542130] sof-audio-acpi 808622A8:00: generating page table for 00000000e5f22e05 size 0xffc0 pages 16
    [  182.542159] sof-audio-acpi 808622A8:00: stream_tag 0
    [  182.542187] sof-audio-acpi 808622A8:00: ipc tx: 0x60010000: GLB_STREAM_MSG: PCM_PARAMS
    [  182.542801] sof-audio-acpi 808622A8:00: error: ipc error for 0x60010000 size 20
    [  182.542824] sof-audio-acpi 808622A8:00: error: hw params ipc failed for stream 0
    [  182.542842] sof-audio-acpi 808622A8:00: ASoC: error at snd_soc_pcm_component_hw_params on 808622A8:00: -22
    [  182.542856]  PCM Deep Buffer: ASoC: hw_params FE failed -22
    [  182.542879] sof-audio-acpi 808622A8:00: pcm: free stream 1 dir 0
    [  182.557226] sof-audio-acpi 808622A8:00: pcm: close stream 1 dir 0
    [  182.759213] sof-audio-acpi 808622A8:00: ipc rx: 0x90020000: GLB_TRACE_MSG
    [  182.759243] sof-audio-acpi 808622A8:00: ipc rx done: 0x90020000: GLB_TRACE_MSG
    

    etrace:

    root@Zotac:~# sof-logger -l /etc/sof/sof-cht.ldc 
             TIMESTAMP              DELTA C# COMPONENT          LOCATION                      CONTENT
    [  8362180.625000] (  8362180.500000) c0 dma-trace             src/trace/dma-trace.c:327  ERROR FW ABI 0x3012000 DBG ABI 0x5002001 tag v1.5-rc1-778-ge5d17f3c10f3 src hash 0xa3b71c81 (ldc hash 0xa3b71c81)
    [182540685.208333] (174178512.000000) c0 dai          1.3            src/audio/dai.c:474  ERROR dai_params(): Component is in state 4, expected COMP_STATE_READY.
    [182540695.468750] (       10.260417) c0 pipe         4.25      src/audio/pipeline.c:562  ERROR pipeline_params(): ret = -22, host->comp.id = 21
    [182540705.989583] (       10.520833) c0 ipc                       src/ipc/handler.c:276  ERROR ipc: pipe 4 comp 21 params failed -22
    
  4. plbossart commented on Oct 14, 2020

    @plbossart
    MemberAuthor

    moving to sof issue since it's clearly a mixer state machine bug in the firmware.

  5. plbossart commented on Oct 14, 2020

    @plbossart
    MemberAuthor

    @ranj063 can you help identify which platforms expose PCM devices that get mixed? I only see byt/cht for now. Thanks!

  6. ranj063 commented on Oct 14, 2020

    @ranj063
    Collaborator

    @plbossart apart from the byt/cht codec topologies, the byt/cght nocodec and apl nocodec topologies have mixer based PCMs

  7. plbossart commented on Oct 14, 2020

    @plbossart
    MemberAuthor

    @ranj063 who is the platform owner for Up2 nocodec? that bug should also impact that device.

  8. fredoh9 commented on Oct 14, 2020

    @fredoh9
    Contributor

    @marc-hb is owner of APL_UP2_NOCODEC platform

  9. plbossart commented on Oct 14, 2020

    @plbossart
    MemberAuthor

    I actually don't see any mixers in the apl-nocodec topology

    # PCM0 <---> volume <----> SSP0
    # PCM1 <---> volume <----> SSP1
    # PCM2 <---> volume <----> SSP2
    # PCM3 <---> volume <----> SSP3
    # PCM4 <---> volume <----> SSP4
    # PCM5 <---> volume <----> SSP5
    # PCM6 <---- volume <----- DMIC6 (DMIC01)
    
  10. marc-hb commented on Oct 14, 2020

    @marc-hb
    Collaborator

    I'm the UP2 platform owner but I stuck to pcm512x so far. Finding a magic system configuration (BIOS version, ACPI override, topology, kernel config,...) that actually produced some sound was by far the most time-consuming part of the "SOF rite of passage" and a Zephyr detour + the lack of firmware loader logs made it even more painful so I avoided any configuration change so far to focus on more productive things. Let me know if/when I should bite the bullet.

  11. fredoh9 commented on Oct 14, 2020

    @fredoh9
    Contributor

    I saw a mixer in APL NOCODEC
    sof-apl-nocodec

  12. ranj063 commented on Oct 14, 2020

    @ranj063
    Collaborator

    I actually don't see any mixers in the apl-nocodec topology

    # PCM0 <---> volume <----> SSP0
    # PCM1 <---> volume <----> SSP1
    # PCM2 <---> volume <----> SSP2
    # PCM3 <---> volume <----> SSP3
    # PCM4 <---> volume <----> SSP4
    # PCM5 <---> volume <----> SSP5
    # PCM6 <---- volume <----- DMIC6 (DMIC01)
    

    clearly someone missed updating this when they added the mixer. I wonder if that was me

  13. plbossart commented on Oct 14, 2020

    @plbossart
    MemberAuthor

    I'm the UP2 platform owner but I stuck to pcm512x so far. Finding a magic system configuration (BIOS version, ACPI override, topology, kernel config,...) that actually produced some sound was by far the most time-consuming part of the "SOF rite of passage" and a Zephyr detour + the lack of firmware loader logs made it even more painful so I avoided any configuration change so far to focus on more productive things. Let me know if/when I should bite the bullet.

    The Kconfig FORCE_NOCODEC is your friend. It will ignore whatever you've setup with ACPI overrides, etc, you don't need to change anything on the device itself - except making sure the sof-apl-nocodec.tplg file is present on the disk.

  14. plbossart commented on Oct 15, 2020

    @plbossart
    MemberAuthor

    @mmaka1 the state diagram in https://thesofproject.github.io/latest/developer_guides/firmware/components/component-overview.html#handle-the-component-device-state cannot work for a mixer component. When the mixer component is paused, it should go back to active when a new source starts. The trigger_release isn't the only stimulus to go from paused to active.

  15. 49 remaining items

  16. cujomalainey commented on Jan 16, 2021

    @cujomalainey
    Contributor

    Only manually linked pull requests can be manually unlinked. To unlink an issue that you linked using a keyword, you must edit the pull request description to remove the keyword.

    From here. So appears the only solution is to not have someone put in the keyword

  17. lgirdwood commented on Jan 18, 2021

    @lgirdwood
    Member

    @marc-hb this is not an auto-closed bug. @slawblauciak had confirmed fix.
    It sounds like you are suggesting we need an extra step where someone from CI confirms that the test for bug X has passed CI for the past Y days and than can either label the issue or close the issue ? This labelling confirmation could also be automated if we could link bugs to CI in GH somehow ???

  18. marc-hb commented on Jan 18, 2021

    @marc-hb
    Collaborator

    @marc-hb this is not an auto-closed bug. @slawblauciak had confirmed fix.

    Sorry, I thought it was auto-closed by github because of the timing and because there is (still) no clear indication of what testing was performed.

    It sounds like you are suggesting we need an extra step where someone from CI confirms that the test for bug X has passed CI for the past Y days and than can either label the issue or close the issue ?

    Yes some extra step like this but only for bugs with no deterministic CI reproduction like this one. Simpler bugs can be closed immediately.

    So appears the only solution is to not have someone put in the keyword

    OK, then it's never going to work :-( We'll just have to not blindly trust the "closed" status of bugs.

  19. marc-hb commented on Jan 19, 2021

    @marc-hb
    Collaborator

    multiple-pause-resume.sh failed again in internal nightly validation run 1679 and the failure was linked to this bug. It failed on only one device. It was validating most recent commit e17b90d which includes tentative fix #3618

    There are plenty of logs but I don't know enough about this bug to tell from them whether that failure was actually this bug.

  20. lgirdwood commented on Jan 19, 2021

    @lgirdwood
    Member

    @marc-hb so do you have any thoughts on how we could reference a GH issue against a CI test. We already have an interface where we can tell CI to test a PR via a comment, but I've no idea if this can be done for bugs e.g.
    SOFCI test=id1,id2(cml)
    Which could tell CI that this issue is tested by tests id1 (all platforms) and id2 (on cml) and then CI could report once it was passing for a time period.

  21. marc-hb commented on Jan 19, 2021

    @marc-hb
    Collaborator

    I don't know how we would do this and I'm sorry I derailed this (important) bug. I don't think we're struggling and need some automation to help us close bugs. So far I only observed the opposite: bugs closed (by github or manually) without process or validation details. Today's example: thesofproject/linux#1449 (comment)

  22. cujomalainey commented on Jan 19, 2021

    @cujomalainey
    Contributor

    OK, then it's never going to work :-( We'll just have to not blindly trust the "closed" status of bugs.

    You can tell if it was closed automatically by the closing line. E.g.
    Automatically jajanusz closed this in #2148 on Dec 16, 2019
    Manual cujomalainey closed this on Dec 3, 2020

  23. marc-hb commented on Jan 21, 2021

    @marc-hb
    Collaborator

    multiple-pause-resume.sh failed again in internal nightly validation run 1679 and the failure was linked to this bug. It failed on only one device.

    This is apparently not #3522 after all but #3714

    I still feel like the testing for #3522 is scant but at least it didn't seem to have surfaced recently.

    EDIT: Multiple PRs required to fix one bug: another example where auto-closing backfires: #3732 (comment) I will personally stop using the magic Fixes: 1234 syntax; every little helps.

  24. slawblauciak commented on Feb 26, 2021

    @slawblauciak
    Collaborator

    Is this issue reproducible still?

  25. marc-hb commented on Feb 27, 2021

    @marc-hb
    Collaborator

    Hard to tell as long a multiple-pause-resume.sh is still not reliable for other reasons like #3714 or #3837.

    multiple-pause-resume.sh was barely reproducing this bug in the first place and I haven't seen any other test for it, is there?

  26. added
    I2SApplies to I2S bus for codec connection
    on Jun 8, 2021
  27. plbossart commented on Jun 10, 2021

    @plbossart
    MemberAuthor

    @lgirdwood @marc-hb I haven't seen any failures for pause/resume tests on platforms with a mixer, should we close this?

  28. marc-hb commented on Jun 10, 2021

    @marc-hb
    Collaborator

    OK so I did the simple thing what everyone in either development or validation should always do to "test the test" but apparently never ever does because we love our green failures: I simply reverted the fix dcbee3c (minor conflict, easily solved) and ran the test again on my UP2. It fails on PCM7 like this:

    sof-test/test-case/multiple-pause-resume.sh 
    
    aplay: set_params:1432: Unable to install hw params:
    
    2021-06-10 18:10:00 UTC [INFO] pipeline: Port0 with aplay
    2021-06-10 18:10:00 UTC [INFO] pipeline: Media Playback 7 with aplay
    2021-06-10 18:10:00 UTC [ERROR] Caught kernel log error
    
    
    Jun 10 10:59:34 up2 kernel: sof-audio-pci-intel-apl 0000:00:0e.0: FW Poll Status: reg[0x180]=0x40000 successful
    Jun 10 10:59:34 up2 kernel: sof-audio-pci-intel-apl 0000:00:0e.0: FW Poll Status: reg[0x180]=0x40000 successful
    Jun 10 10:59:34 up2 kernel: sof-audio-pci-intel-apl 0000:00:0e.0: period_bytes:0xfa0
    Jun 10 10:59:34 up2 kernel: sof-audio-pci-intel-apl 0000:00:0e.0: periods:4
    Jun 10 10:59:34 up2 kernel: sof-audio-pci-intel-apl 0000:00:0e.0: stream_tag 2
    Jun 10 10:59:34 up2 kernel: sof-audio-pci-intel-apl 0000:00:0e.0: ipc tx: 0x60010000: GLB_STREAM_MSG: PCM_PARAMS
    Jun 10 10:59:34 up2 kernel: sof-audio-pci-intel-apl 0000:00:0e.0: error: ipc error for 0x60010000 size 20
    Jun 10 10:59:34 up2 kernel: sof-audio-pci-intel-apl 0000:00:0e.0: error: hw params ipc failed for stream 2
    Jun 10 10:59:34 up2 kernel: sof-audio-pci-intel-apl 0000:00:0e.0: ASoC: error at snd_soc_pcm_component_hw_params on 0000:00:0e.0: -22
    Jun 10 10:59:34 up2 kernel:  Media Playback 7: ASoC: soc_pcm_hw_params() failed (-22)
    Jun 10 10:59:34 up2 kernel:  Media Playback 7: ASoC: dpcm_fe_dai_hw_params failed (-22)
    Jun 10 10:59:34 up2 kernel: sof-audio-pci-intel-apl 0000:00:0e.0: pcm: free stream 7 dir 0
    Jun 10 10:59:34 up2 kernel: sof-audio-pci-intel-apl 0000:00:0e.0: pcm: close stream 7 dir 0
    Jun 10 10:59:34 up2 kernel: sof-audio-pci-intel-apl 0000:00:0e.0: pcm: trigger stream 0 dir 0 cmd 4
    Jun 10 10:59:34 up2 kernel: sof-audio-pci-intel-apl 0000:00:0e.0: FW Poll Status: reg[0x160]=0x2014001e successful
    

    Is this close enough to the original issue which I didn't try to understand? If yes then this can be closed.

    Note when the test is passing it still prints this other green failure which seems unrelated:

    aplay: do_pause:1570: pause push error: File descriptor in bad state
    aplay: do_pause:1570: pause push error: File descriptor in bad state
    PASS
    

    Should this other error be filed elsewhere?

  29. plbossart commented on Jun 10, 2021

    @plbossart
    MemberAuthor

    aplay: do_pause:1570: pause push error: File descriptor in bad state

    we see this sort of logs all the time with pause_push/release and suspend/resume while playing back. I don't think this is problematic.

    Let's close this, thanks for the feedback @marc-hb

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 platformBYTApplies to Baytrail platformFix confirmedFix for the issue has been found and verifiedI2SApplies to I2S bus for codec connectionP1Blocker bugs or important featuresbugSomething isn't working as expectedmixerMixer component

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions