From: Ping-Ke Shih <pkshih@realtek.com>
To: "martin.blumenstingl@googlemail.com"
<martin.blumenstingl@googlemail.com>,
"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Cc: "kvalo@kernel.org" <kvalo@kernel.org>,
"s.hauer@pengutronix.de" <s.hauer@pengutronix.de>,
"tony0620emma@gmail.com" <tony0620emma@gmail.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/4] rtw88: Configure the registers from rtw_bf_assoc() outside the RCU lock
Date: Thu, 29 Dec 2022 23:48:28 +0000 [thread overview]
Message-ID: <70d276b911fbf3d77baf2fbd7d5a8716a01f6c2a.camel@realtek.com> (raw)
In-Reply-To: <20221229124845.1155429-3-martin.blumenstingl@googlemail.com>
On Thu, 2022-12-29 at 13:48 +0100, Martin Blumenstingl wrote:
> USB and (upcoming) SDIO support may sleep in the read/write handlers.
> Shrink the RCU critical section so it only cover the call to
> ieee80211_find_sta() and finding the ic_vht_cap/vht_cap based on the
> found station. This moves the chip's BFEE configuration outside the
> rcu_read_lock section and thus prevent "scheduling while atomic" or
> "Voluntary context switch within RCU read-side critical section!"
> warnings when accessing the registers using an SDIO card (which is
> where this issue has been spotted in the real world - but it also
> affects USB cards).
>
> Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
I think my reviewed-by should behind your signed-off-by.
> ---
> drivers/net/wireless/realtek/rtw88/bf.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/wireless/realtek/rtw88/bf.c b/drivers/net/wireless/realtek/rtw88/bf.c
> index 038a30b170ef..c827c4a2814b 100644
> --- a/drivers/net/wireless/realtek/rtw88/bf.c
> +++ b/drivers/net/wireless/realtek/rtw88/bf.c
> @@ -49,19 +49,23 @@ void rtw_bf_assoc(struct rtw_dev *rtwdev, struct ieee80211_vif *vif,
>
> sta = ieee80211_find_sta(vif, bssid);
> if (!sta) {
> + rcu_read_unlock();
> +
> rtw_warn(rtwdev, "failed to find station entry for bss %pM\n",
> bssid);
> - goto out_unlock;
> + return;
> }
>
> ic_vht_cap = &hw->wiphy->bands[NL80211_BAND_5GHZ]->vht_cap;
> vht_cap = &sta->deflink.vht_cap;
>
> + rcu_read_unlock();
> +
> if ((ic_vht_cap->cap & IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE) &&
> (vht_cap->cap & IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE)) {
> if (bfinfo->bfer_mu_cnt >= chip->bfer_mu_max_num) {
> rtw_dbg(rtwdev, RTW_DBG_BF, "mu bfer number over limit\n");
> - goto out_unlock;
> + return;
> }
>
> ether_addr_copy(bfee->mac_addr, bssid);
> @@ -75,7 +79,7 @@ void rtw_bf_assoc(struct rtw_dev *rtwdev, struct ieee80211_vif *vif,
> (vht_cap->cap & IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE)) {
> if (bfinfo->bfer_su_cnt >= chip->bfer_su_max_num) {
> rtw_dbg(rtwdev, RTW_DBG_BF, "su bfer number over limit\n");
> - goto out_unlock;
> + return;
> }
>
> sound_dim = vht_cap->cap &
> @@ -98,9 +102,6 @@ void rtw_bf_assoc(struct rtw_dev *rtwdev, struct ieee80211_vif *vif,
>
> rtw_chip_config_bfee(rtwdev, rtwvif, bfee, true);
> }
> -
> -out_unlock:
> - rcu_read_unlock();
> }
>
> void rtw_bf_init_bfer_entry_mu(struct rtw_dev *rtwdev,
next prev parent reply other threads:[~2022-12-29 23:48 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-29 12:48 [PATCH 0/4] rtw88: Four fixes found while working on SDIO support Martin Blumenstingl
2022-12-29 12:48 ` [PATCH 1/4] rtw88: Add packed attribute to the eFuse structs Martin Blumenstingl
2022-12-29 23:47 ` Ping-Ke Shih
2022-12-29 12:48 ` [PATCH 2/4] rtw88: Configure the registers from rtw_bf_assoc() outside the RCU lock Martin Blumenstingl
2022-12-29 23:48 ` Ping-Ke Shih [this message]
2023-01-04 15:43 ` Martin Blumenstingl
2023-01-05 0:44 ` Ping-Ke Shih
2022-12-29 12:48 ` [PATCH 3/4] rtw88: Use rtw_iterate_vifs() for rtw_vif_watch_dog_iter() Martin Blumenstingl
2022-12-29 12:48 ` [PATCH 4/4] rtw88: Use non-atomic rtw_iterate_stas() in rtw_ra_mask_info_update() Martin Blumenstingl
2022-12-29 17:41 ` [PATCH 0/4] rtw88: Four fixes found while working on SDIO support Larry Finger
2022-12-29 20:11 ` Martin Blumenstingl
2023-01-04 13:22 ` Sascha Hauer
2023-01-07 18:23 ` gert erkelens
2023-01-08 19:26 ` Martin Blumenstingl
2023-01-09 0:55 ` Ping-Ke Shih
-- strict thread matches above, loose matches on Subject: below --
2022-12-28 13:35 Martin Blumenstingl
2022-12-28 13:35 ` [PATCH 2/4] rtw88: Configure the registers from rtw_bf_assoc() outside the RCU lock Martin Blumenstingl
2022-12-29 9:37 ` Ping-Ke Shih
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=70d276b911fbf3d77baf2fbd7d5a8716a01f6c2a.camel@realtek.com \
--to=pkshih@realtek.com \
--cc=kvalo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=martin.blumenstingl@googlemail.com \
--cc=netdev@vger.kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=tony0620emma@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 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®