Date: Fri, 27 Jul 2012 12:21:39 -0700 From: Adrian Chadd <adrian.chadd@gmail.com> To: Kim Culhan <w8hdkim@gmail.com> Cc: freebsd-wireless@freebsd.org Subject: Re: ath lor Message-ID: <CAJ-Vmo=ynY_kFxa4id2wu3h5C1OSarOzVJ32G3avFDWHg1dybQ@mail.gmail.com> In-Reply-To: <CAJ-VmomuBC0CFTkDRh8gRVAb080rc8upTif4KDAkeiG5imcoqw@mail.gmail.com> References: <CAKZxVQUcuk=Bw0rBkOLmy1ie%2BZYqn5uNkEndW_sEOH5u-Ef04w@mail.gmail.com> <CAJ-VmomuBC0CFTkDRh8gRVAb080rc8upTif4KDAkeiG5imcoqw@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Ok, hm. I wonder if the "correct" thing to do here is to ensure the comlock is NOT held when iterating through nodes. I don't know if net80211 ever had the lock hierarchy defined/designed in any detail. So it's either: * ieee80211_iterate_nodes() shouldn't be called with the comlock/nodelock/node iterate lock held; * ieee80211_iterate_nodes() must always be called with the comlock held. I bet it's the former. The latter is too scary. :-) I'll add a lock witness check on a local device and get a backtrace. If you'd like to immediately crash your device, you could do the same. If you're feeling very brave and immediately crash-y, try: Index: sys/net80211/ieee80211_node.c =================================================================== --- sys/net80211/ieee80211_node.c (revision 238389) +++ sys/net80211/ieee80211_node.c (working copy) @@ -2163,6 +2163,12 @@ struct ieee80211_node *ni; u_int gen; + /* + * To avoid LORs, ic must not be held here as the + * called function may acquire ic. + */ + IEEE80211_UNLOCK_ASSERT(nt->nt_ic); + IEEE80211_NODE_ITERATE_LOCK(nt); gen = ++nt->nt_scangen; restart: Index: sys/net80211/ieee80211_freebsd.h =================================================================== --- sys/net80211/ieee80211_freebsd.h (revision 238389) +++ sys/net80211/ieee80211_freebsd.h (working copy) @@ -53,6 +53,8 @@ #define IEEE80211_UNLOCK(_ic) mtx_unlock(IEEE80211_LOCK_OBJ(_ic)) #define IEEE80211_LOCK_ASSERT(_ic) \ mtx_assert(IEEE80211_LOCK_OBJ(_ic), MA_OWNED) +#define IEEE80211_UNLOCK_ASSERT(_ic) \ + mtx_assert(IEEE80211_LOCK_OBJ(_ic), MA_NOTOWNED) /* * Node locking definitions. Adrian
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-Vmo=ynY_kFxa4id2wu3h5C1OSarOzVJ32G3avFDWHg1dybQ>