linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Aloka Dixit <alokad@codeaurora.org>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org, John Crispin <john@phrozen.org>
Subject: Re: [PATCH v9 2/4] mac80211: add multiple bssid support to interface handling
Date: Mon, 19 Apr 2021 15:35:33 -0700	[thread overview]
Message-ID: <865a59c2dd3a07c4ee88716f51759e88@codeaurora.org> (raw)
In-Reply-To: <9ce462d7c0dc707259d8bb50ec27a189ec89ef61.camel@sipsolutions.net>

On 2021-04-19 04:28, Johannes Berg wrote:
> Hi,
> 
>> > > +	if (sdata && sdata->vif.type == NL80211_IFTYPE_AP) {
>> > > +		if (sdata->vif.multiple_bssid.flags &
>> > > IEEE80211_VIF_MBSS_TRANSMITTING) {
>> > > +			struct ieee80211_sub_if_data *child;
>> > > +
>> > > +			rcu_read_lock();
>> > > +			list_for_each_entry_rcu(child, &sdata->local->interfaces, list)
>> > > +				if (child->vif.multiple_bssid.parent == &sdata->vif)
>> > > +					dev_close(child->wdev.netdev);
>> > > +			rcu_read_unlock();
> 
>> This was added for graceful shutdown of non-transmitting interfaces
>> whenever the transmitting one is being brought down. 
>> 
> 
> I know, I asked you to.
> 
>> But I see that
>> dev_close() is happening twice now.
>> 
> 
> That wouldn't be an issue.
> 
> The issue is that dev_close() needs to be able to sleep, and it even
> contains a might_sleep(), so you can't do it under the RCU protection
> you used here.
> 
>> Inclining towards removing this and just return error to application 
>> if
>> it tries to remove transmitting before all non-transmitting are 
>> deleted.
>> However, currently the "parent" pointer to indicate the transmitting
>> interface is maintained in mac80211, nothing in cfg80211.
> 
> That seems kinda awkward, considering e.g. if hostapd crashes and then 
> a
> new instance has to clean up, it might not really have much knowledge 
> of
> the order in which it should be doing that.
> 
> I think it's better if you just fix the locking here?
> 
> johannes

Hi Johannes,
Thanks for the response, I need more help.

Is rcu_read_lock is not allowed around dev_close() because it might 
block or *ANY* lock?
Because both functions with new dev_close() themselves are called with 
locks held,
(1) ieee80211_do_stop() happens inside 
wiphy_lock(sdata->local->hw.wiphy)
(2) ieee80211_del_iface() happens inside mutex_lock(&rdev->wiphy.mtx).
Should these be unlocked temporarily too before calling dev_close()?
Didn't find any instance of wiphy.mtx lock/unlock in mac80211.

Also, in cfg.c, list_for_each_entry(sdata, &local->interfaces, list) is 
called with two different murexes: (1) local->iflist_mtx
(2) local->mtx

Which is the correct one for this purpose among above two and 
rcu_read_lock()?
Once that decided, would following be sufficient -
     lock()
     list_for_each_entry(sdata, &local->interfaces, list) {
         get_child_pointer
         unlock()
         dev_close()
         lock()
     }
     unlock

Thanks.

  reply	other threads:[~2021-04-19 22:35 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-10 18:26 [PATCH v9 0/4] Multiple BSSID support Aloka Dixit
2021-03-10 18:26 ` [PATCH v9 1/4] nl80211: add basic multiple bssid support Aloka Dixit
2021-04-08 12:05   ` Johannes Berg
2021-04-08 17:09     ` Aloka Dixit
2021-03-10 18:26 ` [PATCH v9 2/4] mac80211: add multiple bssid support to interface handling Aloka Dixit
2021-04-08 12:06   ` Johannes Berg
2021-04-16 21:35     ` Aloka Dixit
2021-04-19 11:28       ` Johannes Berg
2021-04-19 22:35         ` Aloka Dixit [this message]
2021-04-19 22:42           ` Aloka Dixit
2021-04-20  8:25           ` Johannes Berg
2021-03-10 18:26 ` [PATCH v9 3/4] mac80211: add multiple bssid/EMA support to beacon handling Aloka Dixit
2021-04-08 12:11   ` Johannes Berg
2021-04-08 17:16     ` Aloka Dixit
2021-03-10 18:26 ` [PATCH v9 4/4] mac80211: CSA on non-transmitting interfaces Aloka Dixit
2021-04-08 11:53 ` [PATCH v9 0/4] Multiple BSSID support Johannes Berg
2021-04-09 18:05   ` Aloka Dixit
2021-04-08 12:17 ` Johannes Berg
2021-04-09 18:31   ` Aloka Dixit
2021-04-09 19:28     ` 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=865a59c2dd3a07c4ee88716f51759e88@codeaurora.org \
    --to=alokad@codeaurora.org \
    --cc=johannes@sipsolutions.net \
    --cc=john@phrozen.org \
    --cc=linux-wireless@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).