mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kang Yang <kang.yang@oss.qualcomm.com>
To: Loic Poulain <loic.poulain@oss.qualcomm.com>
Cc: Jeff Johnson <jjohnson@kernel.org>,
	Baochen Qiang <baochen.qiang@oss.qualcomm.com>,
	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 03/10] wifi: ath10k: wake blocked waiters when entering WEDGED state
Date: Thu, 26 Nov 2026 15:05:16 +0800	[thread overview]
Message-ID: <7e396e37-d70b-4091-8764-f416b1ddc7aa@oss.qualcomm.com> (raw)
In-Reply-To: <CAFEp6-2pecH+PxiDv+VpCfUyQabGSDWitHPbxpAv57fWTiP=mA@mail.gmail.com>



On 11/25/2026 6:29 PM, Loic Poulain wrote:
> On Fri, Nov 20, 2026 at 9:42 AM Kang Yang <kang.yang@oss.qualcomm.com> wrote:
>>
>> Commit c256a94d1b1b ("wifi: ath10k: shutdown driver when
>> hardware is unreliable") added a fail-count based transition
>> to ATH10K_STATE_WEDGED after repeated recovery failures.
>>
>> When recovery starts, ath10k_core_restart() sets
>> ATH10K_FLAG_CRASH_FLUSH and wakes waiters already blocked at
>> the time the failure is detected. However, additional waits
>> may be created later while the recovery attempt is still in
>> progress.
>>
>> If recovery ultimately fails and the device transitions to
>> ATH10K_STATE_WEDGED, those later waiters continue sleeping
>> until their individual timeouts expire even though no further
>> progress is possible.
>>
>> On suspend/resume, these extra wait timeouts consume watchdog
>> budget. Crash logs show cases where one or two such timeouts
>> are enough to cause the suspend watchdog to fire before the
>> driver finishes shutting down.
>>
>> Apply the same CRASH_FLUSH, queue-stop and waiter wakeup
>> handling when entering ATH10K_STATE_WEDGED so blocked callers
>> fail immediately once the driver gives up.
>>
>> 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
>>
>> Fixes: c256a94d1b1b ("wifi: ath10k: shutdown driver when hardware is unreliable")
>> Signed-off-by: Kang Yang <kang.yang@oss.qualcomm.com>
>> ---
>>   drivers/net/wireless/ath/ath10k/core.c | 43 +++++++++++++++++++++++-----------
>>   1 file changed, 29 insertions(+), 14 deletions(-)
>>
>> diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
>> index b536c21630b1..3bb4d2742c30 100644
>> --- a/drivers/net/wireless/ath/ath10k/core.c
>> +++ b/drivers/net/wireless/ath/ath10k/core.c
>> @@ -2533,6 +2533,32 @@ static int ath10k_init_hw_params(struct ath10k *ar)
>>          return 0;
>>   }
>>
>> +static void ath10k_core_wake_all_waiters(struct ath10k *ar)
>> +{
>> +       complete(&ar->scan.started);
>> +       complete(&ar->scan.completed);
>> +       complete(&ar->scan.on_channel);
>> +       complete(&ar->offchan_tx_completed);
>> +       complete(&ar->install_key_done);
>> +       complete(&ar->vdev_setup_done);
>> +       complete(&ar->vdev_delete_done);
>> +       complete(&ar->thermal.wmi_sync);
>> +       complete(&ar->bss_survey_done);
>> +       wake_up(&ar->htt.empty_tx_wq);
>> +       wake_up(&ar->wmi.tx_credits_wq);
>> +       wake_up(&ar->peer_mapping_wq);
>> +}
>> +
>> +static void ath10k_core_enter_wedged(struct ath10k *ar)
>> +{
>> +       ar->state = ATH10K_STATE_WEDGED;
>> +
>> +       set_bit(ATH10K_FLAG_CRASH_FLUSH, &ar->dev_flags);
>> +
>> +       ieee80211_stop_queues(ar->hw);
>> +       ath10k_core_wake_all_waiters(ar);
>> +}
>> +
>>   static void ath10k_core_recovery_check_work(struct work_struct *work)
>>   {
>>          struct ath10k *ar = container_of(work, struct ath10k,
>> @@ -2551,7 +2577,7 @@ static void ath10k_core_recovery_check_work(struct work_struct *work)
>>
>>          ath10k_err(ar, "recovery did not complete in %u ms, will shutdown driver!\n",
>>                     jiffies_to_msecs(ATH10K_RECOVERY_TIMEOUT_HZ));
>> -       ar->state = ATH10K_STATE_WEDGED;
>> +       ath10k_core_enter_wedged(ar);
>>   }
>>
>>   void ath10k_core_start_recovery(struct ath10k *ar)
>> @@ -2618,18 +2644,7 @@ static void ath10k_core_restart(struct work_struct *work)
>>
>>          ieee80211_stop_queues(ar->hw);
>>          ath10k_drain_tx(ar);
>> -       complete(&ar->scan.started);
>> -       complete(&ar->scan.completed);
>> -       complete(&ar->scan.on_channel);
>> -       complete(&ar->offchan_tx_completed);
>> -       complete(&ar->install_key_done);
>> -       complete(&ar->vdev_setup_done);
>> -       complete(&ar->vdev_delete_done);
>> -       complete(&ar->thermal.wmi_sync);
>> -       complete(&ar->bss_survey_done);
>> -       wake_up(&ar->htt.empty_tx_wq);
>> -       wake_up(&ar->wmi.tx_credits_wq);
>> -       wake_up(&ar->peer_mapping_wq);
>> +       ath10k_core_wake_all_waiters(ar);
>>
>>          /* TODO: We can have one instance of cancelling coverage_class_work by
>>           * moving it to ath10k_halt(), so that both stop() and restart() would
>> @@ -2664,7 +2679,7 @@ static void ath10k_core_restart(struct work_struct *work)
>>                  /* hw restart might be requested from multiple places */
>>                  break;
>>          case ATH10K_STATE_RESTARTED:
>> -               ar->state = ATH10K_STATE_WEDGED;
>> +               ath10k_core_enter_wedged(ar);
> 
> ath10k_core_enter_wedged call ieee80211_stop_queues(), which is also
> called earlier in this function, is it expected and harmless?


mac80211 will make this harmless:
static void __ieee80211_stop_queue(struct ieee80211_hw *hw, int queue,
				   enum queue_stop_reason reason,
				   bool refcounted)
{
	struct ieee80211_local *local = hw_to_local(hw);

	if (WARN_ON(queue >= hw->queues))
		return;

	if (!refcounted)   // refcounted=false
		local->q_stop_reasons[queue][reason] = 1;
	else
		local->q_stop_reasons[queue][reason]++;

	trace_stop_queue(local, queue, reason,
			 local->q_stop_reasons[queue][reason]);

	set_bit(reason, &local->queue_stop_reasons[queue]);
}




> 
>>                  fallthrough;
>>          case ATH10K_STATE_WEDGED:
>>                  ath10k_warn(ar, "device is wedged, will not restart\n");
>>
>> --
>> 2.34.1
>>


  reply	other threads:[~2026-11-26  7:05 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 [this message]
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

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=7e396e37-d70b-4091-8764-f416b1ddc7aa@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®