From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org,
"David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org
Subject: Re: [PATCH 1/2] mac80211: Add rcu read side critical sections
Date: Tue, 19 Sep 2017 15:35:45 +0300 [thread overview]
Message-ID: <20170919123545.GM4914@intel.com> (raw)
In-Reply-To: <1505765477.13691.20.camel@sipsolutions.net>
On Mon, Sep 18, 2017 at 10:11:17PM +0200, Johannes Berg wrote:
> > I got the following lockdep warning about the rcu_dereference()s in
> > ieee80211_tx_h_select_key(). After tracing all callers of
> > ieee80211_tx_h_select_key() I discovered that
> > ieee80211_get_buffered_bc()
> > and ieee80211_build_data_template() had the rcu_read_lock/unlock()
> > but
> > three other places did not. So I just blindly added them and made the
> > read side critical section extend as far as the lifetime of 'tx'
> > which
> > is where we seem to be stuffing the rcu protected pointers. No real
> > clue whether this is correct or not.
>
> Heh.
>
> I think we should do it in ieee80211_tx_dequeue(),
Oh, I guess I didn't trace the call chains far enough. ieee80211_tx()
does indeed look OK. But unless I made another mistake in my analysis
ieee80211_tx_prepare_skb() is still busted.
> if not even in the
> driver (and document that it's required)
>
> johannes
>
> > @@ -3411,6 +3430,8 @@ struct sk_buff *ieee80211_tx_dequeue(struct
> > ieee80211_hw *hw,
> > ieee80211_tx_result r;
> > struct ieee80211_vif *vif;
> >
> > + rcu_read_lock();
> > +
> > spin_lock_bh(&fq->lock);
> >
> > if (test_bit(IEEE80211_TXQ_STOP, &txqi->flags))
> > @@ -3513,6 +3534,8 @@ struct sk_buff *ieee80211_tx_dequeue(struct
> > ieee80211_hw *hw,
> > out:
> > spin_unlock_bh(&fq->lock);
> >
> > + rcu_read_unlock();
> >
>
> i.e. this in itself should be sufficient, though you should probably
> reorder and acquire the spinlock first since that might spin, and you
> want to keep the RCU section minimal (it's trivial here, after all)
Good point. I'll respin with that change.
--
Ville Syrjälä
Intel OTC
next prev parent reply other threads:[~2017-09-19 12:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-18 19:59 [PATCH 1/2] mac80211: Add rcu read side critical sections Ville Syrjala
2017-09-18 19:59 ` [PATCH 2/2] ath9k: Avoid a potential deadlock Ville Syrjala
2017-09-25 7:18 ` [2/2] " Kalle Valo
2017-09-18 20:11 ` [PATCH 1/2] mac80211: Add rcu read side critical sections Johannes Berg
2017-09-19 12:35 ` Ville Syrjälä [this message]
2017-09-20 10:11 ` [PATCH v2 " Ville Syrjala
[not found] ` <20170920101123.23312-1-ville.syrjala-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-09-20 10:39 ` Johannes Berg
[not found] ` <1505903964.3026.14.camel-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>
2017-09-20 12:11 ` Ville Syrjälä
[not found] ` <20170920121137.GZ4914-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-09-20 12:17 ` 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=20170919123545.GM4914@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=davem@davemloft.net \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@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).