From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Peter Zijlstra <peterz@infradead.org>,
"Paul E. McKenney" <paulmck@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
linux-kernel@vger.kernel.org,
Michael Jeanson <mjeanson@efficios.com>,
Alexei Starovoitov <ast@kernel.org>, Yonghong Song <yhs@fb.com>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
bpf@vger.kernel.org, Joel Fernandes <joel@joelfernandes.org>
Subject: Re: [PATCH v4 1/5] tracing: Introduce faultable tracepoints
Date: Tue, 21 Nov 2023 09:06:18 -0500 [thread overview]
Message-ID: <a0ac5f77-411e-4562-9863-81196238f3f5@efficios.com> (raw)
In-Reply-To: <20231121084706.GF8262@noisy.programming.kicks-ass.net>
On 2023-11-21 03:47, Peter Zijlstra wrote:
> On Mon, Nov 20, 2023 at 03:56:30PM -0800, Paul E. McKenney wrote:
>> On Mon, Nov 20, 2023 at 11:23:11PM +0100, Peter Zijlstra wrote:
>>> On Mon, Nov 20, 2023 at 02:18:29PM -0800, Paul E. McKenney wrote:
>>>> On Mon, Nov 20, 2023 at 10:47:42PM +0100, Peter Zijlstra wrote:
>>>>> On Mon, Nov 20, 2023 at 03:54:14PM -0500, Mathieu Desnoyers wrote:
>>>>>> When invoked from system call enter/exit instrumentation, accessing
>>>>>> user-space data is a common use-case for tracers. However, tracepoints
>>>>>> currently disable preemption around iteration on the registered
>>>>>> tracepoint probes and invocation of the probe callbacks, which prevents
>>>>>> tracers from handling page faults.
>>>>>>
>>>>>> Extend the tracepoint and trace event APIs to allow defining a faultable
>>>>>> tracepoint which invokes its callback with preemption enabled.
>>>>>>
>>>>>> Also extend the tracepoint API to allow tracers to request specific
>>>>>> probes to be connected to those faultable tracepoints. When the
>>>>>> TRACEPOINT_MAY_FAULT flag is provided on registration, the probe
>>>>>> callback will be called with preemption enabled, and is allowed to take
>>>>>> page faults. Faultable probes can only be registered on faultable
>>>>>> tracepoints and non-faultable probes on non-faultable tracepoints.
>>>>>>
>>>>>> The tasks trace rcu mechanism is used to synchronize read-side
>>>>>> marshalling of the registered probes with respect to faultable probes
>>>>>> unregistration and teardown.
>>>>>
>>>>> What is trace-trace rcu and why is it needed here? What's wrong with
>>>>> SRCU ?
>>>>
>>>> Tasks Trace RCU avoids SRCU's full barriers and the array accesses in the
>>>> read-side primitives. This can be important when tracing low-overhead
>>>> components of fast paths.
>>>
>>> So why wasn't SRCU improved? That is, the above doesn't much explain.
>>>
>>> What is the trade-off made to justify adding yet another RCU flavour?
>>
>> We didn't think you would be all that happy about having each and
>> every context switch iterating through many tens or even hundreds of
>> srcu_struct structures. For that matter, we didn't think that anyone
>> else would be all that happy either. Us included.
>
> So again, what is task-trace RCU ? How does it differ from say
> preemptible rcu, which AFAICT could be used here too, no?
Task trace RCU fits a niche that has the following set of requirements/tradeoffs:
- Allow page faults within RCU read-side (like SRCU),
- Has a low-overhead read lock-unlock (without the memory barrier overhead of SRCU),
- The tradeoff: Has a rather slow synchronize_rcu(), but tracers should not care about
that. Hence, this is not meant to be a generic replacement for SRCU.
Based on my reading of https://lwn.net/Articles/253651/ , preemptible RCU is not a good
fit for the following reasons:
- It disallows blocking within a RCU read-side on non-CONFIG_PREEMPT kernels,
- AFAIU the mmap_sem used within the page fault handler does not have priority inheritance.
Please let me know if I'm missing something.
Thanks,
Mathieu
--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com
next prev parent reply other threads:[~2023-11-21 14:05 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-20 20:54 [PATCH v4 0/5] Faultable Tracepoints Mathieu Desnoyers
2023-11-20 20:54 ` [PATCH v4 1/5] tracing: Introduce faultable tracepoints Mathieu Desnoyers
2023-11-20 21:47 ` Peter Zijlstra
2023-11-20 22:18 ` Paul E. McKenney
2023-11-20 22:23 ` Peter Zijlstra
2023-11-20 23:56 ` Paul E. McKenney
2023-11-21 8:47 ` Peter Zijlstra
2023-11-21 14:06 ` Mathieu Desnoyers [this message]
2023-11-21 14:36 ` Peter Zijlstra
2023-11-21 14:40 ` Mathieu Desnoyers
2023-11-21 14:46 ` Peter Zijlstra
2023-11-21 14:56 ` Mathieu Desnoyers
2023-11-21 15:51 ` Paul E. McKenney
2023-11-21 15:52 ` Peter Zijlstra
2023-11-21 16:00 ` Mathieu Desnoyers
2023-11-21 16:07 ` Steven Rostedt
2023-11-21 16:11 ` Mathieu Desnoyers
2023-11-21 16:43 ` Paul E. McKenney
2023-11-21 16:50 ` Peter Zijlstra
2023-11-21 17:31 ` Peter Zijlstra
2023-11-21 16:41 ` Paul E. McKenney
2023-11-21 14:44 ` Steven Rostedt
2023-11-21 16:45 ` Paul E. McKenney
2023-11-21 15:58 ` Paul E. McKenney
2023-11-21 16:03 ` Peter Zijlstra
2023-11-21 16:46 ` Paul E. McKenney
2023-11-20 22:20 ` Steven Rostedt
2024-06-20 15:38 ` Mathieu Desnoyers
2023-11-20 20:54 ` [PATCH v4 2/5] tracing/ftrace: Add support for " Mathieu Desnoyers
2023-11-20 22:15 ` Peter Zijlstra
2024-06-20 15:04 ` Mathieu Desnoyers
2023-11-20 20:54 ` [PATCH v4 3/5] tracing/bpf-trace: add " Mathieu Desnoyers
2023-11-20 20:54 ` [PATCH v4 4/5] tracing/perf: " Mathieu Desnoyers
2023-11-20 20:54 ` [PATCH v4 5/5] tracing: convert sys_enter/exit to " Mathieu Desnoyers
2023-11-20 21:46 ` Peter Zijlstra
2024-06-20 15:05 ` 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=a0ac5f77-411e-4562-9863-81196238f3f5@efficios.com \
--to=mathieu.desnoyers@efficios.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=joel@joelfernandes.org \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mhiramat@kernel.org \
--cc=mingo@redhat.com \
--cc=mjeanson@efficios.com \
--cc=namhyung@kernel.org \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=yhs@fb.com \
/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