Skip to content

[BUG] I/O error with DMIC capture pause/release on MTL #6723

Closed

Description

@miRoox

Describe the bug
CI observed an Input/output error when check-pause-resume-capture-100 or check-signal-stop-start.sh on MTL platforms.

To Reproduce

TPLG=/lib/firmware/intel/sof-ace-tplg/sof-mtl-rt711-4ch.tplg MODEL=MTLP_RVP_SDW ~/sof-test/test-case/check-pause-resume.sh -c 100 -m capture

Reproduction Rate
100%

Environment

  1. Branch name and commit hash of the 2 repositories: sof (firmware/topology) and linux (kernel driver).
  2. Name of the topology file
    • Topology: sof-ace-tplg/sof-mtl-rt711-4ch.tplg, sof-ace-tplg/sof-hda-generic-4ch.tplg
  3. Name of the platform(s) on which the bug is observed.
    • Platform: MTLP_RVP_SDW, MTLP_RVP_HDA

Screenshots or console output

console output

=== PAUSE ===                                                            
(100/100) Wait for 121 ms before pause

(100/100) Wait for 181 ms before resume

declare -- cmd="journalctl_cmd --since=@1670281836"
2022-12-05 23:11:08 UTC [REMOTE_INFO] Entering expect script with:
      arecord   -D hw:0,10 -r 48000 -c 4 -f S32_LE -vv -i /dev/null -q
spawn arecord -D hw:0,10 -r 48000 -c 4 -f S32_LE -vv -i /dev/null -q
Hardware PCM card 0 'sof-soundwire' device 10 subdevice 0
Its setup is:
  stream       : CAPTURE
  access       : RW_INTERLEAVED
  format       : S32_LE
  subformat    : STD
  channels     : 4
  rate         : 48000
  exact rate   : 48000 (48000/1)
  msbits       : 32
  buffer_size  : 4096
  period_size  : 1024
  period_time  : 21333
  tstamp_mode  : NONE
  tstamp_type  : MONOTONIC
  period_step  : 1
  avail_min    : 1024
  period_event : 0
  start_threshold  : 1
  stop_threshold   : 4096
  silence_threshold: 0
  silence_size : 0
  boundary     : 4611686018427387904
  appl_ptr     : 0
  hw_ptr       : 0

#+                                                 | 00%
(1/100) Wait for 142 ms before pause
 
#+                                                 | 00%
=== PAUSE ===                                                            
(1/100) Wait for 107 ms before pause

(1/100) Wait for 104 ms before resume
                                                                           
 
#+                                                 | 00%
=== PAUSE ===                                                            
(2/100) Wait for 189 ms before pause

(2/100) Wait for 181 ms before resume
                                                                           
 arecord: pcm_read:2221: read error: Input/output error
2022-12-05 23:11:10 UTC [REMOTE_ERROR] Starting func_exit_handler(), exit status=1, FUNCNAME stack:
2022-12-05 23:11:10 UTC [REMOTE_ERROR]  main()  @  /home/ubuntu/sof-test/test-case/check-pause-resume.sh

full console_log.txt
mtrace.txt
dmesg.txt

