mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Muhammad Usama Anjum <usama.anjum@collabora.com>
To: Manivannan Sadhasivam <mani@kernel.org>,
	Jeff Johnson <jjohnson@kernel.org>,
	quic_bqiang@quicinc.com, jeff.hugo@oss.qualcomm.com
Cc: mhi@lists.linux.dev, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org, ath11k@lists.infradead.org,
	linux-wireless@vger.kernel.org, ath12k@lists.infradead.org,
	sumit.garg@kernel.org
Subject: Re: [Bug Report] mhi: ath11k: dma_alloc_coherent() failures during resume
Date: Thu, 26 Jun 2025 22:39:45 +0500	[thread overview]
Message-ID: <63fee713-34f0-4c76-bd38-8f2fc095849f@collabora.com> (raw)
In-Reply-To: <ead32f5b-730a-4b81-b38f-93d822f990c6@collabora.com>

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


      reply	other threads:[~2025-06-26 17:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-19 10:27 Muhammad Usama Anjum
2025-06-26 17:39 ` Muhammad Usama Anjum [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=63fee713-34f0-4c76-bd38-8f2fc095849f@collabora.com \
    --to=usama.anjum@collabora.com \
    --cc=ath11k@lists.infradead.org \
    --cc=ath12k@lists.infradead.org \
    --cc=jeff.hugo@oss.qualcomm.com \
    --cc=jjohnson@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=mani@kernel.org \
    --cc=mhi@lists.linux.dev \
    --cc=quic_bqiang@quicinc.com \
    --cc=sumit.garg@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®