Subject: Re: [PATCH] arm64: Add user and kernel page-fault tracepoints

From: Leo Yan <[email-masked]>
Date: Wed, 20 May 2026 08:36:06 +0100

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. I would leave this to maintainers.

> +
>  	if (kprobe_page_fault(regs, esr))
>  		return 0;

tracepoints should be after kprobe_page_fault(), as explained [2] by Mark.

Thanks,
Leo

[1] https://lore.kernel.org/all/20250520140453.GA18711@willie-the-truck/
[2] https://lore.kernel.org/all/aCtZfiU8bgkSAgLh@J2N7QTR9R3/