From: Catalin Marinas <catalin.marinas@arm.com>
To: Balbir Singh <balbirs@nvidia.com>
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Will Deacon <will@kernel.org>,
Paul Walmsley <pjw@kernel.org>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Alexandre Ghiti <alex@ghiti.fr>
Subject: Re: [PATCH] arch/arm64/mm/fault: Implement exceptions tracepoints
Date: Mon, 3 Nov 2025 17:26:37 +0000 [thread overview]
Message-ID: <aQjlzbkdzzYL2xJR@arm.com> (raw)
In-Reply-To: <20251013035532.1793181-1-balbirs@nvidia.com>
On Mon, Oct 13, 2025 at 02:55:32PM +1100, Balbir Singh wrote:
> x86 and riscv provide trace points for page-faults (user and kernel
> tracepoints). Some scripts [1],[2] rely on these trace points. The
> tracepoint is useful for tracking faults and their reasons.
>
> Adding the tracepoints is simple and straight-forward. For arm64
> use esr as error code and untagged memory address as addr.
>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Paul Walmsley <pjw@kernel.org>
> Cc: Palmer Dabbelt <palmer@dabbelt.com>
> Cc: Albert Ou <aou@eecs.berkeley.edu>
> Cc: Alexandre Ghiti <alex@ghiti.fr>
>
> [1] https://www.brendangregg.com/FlameGraphs/memoryflamegraphs.html
> [2] https://taras.glek.net/posts/ebpf-mmap-page-fault-tracing/
> Signed-off-by: Balbir Singh <balbirs@nvidia.com>
> ---
>
> Tested at my end with a kernel-compile and running a user space
> program to check that the trace points are indeed reported.
>
> arch/arm64/mm/fault.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c
> index d816ff44faff..9d7b86e92434 100644
> --- a/arch/arm64/mm/fault.c
> +++ b/arch/arm64/mm/fault.c
> @@ -44,6 +44,9 @@
> #include <asm/tlbflush.h>
> #include <asm/traps.h>
>
> +#define CREATE_TRACE_POINTS
> +#include <trace/events/exceptions.h>
> +
> struct fault_info {
> int (*fn)(unsigned long far, unsigned long esr,
> struct pt_regs *regs);
> @@ -572,8 +575,12 @@ static int __kprobes do_page_fault(unsigned long far, unsigned long esr,
> if (faulthandler_disabled() || !mm)
> goto no_context;
>
> - if (user_mode(regs))
> + if (user_mode(regs)) {
> mm_flags |= FAULT_FLAG_USER;
> + trace_page_fault_user(addr, regs, esr);
> + } else {
> + trace_page_fault_kernel(addr, regs, esr);
> + }
This has come up before and rejected:
https://lore.kernel.org/all/aG0aIKzxApp9j7X0@willie-the-truck/
--
Catalin
next prev parent reply other threads:[~2025-11-03 17:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-13 3:55 [PATCH] arch/arm64/mm/fault: Implement exceptions tracepoints Balbir Singh
2025-10-13 4:45 ` Anshuman Khandual
2025-11-03 17:26 ` Catalin Marinas [this message]
2025-11-05 0:27 ` Balbir Singh
2025-11-11 20:13 ` 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=aQjlzbkdzzYL2xJR@arm.com \
--to=catalin.marinas@arm.com \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=balbirs@nvidia.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox