[Bug Report] mhi: ath11k: dma_alloc_coherent() failures during resume

Muhammad Usama Anjum usama.anjum at collabora.com
Thu Jun 26 10:39:45 PDT 2025


Hi,

I'm trying to understand ath11k_core_reconfigure_on_crash(). It seems after
every suspend/hibernate cycle, the hal and dp specifically are de-initialized
and initialized again to have clean state again to start working with firmware.
When there's memory pressure, driver isn't able to get the free-ed dma memory
area again.

The name of the function, ath11k_core_reconfigure_on_crash() suggests that we
are recovering from crash and that's why all of the states of different
components are being allocated cleanly from the start. But we aren't resuming
from crash, instead we are resuming from suspend which was handled by the driver
itself. So this state cleanup must have been done by the suspend handler.

Any pointers on how to avoid going through deinit-init cycle of whole objects
every time?

Thanks,
Usama

On 6/19/25 3:27 PM, Muhammad Usama Anjum wrote:
> Hi,
> 
> When there is memory pressure during resume and no DMA memory is available,
> the ath11k driver fails to resume. The driver currently frees its DMA memory
> during suspend or hibernate, and attempts to re-allocate it during resume.
> However, if the DMA memory has been consumed by other software in the
> meantime, these allocations can fail, leading to critical failures in the WiFi
> driver.
> 
> Although I have recently fixed several instances to ensure DMA memory is not
> freed once allocated, we continue to receive reports of failures. I was
> preparing to submit a patch for the another case, but this issue cannot be
> fully resolved as long as even one DMA allocation remains in the resume path.
> 
> The following functions are allocating dma memory in resume path:
> 
> <function> <size> <index>
> mhi_init_dev_ctxt dma_alloc_coherent(5632)
> mhi_init_dev_ctxt dma_alloc_coherent(88)
> mhi_alloc_aligned_ring dma_alloc_coherent(1023)
> mhi_alloc_aligned_ring dma_alloc_coherent(8191)
> mhi_init_dev_ctxt dma_alloc_coherent(44)
> mhi_alloc_aligned_ring dma_alloc_coherent(4095)
> mhi_alloc_aligned_ring dma_alloc_coherent(2047)
> mhi_alloc_aligned_ring dma_alloc_coherent(2047)
> ath11k_hal_alloc_cont_rdp dma_alloc_coherent(688)
> [ath11k_hal_alloc_cont_wrp dma_alloc_coherent(180)
> ath11k_dp_srng_setup dma_alloc_coherent(262143)
> ath11k_dp_link_desc_bank_alloc dma_alloc_coherent(2097152) 0
> ath11k_dp_link_desc_bank_alloc dma_alloc_coherent(2097152) 1
> ath11k_dp_link_desc_bank_alloc dma_alloc_coherent(384) 2
> ath11k_dp_srng_setup dma_alloc_coherent(2055)
> ath11k_dp_srng_setup dma_alloc_coherent(1031)
> ath11k_dp_srng_setup dma_alloc_coherent(1159)
> ath11k_dp_srng_setup dma_alloc_coherent(16391)
> ath11k_dp_srng_setup dma_alloc_coherent(1048583)
> ath11k_dp_srng_setup dma_alloc_coherent(1031)
> ath11k_dp_srng_setup dma_alloc_coherent(32775)
> ath11k_dp_srng_setup dma_alloc_coherent(8199)
> ath11k_dp_srng_setup dma_alloc_coherent(10247)
> ath11k_dp_srng_setup dma_alloc_coherent(212999)
> ath11k_dp_srng_setup dma_alloc_coherent(131079)
> ath11k_dp_srng_setup dma_alloc_coherent(131079)
> ath11k_dp_srng_setup dma_alloc_coherent(131079)
> ath11k_dp_srng_setup dma_alloc_coherent(131079)
> ath11k_dp_srng_setup dma_alloc_coherent(32775)
> ath11k_dp_srng_setup dma_alloc_coherent(8199)
> ath11k_dp_srng_setup dma_alloc_coherent(8199)
> ath11k_dp_srng_setup dma_alloc_coherent(32775)
> ath11k_dp_srng_setup dma_alloc_coherent(32775)
> ath11k_dp_srng_setup dma_alloc_coherent(8199)
> ath11k_dp_srng_setup dma_alloc_coherent(8199)
> 
> Let's discuss the general possible solution for this. I'm sure a lot
> of other drivers would be facing the same kind of issues. What can be
> general approach to solve this problem.
> 
> Regards,
> Muhammad Usama Anjum




More information about the ath11k mailing list