Re: [ath9k-devel] [PATCH] mac80211: Use RCU protection in ieee80211_get_tx_rates()
On Wednesday 06/12 at 11:47 +0200, Felix Fietkau wrote: On 2013-06-12 10:00 AM, Calvin Owens wrote: Copying the rate table should be done in an RCU read-side critical section. I think this approach is wrong. The sta entry is also under RCU protection (no locking for read access in that part of the code. In a normal driver tx path, no extra rcu_read_lock/rcu_read_unlock is needed. Only if the driver does some scheduling outside of the tx function (which ath9k does), this RCU warning appears. How about this change instead: --- --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c @@ -1570,6 +1570,8 @@ void ath_txq_schedule(struct ath_softc * txq-axq_ampdu_depth = ATH_AGGR_MIN_QDEPTH) return; + rcu_read_lock(); + ac = list_first_entry(txq-axq_acq, struct ath_atx_ac, list); last_ac = list_entry(txq-axq_acq.prev, struct ath_atx_ac, list); @@ -1608,8 +1610,10 @@ void ath_txq_schedule(struct ath_softc * if (ac == last_ac || txq-axq_ampdu_depth = ATH_AGGR_MIN_QDEPTH) - return; + break; } + + rcu_read_unlock(); } /***/ Yep, that stops the RCU warning for me. Tested-by: Calvin Owens jcalvinow...@gmail.com ___ ath9k-devel mailing list ath9k-devel@lists.ath9k.org https://lists.ath9k.org/mailman/listinfo/ath9k-devel
[ath9k-devel] [PATCH] mac80211: Use RCU protection in ieee80211_get_tx_rates()
Copying the rate table should be done in an RCU read-side critical section. Signed-off-by: Calvin Owens jcalvinow...@gmail.com --- net/mac80211/rate.c | 4 1 file changed, 4 insertions(+) diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c index d3f414f..090d9b0 100644 --- a/net/mac80211/rate.c +++ b/net/mac80211/rate.c @@ -538,6 +538,8 @@ static void rate_control_fill_sta_table(struct ieee80211_sta *sta, struct ieee80211_sta_rates *ratetbl = NULL; int i; + rcu_read_lock(); + if (sta !info-control.skip_table) ratetbl = rcu_dereference(sta-rates); @@ -566,6 +568,8 @@ static void rate_control_fill_sta_table(struct ieee80211_sta *sta, if (rates[i].idx 0 || !rates[i].count) break; } + + rcu_read_unlock(); } static void rate_control_apply_mask(struct ieee80211_sub_if_data *sdata, -- 1.8.2.1 ___ ath9k-devel mailing list ath9k-devel@lists.ath9k.org https://lists.ath9k.org/mailman/listinfo/ath9k-devel
Re: [ath9k-devel] [PATCH] mac80211: Use RCU protection in ieee80211_get_tx_rates()
On 2013-06-12 10:00 AM, Calvin Owens wrote: Copying the rate table should be done in an RCU read-side critical section. I think this approach is wrong. The sta entry is also under RCU protection (no locking for read access in that part of the code. In a normal driver tx path, no extra rcu_read_lock/rcu_read_unlock is needed. Only if the driver does some scheduling outside of the tx function (which ath9k does), this RCU warning appears. How about this change instead: --- --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c @@ -1570,6 +1570,8 @@ void ath_txq_schedule(struct ath_softc * txq-axq_ampdu_depth = ATH_AGGR_MIN_QDEPTH) return; + rcu_read_lock(); + ac = list_first_entry(txq-axq_acq, struct ath_atx_ac, list); last_ac = list_entry(txq-axq_acq.prev, struct ath_atx_ac, list); @@ -1608,8 +1610,10 @@ void ath_txq_schedule(struct ath_softc * if (ac == last_ac || txq-axq_ampdu_depth = ATH_AGGR_MIN_QDEPTH) - return; + break; } + + rcu_read_unlock(); } /***/ ___ ath9k-devel mailing list ath9k-devel@lists.ath9k.org https://lists.ath9k.org/mailman/listinfo/ath9k-devel