From: Peter Zijlstra <peterz@infradead.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@kernel.org>,
"Joel Fernandes (Google)" <joel@joelfernandes.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
Thomas Gleixner <tglx@linutronix.de>,
"Paul E. McKenney" <paulmck@kernel.org>,
Josh Triplett <josh@joshtriplett.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Lai Jiangshan <jiangshanlai@gmail.com>
Subject: Re: [PATCH v2] tracing/perf: Move rcu_irq_enter/exit_irqson() to perf trace point hook
Date: Tue, 11 Feb 2020 16:34:52 +0100 [thread overview]
Message-ID: <20200211153452.GW14914@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20200211095047.58ddf750@gandalf.local.home>
On Tue, Feb 11, 2020 at 09:50:47AM -0500, Steven Rostedt wrote:
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index 455451d24b4a..0abbf5e2ee62 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -8941,6 +8941,7 @@ void perf_tp_event(u16 event_type, u64 count, void *record, int entry_size,
> {
> struct perf_sample_data data;
> struct perf_event *event;
> + bool rcu_watching = rcu_is_watching();
>
> struct perf_raw_record raw = {
> .frag = {
> @@ -8949,6 +8950,17 @@ void perf_tp_event(u16 event_type, u64 count, void *record, int entry_size,
> },
> };
>
> + if (!rcu_watching) {
> + /*
> + * If nmi_enter() is traced, it is possible that
> + * RCU may not be watching "yet", and this is called.
> + * We can not call rcu_irq_enter_irqson() in this case.
> + */
> + if (unlikely(in_nmi()))
> + goto out;
unless I'm mistaken, we can simply do rcu_nmi_enter() in this case, and
rcu_nmi_exit() on the other end.
> + rcu_irq_enter_irqson();
> + }
> +
> perf_sample_data_init(&data, 0, 0);
> data.raw = &raw;
>
> @@ -8985,8 +8997,11 @@ void perf_tp_event(u16 event_type, u64 count, void *record, int entry_size,
> unlock:
> rcu_read_unlock();
> }
> -
> + if (!rcu_watching)
> + rcu_irq_exit_irqson();
> +out:
> perf_swevent_put_recursion_context(rctx);
> +
> }
next prev parent reply other threads:[~2020-02-11 15:35 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-11 14:50 [PATCH v2] tracing/perf: Move rcu_irq_enter/exit_irqson() to perf trace point hook Steven Rostedt
2020-02-11 15:34 ` Mathieu Desnoyers
2020-02-11 15:46 ` Peter Zijlstra
2020-02-11 16:02 ` Mathieu Desnoyers
2020-02-11 15:34 ` Peter Zijlstra [this message]
2020-02-11 16:18 ` Steven Rostedt
2020-02-11 16:27 ` Mathieu Desnoyers
2020-02-11 16:35 ` Steven Rostedt
2020-02-11 17:29 ` Peter Zijlstra
2020-02-11 17:32 ` Peter Zijlstra
2020-02-11 18:54 ` Paul E. McKenney
2020-02-12 8:05 ` Peter Zijlstra
2020-02-12 9:05 ` Paul E. McKenney
2020-02-11 17:35 ` Mathieu Desnoyers
2020-02-12 8:02 ` Peter Zijlstra
2020-02-12 15:14 ` Mathieu Desnoyers
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=20200211153452.GW14914@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=gregkh@linuxfoundation.org \
--cc=gustavo@embeddedor.com \
--cc=jiangshanlai@gmail.com \
--cc=joel@joelfernandes.org \
--cc=josh@joshtriplett.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@kernel.org \
--cc=paulmck@kernel.org \
--cc=rostedt@goodmis.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.