From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Alexei Starovoitov <ast@plumgrid.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
Daniel Wagner <daniel.wagner@bmw-carit.de>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: call_rcu from trace_preempt
Date: Tue, 16 Jun 2015 10:39:42 -0700 [thread overview]
Message-ID: <20150616173942.GP3913@linux.vnet.ibm.com> (raw)
In-Reply-To: <55805960.2030008@plumgrid.com>
On Tue, Jun 16, 2015 at 10:14:08AM -0700, Alexei Starovoitov wrote:
> On 6/16/15 9:05 AM, Paul E. McKenney wrote:
> >On Tue, Jun 16, 2015 at 11:37:38AM -0400, Steven Rostedt wrote:
> >>On Tue, 16 Jun 2015 05:27:33 -0700
> >>"Paul E. McKenney" <paulmck@linux.vnet.ibm.com> wrote:
> >>
> >>>On Mon, Jun 15, 2015 at 10:45:05PM -0700, Alexei Starovoitov wrote:
> >>>>On 6/15/15 7:14 PM, Paul E. McKenney wrote:
> >>>>>
> >>>>>Why do you believe that it is better to fix it within call_rcu()?
> >>>>
> >>>>found it:
> >>>>diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> >>>>index 8cf7304b2867..a3be09d482ae 100644
> >>>>--- a/kernel/rcu/tree.c
> >>>>+++ b/kernel/rcu/tree.c
> >>>>@@ -935,9 +935,9 @@ bool notrace rcu_is_watching(void)
> >>>> {
> >>>> bool ret;
> >>>>
> >>>>- preempt_disable();
> >>>>+ preempt_disable_notrace();
> >>>> ret = __rcu_is_watching();
> >>>>- preempt_enable();
> >>>>+ preempt_enable_notrace();
> >>>> return ret;
> >>>> }
> >>>>
> >>>>the rcu_is_watching() and __rcu_is_watching() are already marked
> >>>>notrace, so imo it's a good 'fix'.
> >>>>What was happening is that the above preempt_enable was triggering
> >>>>recursive call_rcu that was indeed messing 'rdp' that was
> >>>>prepared by __call_rcu and before __call_rcu_core could use that.
> >>>
> >>>>btw, also noticed that local_irq_save done by note_gp_changes
> >>>>is partially redundant. In __call_rcu_core path the irqs are
> >>>>already disabled.
> >>>
> >>
> >>If rcu_is_watching() and __rcu_is_watching() are both marked as
> >>notrace, it makes sense to use preempt_disable/enable_notrace() as it
> >>otherwise defeats the purpose of the notrace markers on rcu_is_watching.
And __rcu_is_watching() is marked notrace as well.
> >>That is regardless of what the rest of this thread is about.
> >
> >Good enough! Alexei, are you OK with my adding your Signed-off-by
> >to the above patch?
>
> sure.
> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
>
> >(Still not sold on reentrant call_rcu() and
> >kfree_rcu(), but getting notrace set up correctly is worthwhile.)
>
> I'm not sold on it either. So far trying to understand
> all consequences.
Here is the updated patch. Steven, I added your "Acked-by" based
on your positive comments above, please let me know if you would
like me to remove it.
Thanx, Paul
------------------------------------------------------------------------
commit 9611f225d383a2edbdf74ca7f00c8d0b1e56dc45
Author: Alexei Starovoitov <ast@plumgrid.com>
Date: Tue Jun 16 10:35:18 2015 -0700
rcu: Make rcu_is_watching() really notrace
Although rcu_is_watching() is marked notrace, it invokes preempt_disable()
and preempt_enable(), both of which can be traced. This defeats the
purpose of the notrace on rcu_is_watching(), so this commit substitutes
preempt_disable_notrace() and preempt_enable_notrace().
Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index fc0385380e97..c844ef3c2fae 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -973,9 +973,9 @@ bool notrace rcu_is_watching(void)
{
bool ret;
- preempt_disable();
+ preempt_disable_notrace();
ret = __rcu_is_watching();
- preempt_enable();
+ preempt_enable_notrace();
return ret;
}
EXPORT_SYMBOL_GPL(rcu_is_watching);
next prev parent reply other threads:[~2015-06-16 17:39 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-15 22:24 call_rcu from trace_preempt Alexei Starovoitov
2015-06-15 23:07 ` Paul E. McKenney
2015-06-16 1:09 ` Alexei Starovoitov
2015-06-16 2:14 ` Paul E. McKenney
2015-06-16 5:45 ` Alexei Starovoitov
2015-06-16 6:06 ` Daniel Wagner
2015-06-16 6:25 ` Alexei Starovoitov
2015-06-16 6:34 ` Daniel Wagner
2015-06-16 6:46 ` Alexei Starovoitov
2015-06-16 6:54 ` Daniel Wagner
2015-06-16 12:27 ` Paul E. McKenney
2015-06-16 12:38 ` Daniel Wagner
2015-06-16 14:16 ` Paul E. McKenney
2015-06-16 15:43 ` Steven Rostedt
2015-06-16 16:07 ` Paul E. McKenney
2015-06-16 17:13 ` Daniel Wagner
2015-06-16 15:41 ` Steven Rostedt
2015-06-16 15:52 ` Steven Rostedt
2015-06-16 17:11 ` Daniel Wagner
2015-06-16 17:20 ` Alexei Starovoitov
2015-06-16 17:37 ` Steven Rostedt
2015-06-17 0:33 ` Alexei Starovoitov
2015-06-17 0:47 ` Steven Rostedt
2015-06-17 1:04 ` Alexei Starovoitov
2015-06-17 1:19 ` Steven Rostedt
2015-06-17 8:11 ` Daniel Wagner
2015-06-17 9:05 ` Daniel Wagner
2015-06-17 18:39 ` Alexei Starovoitov
2015-06-17 20:37 ` Paul E. McKenney
2015-06-17 20:53 ` Alexei Starovoitov
2015-06-17 21:36 ` Paul E. McKenney
2015-06-17 23:58 ` Alexei Starovoitov
2015-06-18 0:20 ` Paul E. McKenney
2015-06-16 15:37 ` Steven Rostedt
2015-06-16 16:05 ` Paul E. McKenney
2015-06-16 17:14 ` Alexei Starovoitov
2015-06-16 17:39 ` Paul E. McKenney [this message]
2015-06-16 18:57 ` Steven Rostedt
2015-06-16 19:20 ` Paul E. McKenney
2015-06-16 19:29 ` Steven Rostedt
2015-06-16 19:34 ` 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=20150616173942.GP3913@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=ast@plumgrid.com \
--cc=daniel.wagner@bmw-carit.de \
--cc=linux-kernel@vger.kernel.org \
--cc=rostedt@goodmis.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