From: Kang Yang <kang.yang@oss.qualcomm.com>
To: Baochen Qiang <baochen.qiang@oss.qualcomm.com>,
Jeff Johnson <jjohnson@kernel.org>,
Loic Poulain <loic.poulain@oss.qualcomm.com>
Cc: Jeff Johnson <jeff.johnson@oss.qualcomm.com>,
linux-wireless@vger.kernel.org, ath10k@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH ath-next v4 10/10] wifi: ath10k: drop async writes and sleep timer across power cycles
Date: Thu, 26 Nov 2026 18:01:56 +0800 [thread overview]
Message-ID: <5a38be6e-09a5-4955-bc96-190a9ae33c2a@oss.qualcomm.com> (raw)
In-Reply-To: <6dbec0cb-ac36-41b6-9a8b-12da800222ab@oss.qualcomm.com>
On 11/26/2026 4:37 PM, Baochen Qiang wrote:
>
>
> On 11/20/2026 4:41 PM, Kang Yang wrote:
>> ath10k_sdio_hif_tx_sg() queues writes on ar_sdio->wr_asyncq and
>> schedules wr_async_work. The SDIO sleep timer also schedules this
>> work, and the work may re-arm the timer.
>>
>> The current shutdown sequence does not prevent this activity from
>> surviving an SDIO power cycle:
>>
>> - ath10k_sdio_hif_stop() drains wr_asyncq once, but new writes may
>> still be queued before the card is marked disabled.
>>
>> - ath10k_sdio_hif_power_down() deletes the sleep timer but does not
>> cancel wr_async_work.
>>
>> - ath10k_sdio_hif_power_up() does not clear work or requests left
>> from the previous power cycle.
>>
>> As a result, stale work may access the SDIO bus while the device is
>> being reinitialized in BMI mode, causing errors such as:
>>
>> failed to read from address 0x868: -110
>> failed to read fifo/chip control register: -110
>> bmi communication timeout
>> could not write board data (-110)
>>
>> Mark the card disabled before power-down begins so new asynchronous
>> transfers are rejected. Make wr_async_work drop requests that raced
>> with the state change instead of accessing the bus.
>>
>> Synchronize the sleep timer and wr_async_work, then drain wr_asyncq
>> during both power-down and power-up so no request from an earlier
>> power cycle can run during BMI initialization. Factor the queue
>> cleanup into a helper shared with ath10k_sdio_hif_stop().
>>
>> A dropped request is completed the same way as a written one, only
>> without the bus access. HTC messages go through
>> ath10k_htc_notify_tx_completion(), which lets the endpoint release the
>> skb. The IRQ disable request signals its completion and leaves the skb
>> to the waiter, which frees it. Every bus request is returned to the
>> free pool, so nothing is leaked.
>>
>> As a result, ath10k_sdio_hif_stop() no longer frees the skb of a
>> non-HTC request itself. The IRQ disable request is the only such
>> request, and its skb is owned by its waiter.
>>
>> Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00288-QCARMSWPZ-1
>> Tested-on: QCA6174 hw3.2 SDIO WLAN.RMH.4.4.1-00189
>>
>> Signed-off-by: Kang Yang <kang.yang@oss.qualcomm.com>
>> ---
>> drivers/net/wireless/ath/ath10k/sdio.c | 78 ++++++++++++++++++++++++----------
>> 1 file changed, 56 insertions(+), 22 deletions(-)
>>
>> diff --git a/drivers/net/wireless/ath/ath10k/sdio.c b/drivers/net/wireless/ath/ath10k/sdio.c
>> index fdf19ce4b55b..f0e1feacb629 100644
>> --- a/drivers/net/wireless/ath/ath10k/sdio.c
>> +++ b/drivers/net/wireless/ath/ath10k/sdio.c
>> @@ -1461,6 +1461,33 @@ static void ath10k_sdio_sleep_timer_handler(struct timer_list *t)
>> queue_work(ar_sdio->workqueue, &ar_sdio->wr_async_work);
>> }
>>
>> +/* Drop any requests still queued on wr_asyncq without touching the bus.
>> + * Caller must ensure wr_async_work is not running concurrently.
>> + */
>> +static void ath10k_sdio_drop_wr_async_reqs(struct ath10k *ar)
>> +{
>> + struct ath10k_sdio *ar_sdio = ath10k_sdio_priv(ar);
>> + struct ath10k_sdio_bus_request *req, *tmp_req;
>> +
>> + spin_lock_bh(&ar_sdio->wr_async_lock);
>> +
>> + list_for_each_entry_safe(req, tmp_req, &ar_sdio->wr_asyncq, list) {
>> + struct ath10k_htc_ep *ep;
>> +
>> + list_del(&req->list);
>> +
>> + if (req->htc_msg) {
>> + ep = &ar->htc.endpoint[req->eid];
>> + ath10k_htc_notify_tx_completion(ep, req->skb);
>> + } else if (req->comp) {
>> + complete(req->comp);
>
> In ath10k_sdio_irq_disable(), irqs_disabled_comp is on the stack. If
> wait_for_completion_timeout() expires, the function frees the skb and returns while the
> request may still be on wr_asyncq. ath10k_sdio_hif_stop() then reaches this branch and
> calls complete() on a dead stack frame.
This seems to be a pre-exist issue.
Got it, will add a check/clean for this case.
prev parent reply other threads:[~2026-11-26 10:02 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 8:41 [PATCH ath-next v4 00/10] wifi: ath10k: fix recovery and WEDGED failure handling Kang Yang
2026-11-20 8:41 ` [PATCH ath-next v4 01/10] wifi: ath10k: fix SDIO aux workqueue starvation in recovery detection Kang Yang
2026-11-25 10:26 ` Loic Poulain
2026-11-26 8:16 ` Baochen Qiang
2026-11-20 8:41 ` [PATCH ath-next v4 02/10] wifi: ath10k: shorten the recovery timeout to 10 seconds Kang Yang
2026-11-20 8:41 ` [PATCH ath-next v4 03/10] wifi: ath10k: wake blocked waiters when entering WEDGED state Kang Yang
2026-11-25 10:29 ` Loic Poulain
2026-11-26 7:05 ` Kang Yang
2026-11-20 8:41 ` [PATCH ath-next v4 04/10] wifi: ath10k: also wake remaining blocked waiters Kang Yang
2026-11-25 10:35 ` Loic Poulain
2026-11-26 7:07 ` Kang Yang
2026-11-20 8:41 ` [PATCH ath-next v4 05/10] wifi: ath10k: hard-block the radio when entering WEDGED state Kang Yang
2026-11-20 8:41 ` [PATCH ath-next v4 06/10] wifi: ath10k: remove now-unused driver_recovery completion Kang Yang
2026-11-20 8:41 ` [PATCH ath-next v4 07/10] wifi: ath10k: trigger recovery on PCIe MMIO wake-up failures Kang Yang
2026-11-20 8:41 ` [PATCH ath-next v4 08/10] wifi: ath10k: trigger recovery on corrupted HTC bundle lookahead Kang Yang
2026-11-25 10:48 ` Loic Poulain
2026-11-26 8:20 ` Baochen Qiang
2026-11-20 8:41 ` [PATCH ath-next v4 09/10] wifi: ath10k: reject scan requests while the device is not running Kang Yang
2026-11-20 8:41 ` [PATCH ath-next v4 10/10] wifi: ath10k: drop async writes and sleep timer across power cycles Kang Yang
2026-11-26 8:37 ` Baochen Qiang
2026-11-26 10:01 ` Kang Yang [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=5a38be6e-09a5-4955-bc96-190a9ae33c2a@oss.qualcomm.com \
--to=kang.yang@oss.qualcomm.com \
--cc=ath10k@lists.infradead.org \
--cc=baochen.qiang@oss.qualcomm.com \
--cc=jeff.johnson@oss.qualcomm.com \
--cc=jjohnson@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=loic.poulain@oss.qualcomm.com \
/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®