public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org, mingo@kernel.org, hpa@zytor.com,
	tglx@linutronix.de, davej@redhat.com,
	linux-tip-commits@vger.kernel.org, laijs@cn.fujitsu.com
Subject: Re: [tip:core/rcu] rcu: Break call_rcu() deadlock involving scheduler and perf
Date: Mon, 16 Dec 2013 08:10:31 -0800	[thread overview]
Message-ID: <20131216161031.GD4200@linux.vnet.ibm.com> (raw)
In-Reply-To: <20131216154539.GY21999@twins.programming.kicks-ass.net>

On Mon, Dec 16, 2013 at 04:45:39PM +0100, Peter Zijlstra wrote:
> On Mon, Dec 16, 2013 at 07:32:48AM -0800, Paul E. McKenney wrote:
> > On Mon, Dec 16, 2013 at 04:26:36PM +0100, Peter Zijlstra wrote:
> > > On Mon, Dec 16, 2013 at 07:19:22AM -0800, tip-bot for Paul E. McKenney wrote:
> > > > The underlying problem is that perf is invoking call_rcu() with the
> > > > scheduler locks held, but in NOCB mode, call_rcu() will with high
> > > > probability invoke the scheduler -- which just might want to use its
> > > > locks.  The reason that call_rcu() needs to invoke the scheduler is
> > > > to wake up the corresponding rcuo callback-offload kthread, which
> > > > does the job of starting up a grace period and invoking the callbacks
> > > > afterwards.
> > > > 
> > > > One solution (championed on a related problem by Lai Jiangshan) is to
> > > > simply defer the wakeup to some point where scheduler locks are no longer
> > > > held.  Since we don't want to unnecessarily incur the cost of such
> > > > deferral, the task before us is threefold:
> > > > 
> > > > 1.	Determine when it is likely that a relevant scheduler lock is held.
> > > > 
> > > > 2.	Defer the wakeup in such cases.
> > > > 
> > > > 3.	Ensure that all deferred wakeups eventually happen, preferably
> > > > 	sooner rather than later.
> > > > 
> > > > We use irqs_disabled_flags() as a proxy for relevant scheduler locks
> > > > being held.  This works because the relevant locks are always acquired
> > > > with interrupts disabled.  We may defer more often than needed, but that
> > > > is at least safe.
> > > 
> > > This would also allow us to do away with things like the below patch,
> > > right?
> > 
> > It takes care of one problem, but there are others, including
> > rcu_read_unlock() inovking the scheduler to deboost itself.  So for the
> > moment, we still need the below patch.
> 
> Oh right, see I knew I was forgetting something... :-)

I am hoping to make your patch unnecessary, but it ain't trivial.  ;-)

We will get there!  Especially if I can find Lai Jiangshan's old patch
that reworked deboosting.  :-/

							Thanx, Paul


      reply	other threads:[~2013-12-16 16:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <tip-96d3fd0d315a949e30adc80f086031c5cdf070d1@git.kernel.org>
2013-12-16 15:26 ` [tip:core/rcu] rcu: Break call_rcu() deadlock involving scheduler and perf Peter Zijlstra
2013-12-16 15:32   ` Paul E. McKenney
2013-12-16 15:45     ` Peter Zijlstra
2013-12-16 16:10       ` 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=20131216161031.GD4200@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=davej@redhat.com \
    --cc=hpa@zytor.com \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --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