mbox series

[v2,0/7] tracing: Allow system call tracepoints to handle page faults

Message ID 20241004011201.1681962-1-mathieu.desnoyers@efficios.com (mailing list archive)
Headers show
Series tracing: Allow system call tracepoints to handle page faults | expand

Message

Mathieu Desnoyers Oct. 4, 2024, 1:11 a.m. UTC
Wire up the system call tracepoints with Tasks Trace RCU to allow
the ftrace, perf, and eBPF tracers to handle page faults.

This series does the initial wire-up allowing tracers to handle page
faults, but leaves out the actual handling of said page faults as future
work.

This series was compile and runtime tested with ftrace and perf syscall
tracing and raw syscall tracing, adding a WARN_ON_ONCE() in the
generated code to validate that the intended probes are used for raw
syscall tracing. The might_fault() added within those probes validate
that they are called from a context where handling a page fault is OK.

This series replaces the "Faultable Tracepoints v6" series found at [1].

This has been rebased on v6.12-rc1 on top of two patches from Steven:

tracing: Remove definition of trace_*_rcuidle()
tracepoint: Remove SRCU protection

Thanks,

Mathieu

Link: https://lore.kernel.org/lkml/20240828144153.829582-1-mathieu.desnoyers@efficios.com/ # [1]
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Yonghong Song <yhs@fb.com>
Cc: Paul E. McKenney <paulmck@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: bpf@vger.kernel.org
Cc: Joel Fernandes <joel@joelfernandes.org>
Cc: linux-trace-kernel@vger.kernel.org

Mathieu Desnoyers (7):
  tracing/ftrace: guard syscall probe with preempt_notrace
  tracing/perf: guard syscall probe with preempt_notrace
  tracing/bpf: guard syscall probe with preempt_notrace
  tracing: Allow system call tracepoints to handle page faults
  tracing/ftrace: Add might_fault check to syscall probes
  tracing/perf: Add might_fault check to syscall probes
  tracing/bpf: Add might_fault check to syscall probes

 include/linux/tracepoint.h    | 18 ++++++++++-----
 include/trace/bpf_probe.h     | 12 +++++++++-
 include/trace/perf.h          | 42 +++++++++++++++++++++++++++++++----
 include/trace/trace_events.h  | 39 ++++++++++++++++++++++++++------
 init/Kconfig                  |  1 +
 kernel/trace/trace_syscalls.c | 28 +++++++++++++++++++++++
 6 files changed, 123 insertions(+), 17 deletions(-)

Comments

Mathieu Desnoyers Oct. 4, 2024, 2:49 p.m. UTC | #1
On 2024-10-04 03:11, Mathieu Desnoyers wrote:
> Wire up the system call tracepoints with Tasks Trace RCU to allow
> the ftrace, perf, and eBPF tracers to handle page faults.
> 
> This series does the initial wire-up allowing tracers to handle page
> faults, but leaves out the actual handling of said page faults as future
> work.
> 
> This series was compile and runtime tested with ftrace and perf syscall
> tracing and raw syscall tracing, adding a WARN_ON_ONCE() in the
> generated code to validate that the intended probes are used for raw
> syscall tracing. The might_fault() added within those probes validate
> that they are called from a context where handling a page fault is OK.
> 
> This series replaces the "Faultable Tracepoints v6" series found at [1].
> 
> This has been rebased on v6.12-rc1 on top of two patches from Steven:
> 
> tracing: Remove definition of trace_*_rcuidle()
> tracepoint: Remove SRCU protection

I'll send an updated series which includes
"tracing: Declare system call tracepoints with TRACE_EVENT_SYSCALL"
(missing here), and which rework that patch to remove the mapping from
trace_sys_enter/exit to trace_syscall_sys_enter/exit which requires
modifying architecture code. A lot of churn for little value add.

Thanks,

Mathieu

> 
> Thanks,
> 
> Mathieu
> 
> Link: https://lore.kernel.org/lkml/20240828144153.829582-1-mathieu.desnoyers@efficios.com/ # [1]
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Alexei Starovoitov <ast@kernel.org>
> Cc: Yonghong Song <yhs@fb.com>
> Cc: Paul E. McKenney <paulmck@kernel.org>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com>
> Cc: bpf@vger.kernel.org
> Cc: Joel Fernandes <joel@joelfernandes.org>
> Cc: linux-trace-kernel@vger.kernel.org
> 
> Mathieu Desnoyers (7):
>    tracing/ftrace: guard syscall probe with preempt_notrace
>    tracing/perf: guard syscall probe with preempt_notrace
>    tracing/bpf: guard syscall probe with preempt_notrace
>    tracing: Allow system call tracepoints to handle page faults
>    tracing/ftrace: Add might_fault check to syscall probes
>    tracing/perf: Add might_fault check to syscall probes
>    tracing/bpf: Add might_fault check to syscall probes
> 
>   include/linux/tracepoint.h    | 18 ++++++++++-----
>   include/trace/bpf_probe.h     | 12 +++++++++-
>   include/trace/perf.h          | 42 +++++++++++++++++++++++++++++++----
>   include/trace/trace_events.h  | 39 ++++++++++++++++++++++++++------
>   init/Kconfig                  |  1 +
>   kernel/trace/trace_syscalls.c | 28 +++++++++++++++++++++++
>   6 files changed, 123 insertions(+), 17 deletions(-)
>