[PATCH] arm64: Add user and kernel page-fault tracepoints
Justinien Bouron
jbouron at amazon.com
Wed May 20 09:45:32 PDT 2026
On Wed, May 20, 2026 at 08:36:06AM +0100, Leo Yan wrote:
> On Tue, May 19, 2026 at 09:55:24PM -0700, Justinien Bouron wrote:
>
> [...]
>
> > @@ -606,6 +609,11 @@ static int __kprobes do_page_fault(unsigned long far, unsigned long esr,
> > int si_code;
> > int pkey = -1;
> >
> > + if (user_mode(regs))
> > + trace_page_fault_user(addr, regs, esr);
> > + else
> > + trace_page_fault_kernel(addr, regs, esr);
>
> Based on the discussion [1], Arm64 has already supported perf sw event
> for page-faults:
>
> perf record -e page-faults ...
>
> Seems there have a plan to consolidate perf event and tracepoints but I
> have no idea how it is going.
This refactor/consolidation is not specific to arm64 right? I see that both x86
and riscv also have both the tracepoints and the perf event, presumably they
will need to be refactored as well?
> I would leave this to maintainers.
Agreed.
>
> > +
> > if (kprobe_page_fault(regs, esr))
> > return 0;
>
> tracepoints should be after kprobe_page_fault(), as explained [2] by Mark.
Interesting. The reason I put them before the kprobe_page_fault is because this
is how x86 is doing it. x86 calls kprobe_page_fault from do_kern_addr_fault /
do_user_addr_fault which are called _after_ the trace_page_fault_{user,kernel}.
Is there a reason why this is allowed in x86 but not arm64?
Also I did not realize that there already was an attempt to add the page-fault
tracepoints in the past!
Best,
Justinien
>
> Thanks,
> Leo
>
> [1] https://lore.kernel.org/all/20250520140453.GA18711@willie-the-truck/
> [2] https://lore.kernel.org/all/aCtZfiU8bgkSAgLh@J2N7QTR9R3/
More information about the linux-arm-kernel
mailing list