Re: [PATCH v1 2/8] tracing/ftrace: guard syscall probe with preempt_notrace
From: Mathieu Desnoyers
Date: Fri Oct 04 2024 - 10:21:54 EST
On 2024-10-04 15:26, Steven Rostedt wrote:
On Thu, 3 Oct 2024 21:33:16 -0400
Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx> wrote:
On 2024-10-04 03:04, Steven Rostedt wrote:
On Thu, 3 Oct 2024 20:26:29 -0400
Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx> wrote:
[...]
So I rest my case. The change I'm introducing for tracepoints
don't make any assumptions about whether or not each tracer require
preempt off or not: it keeps the behavior the _same_ as it was before.
Then it's up to each tracer's developer to change the behavior of their
own callbacks as they see fit. But I'm not introducing regressions in
tracers with the "big switch" change of making syscall tracepoints
faultable. This will belong to changes that are specific to each tracer.
I rather remove these dependencies at the source. So, IMHO, these places
should be "fixed" first.
At least for the ftrace users. But I think the same can be done for the
other users as well. BPF already stated it just needs "migrate_disable()".
Let's see what perf has.
We can then audit all the tracepoint users to make sure they do not need
preemption disabled.
Why does it need to be a broad refactoring of the entire world ? What is
wrong with the simple approach of introducing this tracepoint faultable
syscall support as a no-op from the tracer's perspective ?
Because we want in-tree users too ;-)
This series is infrastructure work that allows all in-tree tracers to
start handling page faults for sys enter/exit events. Can we simply
do the tracer-specific work on top of this infrastructure series rather
than do everything at once ?
Regarding test coverage, this series modifies each tracer syscall probe
code to add a might_fault(), which ensures a page fault can indeed be
serviced at this point.
Then we can build on top and figure out if we want to relax things
on a tracer-per-tracer basis.
Looking deeper into how ftrace can implement this, it may require some more
work. Doing it your way may be fine for now, but we need this working for
something in-tree instead of having it only work for LTTng.
There is nothing LTTng-specific here. LTTng only has feature branches
to test it out for now. Once we have the infrastructure in place we
can discuss how each tracer can use this. I've recently enumerated
various approaches that can be taken by tracers to handle page faults:
https://lore.kernel.org/lkml/c2a2db4b-4409-4f3c-9959-53622fd8dfa7@xxxxxxxxxxxx/
Note, it doesn't have to be ftrace either. It could be perf or BPF. Or
simply the sframe code (doing stack traces at the entry of system calls).
Steven, we've been working on faultable tracepoints for four years now:
https://lore.kernel.org/lkml/20201023195352.26269-1-mjeanson@xxxxxxxxxxxx/ [2020]
https://lore.kernel.org/lkml/20210218222125.46565-1-mjeanson@xxxxxxxxxxxx/ [2021]
https://lore.kernel.org/lkml/20231002202531.3160-1-mathieu.desnoyers@xxxxxxxxxxxx/ [2023]
https://lore.kernel.org/lkml/20231120205418.334172-1-mathieu.desnoyers@xxxxxxxxxxxx/ [2023]
https://lore.kernel.org/lkml/20240626185941.68420-1-mathieu.desnoyers@xxxxxxxxxxxx/ [2024]
https://lore.kernel.org/lkml/20240828144153.829582-1-mathieu.desnoyers@xxxxxxxxxxxx/ [2024]
https://lore.kernel.org/lkml/20240909201652.319406-1-mathieu.desnoyers@xxxxxxxxxxxx/ [2024]
https://lore.kernel.org/lkml/20241003151638.1608537-1-mathieu.desnoyers@xxxxxxxxxxxx/ [2024] (current)
The eBPF people want to leverage this. When I last discussed this with
eBPF maintainers, they were open to adapt eBPF after this infrastructure
series is merged. Based on this eBPF attempt from 2022:
https://lore.kernel.org/lkml/c323bce9-a04e-b1c3-580a-783fde259d60@xxxxxx/
The sframe code is just getting in shape (2024), but is far from being ready.
Everyone appears to be waiting for this infrastructure work to go in
before they can build on top. Once this infrastructure is available,
multiple groups can start working on introducing use of this into their
own code in parallel.
Four years into this effort, and this is the first time we're told we need
to adapt in-tree tracers to handle the page faults before this can go in.
Could you please stop moving the goal posts ?
Thanks,
Mathieu
--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com