lkml.org 
[lkml]   [2020]   [Sep]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [tip: core/rcu] rcu/tree: Mark the idle relevant functions noinstr
On Tue, 29 Sep 2020 13:25:41 +0200
Peter Zijlstra <peterz@infradead.org> wrote:

> On Tue, May 19, 2020 at 07:52:33PM -0000, tip-bot2 for Thomas Gleixner wrote:
> > @@ -979,7 +988,7 @@ static void rcu_disable_urgency_upon_qs(struct rcu_data *rdp)
> > * if the current CPU is not in its idle loop or is in an interrupt or
> > * NMI handler, return true.
> > */
> > -bool notrace rcu_is_watching(void)
> > +bool rcu_is_watching(void)
> > {
> > bool ret;
> >
>
> This ^..
>
> it is required because __ftrace_ops_list_func() /
> ftrace_ops_assist_func() call it outside of ftrace recursion, but only
> when FL_RCU, and perf happens to be the only user of that.
>
> another morning wasted... :/

Those are fun to debug. :-p (I'll use this in another email).

Anyway, you bring up a good point. I should have this:

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 84f32dbc7be8..2d76eaaad4a7 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -6993,16 +6993,14 @@ static void ftrace_ops_assist_func(unsigned long ip, unsigned long parent_ip,
{
int bit;

- if ((op->flags & FTRACE_OPS_FL_RCU) && !rcu_is_watching())
- return;
-
bit = trace_test_and_set_recursion(TRACE_LIST_START, TRACE_LIST_MAX);
if (bit < 0)
return;

preempt_disable_notrace();

- op->func(ip, parent_ip, op, regs);
+ if (!(op->flags & FTRACE_OPS_FL_RCU) || rcu_is_watching())
+ op->func(ip, parent_ip, op, regs);

preempt_enable_notrace();
trace_clear_recursion(bit);


-- Steve

\
 
 \ /
  Last update: 2020-09-29 16:35    [W:2.156 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site