Activity

  1. added
    bugSomething isn't working as expected
    P2Critical bugs or normal features
    IPC4Issues observed with IPC4 (same IPC as Windows)
    MTLApplies to Meteor Lake platform
    on Dec 6, 2022
  2. added
    P1Blocker bugs or important features
    and removed
    P1Blocker bugs or important features
    on Dec 19, 2022
  3. added
    SDWSoundWire
    suspend-resumeIssues observed when doing system suspend and resume
    on Jan 6, 2023
  4. keqiaozhang commented on Feb 3, 2023

    @keqiaozhang
    Collaborator

    This issue also happened on MTL-NOCODEC when testing signal-stop-start.

  5. marc-hb commented on Feb 3, 2023

    @marc-hb
    Collaborator
  6. added this to the v2.5 milestone on Feb 3, 2023
  7. changed the title [-][BUG] I/O error when check-pause-resume-capture on MTL platforms[/-] [+][BUG] I/O error when checking signal stop/start or pause/resume related cases on MTL platforms[/+] on Feb 20, 2023
  8. added
    P1Blocker bugs or important features
    and removed
    P2Critical bugs or normal features
    on Feb 20, 2023
  9. keqiaozhang commented on Feb 20, 2023

    @keqiaozhang
    Collaborator

    This issue also can be reproduced with signal stop/start on MTL platforms. Changing the priority to P1.

  10. 39 remaining items

  11. serhiy-katsyuba-intel commented on Mar 16, 2023

    @serhiy-katsyuba-intel
    Contributor

    Found a suspicious code in Zephyr dmic.c. In dai_dmic_stop() CIC_CONTROL_SOFT_RESET_BIT bit is set to put DMIC in reset. However, in dai_dmic_start() clearing of CIC_CONTROL_SOFT_RESET_BIT is put into #ifndef CONFIG_SOC_SERIES_INTEL_ACE and so is only done for non MTL platforms.
    Tagging @dnikodem
    Removing all "#ifndef CONFIG_SOC_SERIES_INTEL_ACE" (there is a second #ifndef for CIC_CONTROL_MIC_MUTE_BIT which seems also not needed/wrong) from dmic.c and running the test could verify the theory.

  12. singalsu commented on Mar 16, 2023

    @singalsu
    Collaborator

    @dnikodem @serhiy-katsyuba-intel If the unreset is done for MTL it should be done before setting the start bits to use the HW sync start feature.

  13. juimonen commented on Mar 16, 2023

    @juimonen

    sorry about polluting this bug with start/stop issue, but it is real in my mtl device and it is caused by this:

    commit 5d210ccb695ad53bfd672f7f7223d1316f4e62a3
    Author: Baofeng Tian <baofeng.tian@intel.com>
    Date:   Wed Feb 22 11:15:25 2023 +0800
    
        host-zephyr: limit copy bytes to one period for capture pipeline
    
        Limit copy bytes to period bytes for both playback and capture
        to avoid high load spike.
    
        Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
    
    

    I have no idea why it is not causing issues in CI machines, maybe my device is running so on the limit etc.

    @serhiy-katsyuba-intel I guess this recent change is exactly limiting for 1 period instead of more data to be pushed. @btian1 FYI.

    So I can't say for sure this is a real issue, or just my borked device, or could we face this issue in other scenarios...

  14. ranj063 commented on Mar 16, 2023

    @ranj063
    Collaborator

    @serhiy-katsyuba-intel @juimonen The real issue is that we're not waiting to ensure that the DMA channel is disabled. The fix for this is in the DW DMA driver here in this PR: zephyrproject-rtos/zephyr#55891

    On top of this, there are 2 more things we need to make sure:

    1. boards: intel_adsp_ace15_mtpm: Enable dw_dma_suspend_drain for ACE #7296: To ensure that suspend_drain is default for MTL
    2. dai-zephyr: Fix the ordering of DAI and DMA triggers during #7295: To fix the ordering of DAI and DMA starts.
  15. abonislawski commented on Mar 17, 2023

    @abonislawski
    Member

    @ranj063 great changes and findings! Thanks for debugging this

  16. lgirdwood commented on Mar 17, 2023

    @lgirdwood
    Member

    @ranj063 is the a PR for clearing the DONE bits ?

  17. ranj063 commented on Mar 17, 2023

    @ranj063
    Collaborator

    @ranj063 is the a PR for clearing the DONE bits ?

    @lgirdwood not yet. I will post it today

  18. added this to the v2.6 milestone on Mar 17, 2023
  19. kv2019i commented on Mar 22, 2023

    @kv2019i
    Collaborator

    @serhiy-katsyuba-intel @ranj063 We now pull in some fixes to dw-dma driver via #7316 . This bug with dmic pause/release does still happen.

    One curious data point is that without "e40859f78712 Revert "dma: dw: Do not program SAR/DAR and CTL_HI/LO when using HW LLI"" the dmic pause/release test PASSES on MTL. So this hints the problem is somehow related to state of the the dmic FIFO dma-dw reads from.

  20. ranj063 commented on Mar 24, 2023

    @ranj063
    Collaborator

    @kv2019i @serhiy-katsyuba-intel this issue is now fixed with the zephyr PR 56209.

  21. keqiaozhang commented on Mar 29, 2023

    @keqiaozhang
    Collaborator

    We need Zephyr updates in sof main branch. reopening this bug.

  22. keqiaozhang commented on Apr 3, 2023

    @keqiaozhang
    Collaborator

    This bug is fixed by 7bc3bde. Closing this bug.

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

Metadata

Metadata

Labels

HDAApplies to HD-Audio bus for codec connectionI2SApplies to I2S bus for codec connectionIPC4Issues observed with IPC4 (same IPC as Windows)MTLApplies to Meteor Lake platformP1Blocker bugs or important featuresSDWSoundWirebugSomething isn't working as expectedsuspend-resumeIssues observed when doing system suspend and resume

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions