This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

dma_alloc_coherent failed in AM3505

Other Parts Discussed in Thread: AM3505

Hi All,

We are using AM3505 processor based custom board. We are using kernel version 2.6.37 on that. 

We are facing very strange issue currently. On our board when we use 2 Telit modems together (module used by modem : cdc-acm.ko) in that case video driver is showing below error. 

[   63.569976] vpfe-capture vpfe-capture: adjusted width = 160, height = 128, bpp = 2, bytesperline = 320, sizeimage = 40960
[   63.996337] vpfe-capture vpfe-capture: dma_alloc_coherent size 40960 failed
 
If we remove any one Telit modem then issue is not happening. To narrow down issue we have done below experiments. 
We have also done few more experiments based on TI e2e posts. 
 
1. Increase MAX_ORDER to 12.
2. Increase CONSISTENT_DMA_SIZE to SZ_8M instead of SZ_4M.

 We don't get success in both of above experiments error is still there.

Later on understand is above experiments are irrelevant for our issue because of below reason.

Actually our buffer size requirement (40960 for 1 buffer) for two buffer is  81920 which is around 80k. This experiment indicates that issue is not happening because we don't have large size continuous memory available. It is happening because we don't enough(81920 bytes)  large size memory available at all.   

NOTE: Please note that as experiment purpose if I allocated very low memory 4096 bytes then dma_alloc_coherent is not failing. 

To narrow down issue we have done few more experiments. 

1. We prepare memory map of our system. Our product has System RAM 256MB.

Kernel : 11.59MB

Free Memory (Free + Cached ): 131.68MB (Because cached memory is always reclaimable)

Apps + Daemon : 94.93MB

Slab : 8.33 MB

Other memory(Page table and Page structure etc) : ~10MB.

(11.59 + 131.68 + 94.93 + 8.33 + 10) = 256MB

Above experiments indicates that we have enough free memory but continuous memory is not allocated from this free memory.   

Which means I need to figure out how to reserve enough continuous pages allocation. As per my understanding either it needs to be taken care at boot time or in driver init/probe function so that it can not fail at run time.

Any suggestion or direction would be appreciated for this issue. As it is blocking and critical issue for us urgent help on this issue would be appreciated.

Thanks,

Jemish