ALSA pcm device is hanging after DMA operations

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ALSA pcm device is hanging after DMA operations

1,344 Views
ftonello
Contributor I

Hi,

I am dealing with some nasty problems with ALSA pcm and, what is seems, any type of DMA transaction. I would love to have some help from the community.

Before I continue with the problem I would like to describe my platform:

  • i.MX6Q (rex module from imx6rex.com)
  • Kernel 4.4 vanilla with small set of local patches
    • DTS file for our board (based on imx6q-rex-pro.dts)
      • sound node uses ssi1 controller
    • USB gadget f_midi improvements (which are upstreamed on newer versions of the kernel)
    • and some other minor bug fixes
  • CS4272 codec via I2C (cs4271-hifi dai)
  • I found the imx6q-sdma.bin laying around on the internet and I am using it. Apparently it is version 1.1 as reported by the driver.

The ALSA pcm works just fine, I can write to the codec and the sound comes out just fine, but the problem is that when I do any DMA transaction eventually the ALSA pcm hangs. By any I mean serial communication (reading and writing to a terminal), USB requests allocation and freeing etc. If I increase the coherent_pool size to 1M, let say, it takes longer for the pcm to hang.

I already tested with newer kernel versions, such as 4.5 and 4.6 and it still hangs.

Considering I am setting up this device as a USB device using f_midi function (MIDI device). There are few ways I can easily reproduce here:

  • plug/unplug the USB device (imx) to/from a host (computer) several times; or
  • If the host doesn't consume the USB requests, i.e., sending MIDI to a host but the host ignoring this data, will cause an overrun in the gadget driver, which is fine. But ALSA MIDI driver will dump a bunch of error messages to the terminal that will eventually hang the ALSA pcm device.

Example log of plugin the USB device to a host (I added those dma_pool_alloc/free prints):

[...]

[   71.873046] wakeup int at ci_hdrc.1

[   71.873068] ci_hdrc ci_hdrc.1: at ci_controller_resume

[   71.877018] imx_usb 2184000.usb: at imx_controller_resume

[   71.877035] wakeup int at ci_hdrc.0

[   71.877056] ci_hdrc ci_hdrc.0: at ci_controller_resume

[   72.244539] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.249875] ci_hdrc ci_hdrc.0: pool_alloc_page (ci_hw_td)

[   72.255384] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.324438] ci_hdrc ci_hdrc.0: dma_pool_free (ci_hw_td)

[   72.329696] ci_hdrc ci_hdrc.0: dma_pool_free (ci_hw_td)

[   72.334958] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.351103] ci_hdrc ci_hdrc.0: dma_pool_free (ci_hw_td)

[   72.356374] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.361751] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.367171] ci_hdrc ci_hdrc.0: dma_pool_free (ci_hw_td)

[   72.372427] ci_hdrc ci_hdrc.0: dma_pool_free (ci_hw_td)

[   72.377692] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.383071] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.388543] ci_hdrc ci_hdrc.0: dma_pool_free (ci_hw_td)

[   72.393799] ci_hdrc ci_hdrc.0: dma_pool_free (ci_hw_td)

[   72.399063] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.404450] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.409922] ci_hdrc ci_hdrc.0: dma_pool_free (ci_hw_td)

[   72.415176] ci_hdrc ci_hdrc.0: dma_pool_free (ci_hw_td)

[   72.420440] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.425824] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.431295] ci_hdrc ci_hdrc.0: dma_pool_free (ci_hw_td)

[   72.436548] ci_hdrc ci_hdrc.0: dma_pool_free (ci_hw_td)

[   72.441810] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.447189] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.452562] ci_hdrc ci_hdrc.0: dma_pool_free (ci_hw_td)

[   72.457816] ci_hdrc ci_hdrc.0: dma_pool_free (ci_hw_td)

[   72.463076] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.468449] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.473923] ci_hdrc ci_hdrc.0: dma_pool_free (ci_hw_td)

[   72.479177] ci_hdrc ci_hdrc.0: dma_pool_free (ci_hw_td)

[   72.484439] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.489833] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.495767] ci_hdrc ci_hdrc.0: dma_pool_free (ci_hw_td)

[   72.501021] ci_hdrc ci_hdrc.0: dma_pool_free (ci_hw_td)

[   72.506274] MIDI Gadget gadget: high-speed config #1: MIDI Gadget

[   72.512899] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[...]

[   72.593269] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.598625] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.603980] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.609333] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.614687] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.620043] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.625396] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.630750] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.636104] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.641477] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.646835] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.652196] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.657555] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.662911] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.668293] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.673657] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.679014] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.684370] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.689804] ci_hdrc ci_hdrc.0: dma_pool_free (ci_hw_td)

[   72.695078] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.700467] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.705939] ci_hdrc ci_hdrc.0: dma_pool_free (ci_hw_td)

[   72.711195] ci_hdrc ci_hdrc.0: dma_pool_free (ci_hw_td)

[   72.716457] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.721844] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.727300] ci_hdrc ci_hdrc.0: dma_pool_free (ci_hw_td)

[   72.732553] ci_hdrc ci_hdrc.0: dma_pool_free (ci_hw_td)

[   72.737815] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.743199] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.748673] ci_hdrc ci_hdrc.0: dma_pool_free (ci_hw_td)

[   72.753925] ci_hdrc ci_hdrc.0: dma_pool_free (ci_hw_td)

[   72.759188] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   72.764571] ci_hdrc ci_hdrc.0: dma_pool_alloc (ci_hw_td)

[   74.051858] ci_hdrc ci_hdrc.1: at ci_runtime_suspend

[   74.051922] imx_usb 2184200.usb: at imx_controller_suspend

[   84.241825] playback write error (DMA or IRQ trouble?).

Thanks in advance.

Felipe Tonello

Labels (2)
Tags (3)
0 Kudos
3 Replies

866 Views
igorpadykov
NXP Employee
NXP Employee

Hi Felipe

one can try more mature rex sw to check if this is caused

by hardware (ddr) errors

FEDEVEL · GitHub

also one can post this on rex community

FEDEVEL Community Forum for Electronic Enthusiastics & Professionals - FEDEVEL Forums

Best regards

igor

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

0 Kudos

866 Views
ftonello
Contributor I

What do you mean by more mature rex software? imx6rex-linux-3.10.17 or openrex-linux-3.14?

0 Kudos

866 Views
igorpadykov
NXP Employee
NXP Employee

sorry, "mature" mean more well tested.

0 Kudos