From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: rostedt <rostedt@goodmis.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
"Joel Fernandes, Google" <joel@joelfernandes.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
Ingo Molnar <mingo@redhat.com>,
Richard Fontana <rfontana@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
paulmck <paulmck@kernel.org>,
Josh Triplett <josh@joshtriplett.org>,
Lai Jiangshan <jiangshanlai@gmail.com>,
Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
Subject: Re: [RFC 0/3] Revert SRCU from tracepoint infrastructure
Date: Mon, 10 Feb 2020 12:33:04 -0500 (EST) [thread overview]
Message-ID: <1966694237.616758.1581355984287.JavaMail.zimbra@efficios.com> (raw)
In-Reply-To: <20200210120552.1a06a7aa@gandalf.local.home>
----- On Feb 10, 2020, at 12:05 PM, rostedt rostedt@goodmis.org wrote:
> On Mon, 10 Feb 2020 10:46:16 +0100
> Peter Zijlstra <peterz@infradead.org> wrote:
>
>> Furthermore, using srcu would be detrimental, because of how it has
>> smp_mb() in the read side primitives.
>
> I didn't realize that there was a full memory barrier in the srcu read
> side. Seems to me that itself is rational for reverting it. And also a
> big NAK for any suggestion to have any of the function tracing to use
> it as well (which comes up here and there).
The rcu_irq_enter/exit_irqson() does atomic_add_return(), which is even worse
than a memory barrier.
Let me summarize my understanding of a few use-cases we have with tracepoints
and other instrumentation mechanisms and the guarantees they provide (or not):
* Tracepoints
- Uses sched-rcu (typically)
- Uses SRCU for _cpuidle callsites
- Planned use of SRCU to allow syscall entry/exit instrumentation to
take page faults. (currently all tracers paper over that issue by filling
with zeroes rather than handle the fault)
- Grace period waits for both sched-rcu and SRCU.
* kprobes/kretprobes
- interrupts off around probe invocation
* Hardware performance counters
- Probe invoked from NMI context
- Software performance counters
- preempt off around probe invocation
Moving _rcuidle instrumentation to SRCU aimed at removing a significant
overhead incurred by having all _rcuidle tracepoints perform the atomic_add_return
on the shared variable (which is frequent enough to impact performance).
There are a couple of approaches that perf could take in order to tackle this
without hurting performance for all other tracers:
- If perf wishes to keep using explicit rcu_read_lock/unlock in its probes:
Use is_rcu_watching() within the perf probe, and only invoke rcu_irq_enter/exit_irqson()
when needed.
As an alternative, perf could implement a "trampoline" which would only be used
when registering a perf probe to a _rcuidle tracepoint. That trampoline would
perform rcu_irq_entrer/exit_irqson() around the call to the real perf probe.
- If perf can remove the redundant RCU read-side lock/unlock and replace this
by waiting for the relevant RCU/SRCU grace periods instead:
Basically, looking at all the instrumentation sources perf uses, all of them
already provide some kind of RCU guarantee, which makes the explicit rcu read-side
locks within the perf probes redundant. Removing the redundant rcu read-side lock/unlock
from the perf probes should bring a slight performance improvement as well.
Thanks,
Mathieu
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
next prev parent reply other threads:[~2020-02-10 17:33 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-07 20:56 [RFC 0/3] Revert SRCU from tracepoint infrastructure Joel Fernandes (Google)
2020-02-07 20:56 ` [RFC 1/3] Revert "tracepoint: Use __idx instead of idx in DO_TRACE macro to make it unique" Joel Fernandes (Google)
2020-02-07 21:07 ` Steven Rostedt
2020-02-07 20:56 ` [RFC 2/3] Revert "tracing: Add back in rcu_irq_enter/exit_irqson() for rcuidle tracepoints" Joel Fernandes (Google)
2020-02-07 20:56 ` [RFC 3/3] Revert "tracepoint: Make rcuidle tracepoint callers use SRCU" Joel Fernandes (Google)
2020-02-07 21:24 ` [RFC 0/3] Revert SRCU from tracepoint infrastructure Paul E. McKenney
2020-02-07 21:43 ` Joel Fernandes
2020-02-08 16:39 ` Mathieu Desnoyers
2020-02-08 16:31 ` Mathieu Desnoyers
2020-02-10 9:46 ` Peter Zijlstra
2020-02-10 10:19 ` Peter Zijlstra
2020-02-10 13:36 ` Paul E. McKenney
2020-02-10 13:44 ` Peter Zijlstra
2020-02-10 13:57 ` Paul E. McKenney
2020-02-10 17:17 ` Joel Fernandes
2020-02-10 17:05 ` Steven Rostedt
2020-02-10 17:33 ` Mathieu Desnoyers [this message]
2020-02-10 18:30 ` Steven Rostedt
2020-02-10 19:05 ` Mathieu Desnoyers
2020-02-10 19:53 ` Joel Fernandes
2020-02-10 20:03 ` Steven Rostedt
2020-02-10 20:30 ` Joel Fernandes
2020-02-10 18:07 ` Paul E. McKenney
2020-02-10 16:59 ` Joel Fernandes
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=1966694237.616758.1581355984287.JavaMail.zimbra@efficios.com \
--to=mathieu.desnoyers@efficios.com \
--cc=arnaldo.melo@gmail.com \
--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=mingo@redhat.com \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=rfontana@redhat.com \
--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.