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: Joerg Roedel <joro@8bytes.org>, Borislav Petkov <bp@alien8.de>,
	Ingo Molnar <mingo@kernel.org>,
	Arnaldo Carvalho de Melo <acme@infradead.org>,
	lkml <linux-kernel@vger.kernel.org>,
	Stephane Eranian <eranian@google.com>,
	Namhyung Kim <namhyung.kim@lge.com>, Jiri Olsa <jolsa@redhat.com>
Subject: Re: BUG: using smp_processor_id() in preemptible [00000000] code: asm/8267
Date: Wed, 27 Mar 2013 07:37:15 -0700	[thread overview]
Message-ID: <20130327143715.GY4379@linux.vnet.ibm.com> (raw)
In-Reply-To: <1364393852.5053.74.camel@laptop>

On Wed, Mar 27, 2013 at 03:17:32PM +0100, Peter Zijlstra wrote:
> On Wed, 2013-03-27 at 14:15 +0100, Joerg Roedel wrote:
> > What makes me wonder here is that the code is preemptible in an
> > rcu_read_locked section. As far as I know preemption needs to be
> > disabled while holding the rcu_read_lock().
> 
> Nah, a long long time ago some -rt people complained to paulmck that
> keeping preemption disabled over all this RCU stuff was killing
> latencies. Paul liked the challenge and came up with some mind twisting
> stuff to make it work.

What can I say?  I was young and foolish.  And I still am pretty
foolish.  ;-)

But yes, you are not required to disable preemption across
rcu_read_lock(), and rcu_read_lock() is not guaranteed to disable
preemption.  So if you need preemption to be disabled, do it explicitly
with preempt_disable(), local_irq_save(), rcu_read_lock_sched(),
or whatever, because rcu_read_lock() isn't always going to disable
preemption.

> If you're into that kind of pain, look at CONFIG_*_PREEMPT_RCU :-)

Or just set CONFIG_PREEMPT=y, which will set CONFIG_TREE_PREEMPT_RCU=y
on CONFIG_SMP=y builds and will set CONFIG_TINY_PREEMPT_RCU=y otherwise.
(But please note that CONFIG_TINY_PREEMPT_RCU is going away, after which
CONFIG_PREEMPT=y will always set CONFIG_TREE_PREEMPT_RCU=y.)

							Thanx, Paul

> But yeah, you need to have that stuff enabled before you can hit this
> particular snag.
> 


  reply	other threads:[~2013-03-27 14:37 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-24 11:55 BUG: using smp_processor_id() in preemptible [00000000] code: asm/8267 Borislav Petkov
2013-03-24 15:59 ` Borislav Petkov
2013-03-26 18:34   ` Borislav Petkov
2013-03-27  6:02     ` Namhyung Kim
2013-03-27  9:49       ` Borislav Petkov
2013-03-27 10:42         ` Jiri Olsa
2013-03-27 14:09         ` Peter Zijlstra
2013-03-27 16:31           ` Borislav Petkov
2013-04-30 15:27           ` [RFCv2] " Jiri Olsa
2013-03-27 13:15     ` Joerg Roedel
2013-03-27 14:17       ` Peter Zijlstra
2013-03-27 14:37         ` Paul E. McKenney [this message]
2013-03-27 16:34           ` Joerg Roedel
2013-03-27 16:38             ` Borislav Petkov
2013-03-27 18:04               ` Paul E. McKenney
2013-03-27 19:07                 ` Borislav Petkov
2013-03-27 19:20                   ` Borislav Petkov
2013-03-27 19:22                   ` 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=20130327143715.GY4379@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=acme@infradead.org \
    --cc=bp@alien8.de \
    --cc=eranian@google.com \
    --cc=jolsa@redhat.com \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung.kim@lge.com \
    --cc=peterz@infradead.org \
    /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