From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Milton Miller <miltonm@bga.com>, Ingo Molnar <mingo@elte.hu>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Thomas Gleixner <tglx@linutronix.de>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [1/4] rcu: Detect uses of rcu read side in extended quiescent states
Date: Tue, 7 Jun 2011 12:22:25 -0700 [thread overview]
Message-ID: <20110607192225.GG2286@linux.vnet.ibm.com> (raw)
In-Reply-To: <20110607184857.GC23214@somewhere>
On Tue, Jun 07, 2011 at 08:49:01PM +0200, Frederic Weisbecker wrote:
> On Tue, Jun 07, 2011 at 11:34:14AM -0700, Paul E. McKenney wrote:
> > On Tue, Jun 07, 2011 at 02:58:13PM +0200, Frederic Weisbecker wrote:
> > > On Mon, Jun 06, 2011 at 09:40:05PM -0700, Paul E. McKenney wrote:>
> > > > The bit I am missing is how to distinguish between spinlocks (where
> > > > sleeping is illegal) and mutexes (where sleeping is perfectly fine).
> > > > We could teach lockdep the difference, I suppose, but it is not clear
> > > > to me that it is worth it.
> > >
> > > Ah, in fact it doesn't pass through any lockdep check.
> > >
> > > It's only a function called might_sleep() that is placed in functions
> > > that can sleep. And inside might_sleep() it checks whether it is in a preemptible
> > > area. So it's actually locking-agnostic, it only relies on the preempt_count
> > > and some more for the preempt rcu cases.
> > >
> > > I think it is called CONFIG_DEBUG_SPINLOCK_SLEEP because it was first used
> > > for spinlock debugging purposes. But then it has a broader use now: sleep
> > > inside preemptible section, sleep inside interrupts, sleep inside rcu.
> >
> > But the __might_sleep() function can only differentiate between
> > spinlocks and sleeplocks if CONFIG_PREEMPT=y.
>
> It doesn't differentiate between locks but checks on the lowest level
> by looking at the preempt count. But yeah it only works if CONFIG_PREEMPT,
> which is why I proposed to inc/dec the preempt count also when we have
> that DEBUG_SPINLOCK_SLEEP.
Ah, I missed your proposal to inc/dec preempt_count for PREEMPT=n
and DEBUG_SPINLOCK_SLEEP=y.
> > > It certainly deserves a rename, like CONFIG_DEBUG_ILLEGAL_SLEEP.
> >
> > Hmmm... It already checks for sleeping in the middle of a
> > preempt_disable() as well as in a spinlock critical section.
> > So the need for a rename is independent of any RCU checking.
>
> Sure, rcu just adds itself to the pile of users of might_sleep(), thus
> it would be a nice cleanup to rename the option to something more
> generic. But that rename is not necessary to improve RCU checking.
Agreed!
> > > > In contrast, with RCU, this is straightforward -- check for rcu_sched
> > > > and rcu_bh, but not SRCU.
> >
> > Actually it makes sense to keep the checks in rcu_note_context_switch(),
> > as there are places that call schedule() directly without a might_sleep().
> > Perhaps having checks in both places is the correct approach?
>
> In this case it makes more sense to add your checks in schedule_debug(),
> so that we don't wait for a context switch to detect the bug.
You might well be right -- looking at it.
Thanx, Paul
next prev parent reply other threads:[~2011-06-07 19:23 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-06 3:10 [PATCH 0/4] rcu: Detect rcu uses under extended quiescent state, and fix some Frederic Weisbecker
2011-06-06 3:10 ` Frederic Weisbecker
2011-06-06 3:10 ` [PATCH 1/4] rcu: Detect uses of rcu read side in extended quiescent states Frederic Weisbecker
2011-06-06 3:44 ` [1/4] " Milton Miller
2011-06-06 18:10 ` Paul E. McKenney
2011-06-06 18:20 ` Frederic Weisbecker
2011-06-06 18:37 ` Paul E. McKenney
2011-06-07 0:19 ` Frederic Weisbecker
2011-06-07 0:42 ` Paul E. McKenney
2011-06-07 1:36 ` Frederic Weisbecker
2011-06-07 4:40 ` Paul E. McKenney
2011-06-07 12:58 ` Frederic Weisbecker
2011-06-07 18:34 ` Paul E. McKenney
2011-06-07 18:49 ` Frederic Weisbecker
2011-06-07 19:22 ` Paul E. McKenney [this message]
2011-06-10 8:58 ` Michel Lespinasse
2011-06-06 3:10 ` [PATCH 2/4] nohz: Split extended quiescent state handling from nohz switch Frederic Weisbecker
2011-06-06 3:20 ` [PATCH 2/4 v2] " Frederic Weisbecker
2011-06-06 3:20 ` [PATCH 2/4] " Frederic Weisbecker
2011-06-08 1:15 ` Guan Xuetao
2011-06-06 15:16 ` [PATCH 2/4 v2] " Hans-Christian Egtvedt
2011-06-06 15:24 ` Ralf Baechle
2011-06-06 18:43 ` Mike Frysinger
2011-06-06 20:30 ` Chris Metcalf
2011-06-06 3:58 ` [PATCH 2/4] " David Miller
2011-06-09 23:08 ` Frederic Weisbecker
2011-06-06 3:10 ` [PATCH 3/4] x86: Don't call idle notifier inside rcu extended QS Frederic Weisbecker
2011-06-06 3:10 ` [PATCH 4/4] x86: Call idle_exit() after irq_enter() Frederic Weisbecker
2011-06-06 18:12 ` [PATCH 0/4] rcu: Detect rcu uses under extended quiescent state, and fix some Paul E. McKenney
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=20110607192225.GG2286@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=a.p.zijlstra@chello.nl \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=miltonm@bga.com \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
/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).