public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: reinette chatre <reinette.chatre@intel.com>
Cc: linux-wireless@vger.kernel.org,
	"Luis R. Rodriguez" <lrodriguez@atheros.com>
Subject: Re: new lockdep warning in 2.6.31-rc3-wl
Date: Sat, 25 Jul 2009 11:13:51 +0200	[thread overview]
Message-ID: <1248513231.32151.60.camel@johannes.local> (raw)
In-Reply-To: <1248461132.1216.53.camel@rc-desk>

[-- Attachment #1: Type: text/plain, Size: 2351 bytes --]

Reinette, Luis,

It's easy to see why this is happening, but I have no easy fix.

> [   65.053694] phy0/3223 is trying to acquire lock:
> [   65.053738]  (cfg80211_mutex){+.+.+.}, at: [<ffffffffa01c9a72>] regulatory_hint_11d+0x32/0x430 [cfg80211]
> [   65.053887] 
> [   65.053888] but task is already holding lock:
> [   65.053968]  (&ifmgd->mtx){+.+.+.}, at: [<ffffffffa0220f78>] ieee80211_sta_work+0x118/0x11c0 [mac80211]

Clearly, ifmgd->mtx has to be taken from a bunch of cfg80211 calls, but 
all calls from cfg80211 into mac80211 hold the cfg80211_mutex.

Now the problem here is that regulatory_hint_11d takes the
cfg80211_mutex.

I looked at two possible solutions:

1) Remove the requirement to hold cfg80211_mutex in cfg80211 for this
   function. This is my preferred solution, since I don't think a hint
   function should have strange locking constraints. However, the
   function accesses a whole bunch of global variables and right now I
   don't see how to reduce that, except possibly by allocating and
   queueing new work struct, but then I don't see how to cancel that
   work struct when the wiphy is unregistered while it might be pending.

2) Move the regulatory_hint_11d call outside the ifmgd->mtx locked
   section. This isn't nice, as it means we require more effort from the
   callers. Also, I think it's not sufficient, because mac80211 has to
   cancel_work_sync() the sta work, which would be calling this, when an
   interface is taken down --- BUT taking down an interface can happen,
   when it's simply removed with nl80211 (!), within cfg80211 context,
   and as such again under the lock, which has the same problem.

3) Remove the regulatory_hint_11d function (or rather make it not
   exported), and instead pass the country IE (or the whole beacon
   frame) to regulatory_hint_found_beacon(), and process it all from the
   regulatory work that hint_found_beacon queues. That also reduces the
   number of entry points from drivers, and means that if the driver
   uses cfg80211-based scanning, it also automatically takes part in the
   regulatory infrastructure. Win.

Obviously 3) is my favourite solution, not only because it's the only
one that seems feasible at all, but it's somewhat more complex, and I
don't really have time to do that today.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

  reply	other threads:[~2009-07-25  9:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-24 18:45 new lockdep warning in 2.6.31-rc3-wl reinette chatre
2009-07-25  9:13 ` Johannes Berg [this message]
2009-07-25 19:21   ` Luis R. Rodriguez
2009-07-26  6:21     ` Johannes Berg

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=1248513231.32151.60.camel@johannes.local \
    --to=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lrodriguez@atheros.com \
    --cc=reinette.chatre@intel.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