public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
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>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: [PATCH 4/4] rcu: Fix early call to rcu_irq_exit()
Date: Sun, 4 Sep 2011 16:38:46 -0700	[thread overview]
Message-ID: <20110904233846.GO2411@linux.vnet.ibm.com> (raw)
In-Reply-To: <1313861452-24783-5-git-send-email-fweisbec@gmail.com>

On Sat, Aug 20, 2011 at 07:30:52PM +0200, Frederic Weisbecker wrote:
> On the irq exit path, tick_nohz_stop_sched_tick()
> may raise a softirq, which action leads to the wake up
> path and select_task_rq_fair() that makes use of rcu
> to iterate the domains.
> 
> This is an illegal use of RCU because we may be in dyntick
> idle mode:

The rest of these look good!

							Thanx, Paul

> [  132.978883] ===============================
> [  132.978883] [ INFO: suspicious RCU usage. ]
> [  132.978883] -------------------------------
> [  132.978883] kernel/sched_fair.c:1707 suspicious rcu_dereference_check() usage!
> [  132.978883]
> [  132.978883] other info that might help us debug this:
> [  132.978883]
> [  132.978883]
> [  132.978883] rcu_scheduler_active = 1, debug_locks = 0
> [  132.978883] RCU used illegally from extended quiescent state!
> [  132.978883] 2 locks held by swapper/0:
> [  132.978883]  #0:  (&p->pi_lock){-.-.-.}, at: [<ffffffff8105a729>] try_to_wake_up+0x39/0x2f0
> [  132.978883]  #1:  (rcu_read_lock){.+.+..}, at: [<ffffffff8105556a>] select_task_rq_fair+0x6a/0xec0
> [  132.978883]
> [  132.978883] stack backtrace:
> [  132.978883] Pid: 0, comm: swapper Tainted: G        W   3.0.0+ #178
> [  132.978883] Call Trace:
> [  132.978883]  <IRQ>  [<ffffffff810a01f6>] lockdep_rcu_suspicious+0xe6/0x100
> [  132.978883]  [<ffffffff81055c49>] select_task_rq_fair+0x749/0xec0
> [  132.978883]  [<ffffffff8105556a>] ? select_task_rq_fair+0x6a/0xec0
> [  132.978883]  [<ffffffff812fe494>] ? do_raw_spin_lock+0x54/0x150
> [  132.978883]  [<ffffffff810a1f2d>] ? trace_hardirqs_on+0xd/0x10
> [  132.978883]  [<ffffffff8105a7c3>] try_to_wake_up+0xd3/0x2f0
> [  132.978883]  [<ffffffff81094f98>] ? ktime_get+0x68/0xf0
> [  132.978883]  [<ffffffff8105aa35>] wake_up_process+0x15/0x20
> [  132.978883]  [<ffffffff81069dd5>] raise_softirq_irqoff+0x65/0x110
> [  132.978883]  [<ffffffff8108eb65>] __hrtimer_start_range_ns+0x415/0x5a0
> [  132.978883]  [<ffffffff812fe3ee>] ? do_raw_spin_unlock+0x5e/0xb0
> [  132.978883]  [<ffffffff8108ed08>] hrtimer_start+0x18/0x20
> [  132.978883]  [<ffffffff8109c9c3>] tick_nohz_stop_sched_tick+0x393/0x450
> [  132.978883]  [<ffffffff810694f2>] irq_exit+0xd2/0x100
> [  132.978883]  [<ffffffff81829e96>] do_IRQ+0x66/0xe0
> [  132.978883]  [<ffffffff81820d53>] common_interrupt+0x13/0x13
> [  132.978883]  <EOI>  [<ffffffff8103434b>] ? native_safe_halt+0xb/0x10
> [  132.978883]  [<ffffffff810a1f2d>] ? trace_hardirqs_on+0xd/0x10
> [  132.978883]  [<ffffffff810144ea>] default_idle+0xba/0x370
> [  132.978883]  [<ffffffff810147fe>] amd_e400_idle+0x5e/0x130
> [  132.978883]  [<ffffffff8100a9f6>] cpu_idle+0xb6/0x120
> [  132.978883]  [<ffffffff817f217f>] rest_init+0xef/0x150
> [  132.978883]  [<ffffffff817f20e2>] ? rest_init+0x52/0x150
> [  132.978883]  [<ffffffff81ed9cf3>] start_kernel+0x3da/0x3e5
> [  132.978883]  [<ffffffff81ed9346>] x86_64_start_reservations+0x131/0x135
> [  132.978883]  [<ffffffff81ed944d>] x86_64_start_kernel+0x103/0x112
> 
> Fix this by calling rcu_irq_exit() after tick_nohz_stop_sched_tick().
> 
> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> Cc: Ingo Molnar <mingo@elte.hu>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> ---
>  kernel/softirq.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/kernel/softirq.c b/kernel/softirq.c
> index fca82c3..d4047b8 100644
> --- a/kernel/softirq.c
> +++ b/kernel/softirq.c
> @@ -347,12 +347,12 @@ void irq_exit(void)
>  	if (!in_interrupt() && local_softirq_pending())
>  		invoke_softirq();
> 
> -	rcu_irq_exit();
>  #ifdef CONFIG_NO_HZ
>  	/* Make sure that timer wheel updates are propagated */
>  	if (idle_cpu(smp_processor_id()) && !in_interrupt() && !need_resched())
>  		tick_nohz_stop_sched_tick(0);
>  #endif
> +	rcu_irq_exit();
>  	preempt_enable_no_resched();
>  }
> 
> -- 
> 1.7.5.4
> 

      reply	other threads:[~2011-09-04 23:39 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-20 17:30 [PATCH 0/4 v2] rcu: Fix some rcu uses in extended quiescent state Frederic Weisbecker
2011-08-20 17:30 ` [PATCH 1/4] nohz: Split extended quiescent state handling from nohz switch Frederic Weisbecker
2011-08-20 17:39   ` Mike Frysinger
2011-08-22  2:02   ` Guan Xuetao
2011-09-04 21:01   ` Paul E. McKenney
2011-09-04 21:05     ` Frederic Weisbecker
2011-09-04 23:36   ` Paul E. McKenney
2011-09-06 14:58     ` Frederic Weisbecker
2011-09-07 14:22     ` Paul E. McKenney
2011-09-07 21:39       ` Frederic Weisbecker
2011-09-13  0:06       ` Frederic Weisbecker
2011-09-13 16:49         ` Paul E. McKenney
2011-08-20 17:30 ` [PATCH 2/4] x86: Enter rcu extended qs after idle notifier call Frederic Weisbecker
2011-08-20 17:30 ` [PATCH 3/4] x86: Call idle notifier after irq_enter() Frederic Weisbecker
2011-08-20 17:30 ` [PATCH 4/4] rcu: Fix early call to rcu_irq_exit() Frederic Weisbecker
2011-09-04 23:38   ` Paul E. McKenney [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=20110904233846.GO2411@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=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