From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
Johannes Berg <johannes@sipsolutions.net>,
Mohammed Shafi <shafi.wireless@gmail.com>,
wireless <linux-wireless@vger.kernel.org>
Subject: Re: Suspicious RCU usage in mac80211
Date: Thu, 3 May 2012 11:22:31 -0700 [thread overview]
Message-ID: <20120503182231.GL2592@linux.vnet.ibm.com> (raw)
In-Reply-To: <4FA2C45A.3010001@lwfinger.net>
On Thu, May 03, 2012 at 12:46:02PM -0500, Larry Finger wrote:
> On 05/03/2012 12:12 PM, Paul E. McKenney wrote:
> >On Thu, May 03, 2012 at 11:54:29AM -0500, Larry Finger wrote:
> >>On 05/03/2012 03:47 AM, Catalin Marinas wrote:
> >>>
> >>>IIUC, Paul suggested that you should use rcu_dereference_check() here
> >>>instead as the protected one is not safe in this context.
> >>
> >>This patch also fails to fix the problem. Did I do what Paul suggested?
> >
> >That is indeed what I suggested!
> >
> >What locks does lockdep say are held?
>
> It varies from instance to instance. I have seen 1, 2, or 3. Those
> are the following:
>
> #0: (scan_mutex){+.+...}, at: [<ffffffff8113b0d6>] kmemleak_scan_thread+0x56/0xd0
> #1: (&tid_tx->session_timer){+.-...}, at: [<ffffffff8104853a>]
> run_timer_softirq+0xfa/0x6e0
> #2: (rcu_read_lock){.+.+..}, at: [<ffffffffa03c1ff0>]
> sta_tx_agg_session_timer_expired+0x0/0x2a0 [mac80211]
>
>
> When only 1 lock is held, it is "&tid_tx->session_timer", and that
> one is held in every case. I think that means we need to OR it with
> the other lockdep_is_held() arguments in the rcu_dereference_xxxxx()
> call, but I did not seem to get the syntax right.
If any one of several locks (call them a, b, and c) is sufficient to
protect the data, and if an rcu_read_lock() also suffices, then something
like the following would work:
return rcu_dereference_check(sta->ampdu_mlme.tid_tx[tid],
lockdep_is_held(&a) ||
lockdep_is_held(&b) ||
lockdep_is_held(&c));
But I must defer to the developers and maintainers of that code
as to exactly which combinations of locks and RCU are required.
The rcu_read_lock_held() is supplied by rcu_dereference_check(), so I
am surprised that you got a splat that included rcu_read_lock.
Thanx, Paul
next prev parent reply other threads:[~2012-05-03 18:23 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-10 3:19 Suspicious RCU usage in mac80211 Larry Finger
2012-04-12 3:31 ` Johannes Berg
2012-04-12 3:51 ` Larry Finger
2012-04-12 3:54 ` Johannes Berg
2012-04-12 15:51 ` Larry Finger
2012-04-12 15:55 ` Johannes Berg
2012-05-01 14:25 ` Mohammed Shafi
2012-05-01 19:18 ` Larry Finger
2012-05-02 5:02 ` Mohammed Shafi
2012-05-02 10:00 ` Catalin Marinas
2012-05-02 17:07 ` Johannes Berg
2012-05-02 20:09 ` Paul E. McKenney
2012-05-03 18:38 ` Johannes Berg
2012-05-04 6:17 ` Larry Finger
2012-05-04 6:40 ` Mohammed Shafi
2012-05-04 6:48 ` Mohammed Shafi
2012-05-04 13:45 ` Larry Finger
2012-05-04 14:35 ` Mohammed Shafi
2012-05-03 3:02 ` Larry Finger
2012-05-03 8:47 ` Catalin Marinas
2012-05-03 16:54 ` Larry Finger
2012-05-03 17:12 ` Paul E. McKenney
2012-05-03 17:46 ` Larry Finger
2012-05-03 18:22 ` Paul E. McKenney [this message]
2012-05-03 18:32 ` Larry Finger
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=20120503182231.GL2592@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=Larry.Finger@lwfinger.net \
--cc=catalin.marinas@arm.com \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=shafi.wireless@gmail.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;
as well as URLs for NNTP newsgroup(s).