linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mac80211: clean up mesh RCU warning
@ 2013-05-02 23:11 Thomas Pedersen
  2013-05-03  6:41 ` Johannes Berg
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Pedersen @ 2013-05-02 23:11 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wirelss, Thomas Pedersen

When running a kernel with CONFIG_PROVE_RCU, the minstrel
rate update code would complain about being called without
the RCU read lock held. This is because
mesh_sta_info_init() may or may not have been called under
RCU read lock. Perform some bureaucratic critical section
toggling to always call mesh_sta_info_init() under RCU,
and silence this warning.

Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
---
 net/mac80211/mesh_plink.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c
index 09bebed..4058bd7 100644
--- a/net/mac80211/mesh_plink.c
+++ b/net/mac80211/mesh_plink.c
@@ -473,13 +473,15 @@ mesh_sta_info_get(struct ieee80211_sub_if_data *sdata,
 		rcu_read_unlock();
 		/* can't run atomic */
 		sta = mesh_sta_info_alloc(sdata, addr, elems);
-		if (!sta) {
-			rcu_read_lock();
+
+		rcu_read_lock();
+		if (!sta)
 			return NULL;
-		}
 
 		mesh_sta_info_init(sdata, sta, elems, true);
 
+		rcu_read_unlock();
+		/* also might sleep */
 		if (sta_info_insert_rcu(sta))
 			return NULL;
 	}
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mac80211: clean up mesh RCU warning
  2013-05-02 23:11 [PATCH] mac80211: clean up mesh RCU warning Thomas Pedersen
@ 2013-05-03  6:41 ` Johannes Berg
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2013-05-03  6:41 UTC (permalink / raw)
  To: Thomas Pedersen; +Cc: linux-wirelss, Felix Fietkau

On Thu, 2013-05-02 at 16:11 -0700, Thomas Pedersen wrote:
> When running a kernel with CONFIG_PROVE_RCU, the minstrel
> rate update code would complain about being called without
> the RCU read lock held. This is because
> mesh_sta_info_init() may or may not have been called under
> RCU read lock. Perform some bureaucratic critical section
> toggling to always call mesh_sta_info_init() under RCU,
> and silence this warning.

This was discussed in another thread a while ago, but unfortunately
nothing came out of it. I really don't think this is the right solution,
since the code that this calls doesn't even use rcu_dereference()
properly.

Felix, please come up with a proper fix soon, otherwise I'm going to
revert your changes for 3.10.

johannes


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-05-03  6:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-02 23:11 [PATCH] mac80211: clean up mesh RCU warning Thomas Pedersen
2013-05-03  6:41 ` Johannes Berg

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).