Re: [RFC PATCH 0/6] Sleepable tracepoints

From: peter enderborg
Date: Mon Oct 26 2020 - 08:05:23 EST


On 10/23/20 9:53 PM, Michael Jeanson 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 specific tracer
> probes to take page faults. Adapt ftrace, perf, and ebpf to allow being
> called from sleepable context, and convert the system call enter/exit
> instrumentation to sleepable tracepoints.

Will this not be a problem for analyse of the trace? It get two
relevant times, one it when it is called and one when it returns.

It makes things harder to correlate in what order things happen.

And handling of tracing of contexts that already are not preamptable?

Eg the same tracepoint are used in different places and contexts.


> This series only implements the tracepoint infrastructure required to
> allow tracers to handle page faults. Modifying each tracer to handle
> those page faults would be a next step after we all agree on this piece
> of instrumentation infrastructure.
>
> This patchset is base on v5.9.1.
>
> Cc: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>
> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> Cc: Alexei Starovoitov <ast@xxxxxxxxxx>
> Cc: Yonghong Song <yhs@xxxxxx>
> Cc: Paul E. McKenney <paulmck@xxxxxxxxxx>
> Cc: Ingo Molnar <mingo@xxxxxxxxxx>
> Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
> Cc: Mark Rutland <mark.rutland@xxxxxxx>
> Cc: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>
> Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
> Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
> Cc: Joel Fernandes (Google) <joel@xxxxxxxxxxxxxxxxx>
> Cc: bpf@xxxxxxxxxxxxxxx
>
> Mathieu Desnoyers (1):
> tracing: use sched-RCU instead of SRCU for rcuidle tracepoints
>
> Michael Jeanson (5):
> tracing: introduce sleepable tracepoints
> tracing: ftrace: add support for sleepable tracepoints
> tracing: bpf-trace: add support for sleepable tracepoints
> tracing: perf: add support for sleepable tracepoints
> tracing: convert sys_enter/exit to sleepable tracepoints
>
> include/linux/tracepoint-defs.h | 11 ++++
> include/linux/tracepoint.h | 104 +++++++++++++++++++++-----------
> include/trace/bpf_probe.h | 23 ++++++-
> include/trace/define_trace.h | 7 +++
> include/trace/events/syscalls.h | 4 +-
> include/trace/perf.h | 26 ++++++--
> include/trace/trace_events.h | 79 ++++++++++++++++++++++--
> init/Kconfig | 1 +
> kernel/trace/bpf_trace.c | 5 +-
> kernel/trace/trace_events.c | 15 ++++-
> kernel/trace/trace_syscalls.c | 68 +++++++++++++--------
> kernel/tracepoint.c | 104 +++++++++++++++++++++++++-------
> 12 files changed, 351 insertions(+), 96 deletions(-)
>