From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@elte.hu>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Thomas Gleixner <tglx@linutronix.de>,
Lai Jiangshan <laijs@cn.fujitsu.com>
Subject: Re: [PATCH 02/11] rcu: Inform the user about extended quiescent state on PROVE_RCU warning
Date: Fri, 7 Oct 2011 15:47:44 -0700 [thread overview]
Message-ID: <20111007224744.GH2696@linux.vnet.ibm.com> (raw)
In-Reply-To: <1318004530-705-3-git-send-email-fweisbec@gmail.com>
On Fri, Oct 07, 2011 at 06:22:01PM +0200, Frederic Weisbecker wrote:
> Inform the user if an RCU usage error is detected by lockdep while in
> an extended quiescent state (in this case, the RCU-free window in idle).
> This is accomplished by adding a line to the RCU lockdep splat indicating
> whether or not the splat occurred in extended quiescent state.
>
> Uses of RCU from within extended quiescent state mode are totally ignored
> by RCU, hence the importance of this diagnostic.
Looks good!
At some point, we may need to add an additional argument to
lockdep_rcu_suspicious() to suppress this new message, but let's
worry about that when and if we come to it.
(An example would be an rcu_dereference_protected() that checks for
a lock being held, and thus can be legally called from an extended
quiescent state. But the message would print only if the lock was
not held, so this could not be a false positive, only a possible
source of confusion. Not worth worrying about yet.)
Thanx, Paul
> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> Cc: Ingo Molnar <mingo@elte.hu>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> ---
> kernel/lockdep.c | 22 ++++++++++++++++++++++
> 1 files changed, 22 insertions(+), 0 deletions(-)
>
> diff --git a/kernel/lockdep.c b/kernel/lockdep.c
> index 1e48f1c..8873f6e 100644
> --- a/kernel/lockdep.c
> +++ b/kernel/lockdep.c
> @@ -4026,6 +4026,28 @@ void lockdep_rcu_suspicious(const char *file, const int line, const char *s)
> printk("%s:%d %s!\n", file, line, s);
> printk("\nother info that might help us debug this:\n\n");
> printk("\nrcu_scheduler_active = %d, debug_locks = %d\n", rcu_scheduler_active, debug_locks);
> +
> + /*
> + * If a CPU is in the RCU-free window in idle (ie: in the section
> + * between rcu_idle_enter() and rcu_idle_exit(), then RCU
> + * considers that CPU to be in an "extended quiescent state",
> + * which means that RCU will be completely ignoring that CPU.
> + * Therefore, rcu_read_lock() and friends have absolutely no
> + * effect on a CPU running in that state. In other words, even if
> + * such an RCU-idle CPU has called rcu_read_lock(), RCU might well
> + * delete data structures out from under it. RCU really has no
> + * choice here: we need to keep an RCU-free window in idle where
> + * the CPU may possibly enter into low power mode. This way we can
> + * notice an extended quiescent state to other CPUs that started a grace
> + * period. Otherwise we would delay any grace period as long as we run
> + * in the idle task.
> + *
> + * So complain bitterly if someone does call rcu_read_lock(),
> + * rcu_read_lock_bh() and so on from extended quiescent states.
> + */
> + if (rcu_is_cpu_idle())
> + printk("RCU used illegally from extended quiescent state!\n");
> +
> lockdep_print_held_locks(curr);
> printk("\nstack backtrace:\n");
> dump_stack();
> --
> 1.7.5.4
>
next prev parent reply other threads:[~2011-10-07 22:47 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-07 16:21 [PATCH 00/11] rcu: Detect illegal uses of RCU in idle and fix some v5 Frederic Weisbecker
2011-10-07 16:22 ` [PATCH 01/11] rcu: Detect illegal rcu dereference in extended quiescent state Frederic Weisbecker
2011-10-07 16:22 ` [PATCH 02/11] rcu: Inform the user about extended quiescent state on PROVE_RCU warning Frederic Weisbecker
2011-10-07 22:47 ` Paul E. McKenney [this message]
2011-10-07 16:22 ` [PATCH 03/11] rcu: Warn when rcu_read_lock() is used in extended quiescent state Frederic Weisbecker
2011-10-07 16:22 ` [PATCH 04/11] rcu: Remove one layer of abstraction from PROVE_RCU checking Frederic Weisbecker
2011-10-07 16:22 ` [PATCH 05/11] rcu: Warn when srcu_read_lock() is used in an extended quiescent state Frederic Weisbecker
2011-10-07 16:22 ` [PATCH 06/11] rcu: Make srcu_read_lock_held() call common lockdep-enabled function Frederic Weisbecker
2011-10-07 16:22 ` [PATCH 07/11] nohz: Separate out irq exit and idle loop dyntick logic Frederic Weisbecker
2011-10-07 16:22 ` [PATCH 08/11] nohz: Allow rcu extended quiescent state handling seperately from tick stop Frederic Weisbecker
2011-10-08 13:43 ` Frederic Weisbecker
2011-10-08 14:01 ` [PATCH 08/11 v2] " Frederic Weisbecker
2011-10-13 6:57 ` Paul E. McKenney
2011-10-13 7:03 ` Paul E. McKenney
2011-10-13 12:50 ` Frederic Weisbecker
2011-10-13 22:51 ` Paul E. McKenney
2011-10-14 12:08 ` Frederic Weisbecker
2011-10-14 17:00 ` Paul E. McKenney
2011-10-16 13:28 ` Frederic Weisbecker
2011-10-17 2:26 ` Paul E. McKenney
2011-10-07 16:22 ` [PATCH 09/11] x86: Enter rcu extended qs after idle notifier call Frederic Weisbecker
2011-10-07 16:22 ` [PATCH 10/11] x86: Call idle notifier after irq_enter() Frederic Weisbecker
2011-10-07 16:22 ` [PATCH 11/11] rcu: Fix early call to rcu_idle_enter() Frederic Weisbecker
2011-10-07 23:32 ` [PATCH 00/11] rcu: Detect illegal uses of RCU in idle and fix some v5 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=20111007224744.GH2696@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=a.p.zijlstra@chello.nl \
--cc=fweisbec@gmail.com \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--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