Thread (21 messages) 21 messages, 3 authors, 2021-08-09

Re: [PATCH RFC v1 5/7] rtw88: Configure the registers from rtw_bf_assoc() outside the RCU lock

From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Date: 2021-07-25 21:36:28
Also in: lkml, netdev

Hi Ping-Ke,

On Mon, Jul 19, 2021 at 7:47 AM Pkshih [off-list ref] 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help