From: "Luka Gejak" <luka.gejak@linux.dev>
To: "Kalpesh Solanki" <skalpesh942@gmail.com>, pkshih@realtek.com
Cc: kvalo@kernel.org, linux-wireless@vger.kernel.org,
linux-kernel@vger.kernel.org,
"Kalpesh Solanki" <skalpesh942@gmail.com>
Subject: Re: [PATCH v3 2/2] wifi: rtw88: ps: trigger firmware recovery only after consecutive LPS leave failures
Date: Sun, 08 Nov 2026 11:44:22 +0000 [thread overview]
Message-ID: <da84e88e367522c239340aff5c3011d7c0642f9a@linux.dev> (raw)
In-Reply-To: <20261108085126.331784-3-skalpesh942@gmail.com>
Hi Kalpesh,
I also have a couple of comments for this patch.
November 8, 2026 at 9:51 AM, "Kalpesh Solanki" <skalpesh942@gmail.com> wrote:
> diff --git a/drivers/net/wireless/realtek/rtw88/ps.c b/drivers/net/wireless/realtek/rtw88/ps.c
> index add5a20b8432..864e2be243ea 100644
> --- a/drivers/net/wireless/realtek/rtw88/ps.c
> +++ b/drivers/net/wireless/realtek/rtw88/ps.c
> @@ -165,7 +165,14 @@ static void rtw_fw_leave_lps_check(struct rtw_dev *rtwdev)
> if (ret) {
> rtw_write32_clr(rtwdev, REG_TCR, BIT_PWRMGT_HWDATA_EN);
> rtw_warn(rtwdev, "firmware failed to leave lps state\n");
> - rtw_fw_dump_dbg_info(rtwdev);
rtw_fw_dump_dbg_info() returns right away unless RTW_DBG_FW is set, so I
don't think it can flood the log in normal use, and the rtw_warn() above
still prints on every failure. With that debug mask on, the dump from
the first failure seems useful too. Could it stay where it was?
> +
> + rtwdev->ps_hang_cnt++;
> + if (rtwdev->ps_hang_cnt >= RTW_PS_HANG_MAX_CNT) {
> + rtw_fw_dump_dbg_info(rtwdev);
> + rtw_fw_recovery(rtwdev);
This still reaches USB and SDIO, and as far as I can see
__fw_recovery_work() can't run there yet. It clears the keys from an
atomic iterator:
__fw_recovery_work()
rtw_iterate_keys_atomic()
ieee80211_iter_keys_atomic() /* holds local->key_lock */
rtw_reset_key_iter()
rtw_sec_clear_cam()
rtw_write32()
On USB that write ends in usb_control_msg() and on SDIO it needs
sdio_claim_host(), so I think both sleep with the spinlock held.
78d5bf925f30 ("wifi: rtw88: iterate over vif/sta list non-atomically")
moved other iterators away from this for USB, but until now nothing
outside PCI could get to the recovery code.
Would it be ok to only call rtw_fw_recovery() on PCI for now, with a
rtw_hci_type() check? USB and SDIO never had this recovery anyway.
This can also run during a disconnect. ieee80211_set_disassoc() leaves
LPS before it removes the AP station, so if that is the third failure,
the recovery work can remove the station first and rtw_ops_sta_remove()
then removes it again. If I read it right, sta_cnt underflows and
si->mask is freed twice if a bitrate mask was set. Maybe
rtw_sta_remove() could skip a station that was already reset?
Best regards,
Luka Gejak
next prev parent reply other threads:[~2026-11-08 11:44 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-08 8:51 [PATCH v3 0/2] wifi: rtw88: firmware recovery fixes and LPS hang handling Kalpesh Solanki
2026-11-08 8:51 ` [PATCH v3 1/2] wifi: rtw88: clear RTW_FLAG_RESTARTING in rtw_ops_stop() Kalpesh Solanki
2026-11-08 11:40 ` Luka Gejak
2026-11-08 8:51 ` [PATCH v3 2/2] wifi: rtw88: ps: trigger firmware recovery only after consecutive LPS leave failures Kalpesh Solanki
2026-11-08 11:44 ` Luka Gejak [this message]
2026-11-09 2:30 ` [PATCH v3 0/2] wifi: rtw88: firmware recovery fixes and LPS hang handling Ping-Ke Shih
2026-11-09 6:03 ` Luka Gejak
2026-11-09 6:12 ` Ping-Ke Shih
2026-11-09 6:21 ` Luka Gejak
2026-11-09 6:30 ` Ping-Ke Shih
2026-11-09 6:36 ` Luka Gejak
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=da84e88e367522c239340aff5c3011d7c0642f9a@linux.dev \
--to=luka.gejak@linux.dev \
--cc=kvalo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=pkshih@realtek.com \
--cc=skalpesh942@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.