From: Justinien Bouron <jbouron@amazon.com>
To: Leo Yan <leo.yan@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
David Hildenbrand <david@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Ryan Roberts <ryan.roberts@arm.com>,
Ada Couprie Diaz <ada.coupriediaz@arm.com>,
Kevin Brodsky <kevin.brodsky@arm.com>,
"Lorenzo Stoakes" <ljs@kernel.org>,
Quentin Perret <qperret@google.com>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>,
Gunnar Kudrjavets <gunnarku@amazon.com>
Subject: Re: [PATCH] arm64: Add user and kernel page-fault tracepoints
Date: Wed, 20 May 2026 09:45:32 -0700 [thread overview]
Message-ID: <ag3lLB3ep279D9iX@80a9970eed1e> (raw)
In-Reply-To: <20260520073606.GA101133@e132581.arm.com>
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/
WARNING: multiple messages have this Message-ID (diff)
From: Justinien Bouron <jbouron@amazon.com>
To: Leo Yan <leo.yan@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
Gunnar Kudrjavets <gunnarku@amazon.com>,
Ryan Roberts <ryan.roberts@arm.com>,
Quentin Perret <qperret@google.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Kevin Brodsky <kevin.brodsky@arm.com>,
linux-kernel@vger.kernel.org,
David Hildenbrand <david@kernel.org>,
Lorenzo Stoakes <ljs@kernel.org>, Will Deacon <will@kernel.org>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] arm64: Add user and kernel page-fault tracepoints
Date: Wed, 20 May 2026 09:45:32 -0700 [thread overview]
Message-ID: <ag3lLB3ep279D9iX@80a9970eed1e> (raw)
In-Reply-To: <20260520073606.GA101133@e132581.arm.com>
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/
next prev parent reply other threads:[~2026-05-20 16:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-20 4:55 [PATCH] arm64: Add user and kernel page-fault tracepoints Justinien Bouron
2026-05-20 7:36 ` Leo Yan
2026-05-20 7:36 ` Leo Yan
2026-05-20 16:45 ` Justinien Bouron [this message]
2026-05-20 16:45 ` Justinien Bouron
2026-09-09 13:13 ` Bouron, Justinien
2026-09-09 17:50 ` Leo Yan
2026-09-23 14:40 ` Catalin Marinas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ag3lLB3ep279D9iX@80a9970eed1e \
--to=jbouron@amazon.com \
--cc=ada.coupriediaz@arm.com \
--cc=catalin.marinas@arm.com \
--cc=david@kernel.org \
--cc=gunnarku@amazon.com \
--cc=kevin.brodsky@arm.com \
--cc=leo.yan@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ljs@kernel.org \
--cc=mark.rutland@arm.com \
--cc=qperret@google.com \
--cc=ryan.roberts@arm.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.