linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: madhuparnabhowmik10@gmail.com, davem@davemloft.net, kuba@kernel.org
Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, frextrite@gmail.com,
	joel@joelfernandes.org, paulmck@kernel.org,
	linux-kernel-mentees@lists.linuxfoundation.org
Subject: Re: [PATCH 1/4] net: mac80211: util.c: Fix RCU list usage warnings
Date: Fri, 24 Apr 2020 11:18:59 +0200	[thread overview]
Message-ID: <89476ee074e782175d453038396543f193f8e5fd.camel@sipsolutions.net> (raw)
In-Reply-To: <20200409082822.27314-1-madhuparnabhowmik10@gmail.com> (sfid-20200409_102851_270381_8F58A5E1)

Hi,

> This patch fixes the following warning (CONIG_PROVE_RCU_LIST)
> in ieee80211_check_combinations().

Thanks, and sorry for the delay.


> +++ b/net/mac80211/util.c
> @@ -254,7 +254,7 @@ static void __ieee80211_wake_txqs(struct ieee80211_sub_if_data *sdata, int ac)
>  
>  	sdata->vif.txqs_stopped[ac] = false;
>  
> -	list_for_each_entry_rcu(sta, &local->sta_list, list) {
> +	list_for_each_entry(sta, &local->sta_list, list) {
>  		if (sdata != sta->sdata)
>  			continue;

In this case, for example, I don't even understand why the warning would
happen, because certainly the only caller of this (_ieee80211_wake_txqs)
does rcu_read_lock()?

I'm also not convinced that the necessary lock is actually held here,
this comes from a tasklet that doesn't hold any locks?
 
I'd appreciate if you could add comments/explain why you think the
changes were right, or ideally even add "lockdep_assert_held()"
annotations. That would make it much easier to check this patch.

> @@ -3931,7 +3932,7 @@ int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata,
>  		params.num_different_channels++;
>  	}
>  
> -	list_for_each_entry_rcu(sdata_iter, &local->interfaces, list) {
> +	list_for_each_entry(sdata_iter, &local->interfaces, list) {
>  		struct wireless_dev *wdev_iter;
>  
>  		wdev_iter = &sdata_iter->wdev;
> @@ -3982,7 +3983,7 @@ int ieee80211_max_num_channels(struct ieee80211_local *local)
>  			ieee80211_chanctx_radar_detect(local, ctx);
>  	}
>  
> -	list_for_each_entry_rcu(sdata, &local->interfaces, list)
> +	list_for_each_entry(sdata, &local->interfaces, list)
>  		params.iftype_num[sdata->wdev.iftype]++;

These changes correct, as far as I can tell, in that they rely on the
RTNL now - but can you perhaps document that as well?

There doesn't seem to be any multi-lock version of lockdep_assert_held()
or is there? That'd be _really_ useful here, because I want to get rid
of some RTNL reliance in the longer term, and having annotation here
saying "either RTNL or iflist_mtx is fine" would be good.

johannes


      reply	other threads:[~2020-04-24  9:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-09  8:28 [PATCH 1/4] net: mac80211: util.c: Fix RCU list usage warnings madhuparnabhowmik10
2020-04-24  9:18 ` Johannes Berg [this message]

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=89476ee074e782175d453038396543f193f8e5fd.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=davem@davemloft.net \
    --cc=frextrite@gmail.com \
    --cc=joel@joelfernandes.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=madhuparnabhowmik10@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=paulmck@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).