From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
To: Pkshih <pkshih@realtek.com>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
"tony0620emma@gmail.com" <tony0620emma@gmail.com>,
"kvalo@codeaurora.org" <kvalo@codeaurora.org>,
"johannes@sipsolutions.net" <johannes@sipsolutions.net>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Neo Jou <neojou@gmail.com>,
Jernej Skrabec <jernej.skrabec@gmail.com>
Subject: Re: [PATCH RFC v1 5/7] rtw88: Configure the registers from rtw_bf_assoc() outside the RCU lock
Date: Sun, 25 Jul 2021 23:36:13 +0200 [thread overview]
Message-ID: <CAFBinCAJNqbpoqSSFYYBJg818KHCKx5nFzsKZdR=D+sTXQj6dg@mail.gmail.com> (raw)
In-Reply-To: <1a299cd8c1be4fba8360780ef6f70f0f@realtek.com>
Hi Ping-Ke,
On Mon, Jul 19, 2021 at 7:47 AM Pkshih <pkshih@realtek.com> wrote:
[...]
> The rcu_read_lock() in this function is used to access ieee80211_find_sta() and protect 'sta'.
> A simple way is to shrink the critical section, like:
>
> rcu_read_lock();
>
> sta = ieee80211_find_sta(vif, bssid);
> if (!sta) {
> rtw_warn(rtwdev, "failed to find station entry for bss %pM\n",
> bssid);
> rcu_read_unlock();
> }
>
> vht_cap = &sta->vht_cap;
>
> rcu_read_unlock();
I agree that reducing the amount of code under the lock will help my
use-case as well
in your code-example I am wondering if we should change
struct ieee80211_sta_vht_cap *vht_cap;
vht_cap = &sta->vht_cap;
to
struct ieee80211_sta_vht_cap vht_cap;
vht_cap = sta->vht_cap;
My thinking is that ieee80211_sta may be freed in parallel to this code running.
If that cannot happen then your code will be fine.
So I am hoping that you can also share your thoughts on this one.
Thank you and best regards,
Martin
next prev parent reply other threads:[~2021-07-25 21:36 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-17 20:40 [PATCH RFC v1 0/7] rtw88: prepare locking for SDIO support Martin Blumenstingl
2021-07-17 20:40 ` [PATCH RFC v1 1/7] mac80211: Add stations iterator where the iterator function may sleep Martin Blumenstingl
2021-07-19 5:46 ` Pkshih
2021-07-19 6:30 ` Johannes Berg
2021-07-17 20:40 ` [PATCH RFC v1 2/7] rtw88: Use rtw_iterate_vifs where the iterator reads or writes registers Martin Blumenstingl
2021-07-19 5:47 ` Pkshih
2021-07-25 21:31 ` Martin Blumenstingl
2021-07-26 7:22 ` Pkshih
2021-07-17 20:40 ` [PATCH RFC v1 3/7] rtw88: Use rtw_iterate_stas " Martin Blumenstingl
2021-07-19 6:36 ` Johannes Berg
2021-07-25 21:51 ` Martin Blumenstingl
2021-07-26 7:22 ` Pkshih
2021-08-09 20:00 ` Johannes Berg
2021-07-17 20:40 ` [PATCH RFC v1 4/7] rtw88: Replace usage of rtw_iterate_keys_rcu() with rtw_iterate_keys() Martin Blumenstingl
2021-07-17 20:40 ` [PATCH RFC v1 5/7] rtw88: Configure the registers from rtw_bf_assoc() outside the RCU lock Martin Blumenstingl
2021-07-19 5:47 ` Pkshih
2021-07-25 21:36 ` Martin Blumenstingl [this message]
2021-07-26 7:22 ` Pkshih
2021-07-17 20:40 ` [PATCH RFC v1 6/7] rtw88: hci: Convert rf_lock from a spinlock to a mutex Martin Blumenstingl
2021-07-17 20:40 ` [PATCH RFC v1 7/7] rtw88: fw: Convert h2c.lock " Martin Blumenstingl
2021-07-19 5:52 ` [PATCH RFC v1 0/7] rtw88: prepare locking for SDIO support Pkshih
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='CAFBinCAJNqbpoqSSFYYBJg818KHCKx5nFzsKZdR=D+sTXQj6dg@mail.gmail.com' \
--to=martin.blumenstingl@googlemail.com \
--cc=jernej.skrabec@gmail.com \
--cc=johannes@sipsolutions.net \
--cc=kvalo@codeaurora.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=neojou@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pkshih@realtek.com \
--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;
as well as URLs for NNTP newsgroup(s).