From: Catalin Marinas <catalin.marinas@arm.com>
To: Nam Cao <namcao@linutronix.de>
Cc: Steven Rostedt <rostedt@goodmis.org>,
Gabriele Monaco <gmonaco@redhat.com>,
linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org,
john.ogness@linutronix.de, Will Deacon <will@kernel.org>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v8 17/22] arm64: mm: Add page fault trace points
Date: Tue, 20 May 2025 15:15:01 +0100 [thread overview]
Message-ID: <aCyOZVVioijWpEPY@arm.com> (raw)
In-Reply-To: <20250520122548.lkvaylSB@linutronix.de>
On Tue, May 20, 2025 at 02:25:48PM +0200, Nam Cao wrote:
> On Mon, May 19, 2025 at 03:49:29PM +0100, Catalin Marinas wrote:
> > On Mon, May 12, 2025 at 12:51:00PM +0200, Nam Cao wrote:
> > > diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c
> > > index ec0a337891dd..55094030e377 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);
> > > @@ -559,6 +562,11 @@ static int __kprobes do_page_fault(unsigned long far, unsigned long esr,
> > > if (kprobe_page_fault(regs, esr))
> > > return 0;
> > >
> > > + if (user_mode(regs))
> > > + trace_page_fault_user(addr, regs, esr);
> > > + else
> > > + trace_page_fault_kernel(addr, regs, esr);
> >
> > What are the semantics for these tracepoints? When are they supposed to
> > be called? In the RV context context I guess you only care about the
> > benign, recoverable faults that would affect timing. These tracepoints
> > were generalised from the x86 code but I don't know enough about it to
> > tell when they would be invoked.
> >
> > For arm64, we also have the do_translation_fault() path for example that
> > may or may not need to log such trace events.
>
> These tracepoints are invoked for x86 page fault exceptions. Are arm64's
> translation faults considered equivalent to x86 page faults?
Probably. We route permission or access flag faults via do_page_fault()
directly while missing page table entries via do_translation_fault().
The latter end up in do_page_fault() only if the faulting address is in
the user address range.
My point was that we may not always invoke the trace callbacks if, for
example, the user tries to access the kernel space (and results in a
SIGSEGV). While that's fine for RV, I wanted to know what is expected of
these trace points in general. Do we need to log such SIGSEGV-generating
events? We do log them if there's a permission fault.
--
Catalin
next prev parent reply other threads:[~2025-05-20 14:15 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-12 10:50 [PATCH v8 00/22] RV: Linear temporal logic monitors for RT application Nam Cao
2025-05-12 10:50 ` [PATCH v8 01/22] rv: Add #undef TRACE_INCLUDE_FILE Nam Cao
2025-05-12 10:50 ` [PATCH v8 02/22] printk: Make vprintk_deferred() public Nam Cao
2025-05-12 10:50 ` [PATCH v8 03/22] panic: Add vpanic() Nam Cao
2025-05-12 10:50 ` [PATCH v8 04/22] rv: Let the reactors take care of buffers Nam Cao
2025-05-12 10:50 ` [PATCH v8 05/22] verification/dot2k: Make a separate dot2k_templates/Kconfig_container Nam Cao
2025-05-12 10:50 ` [PATCH v8 06/22] verification/dot2k: Remove __buff_to_string() Nam Cao
2025-05-12 10:50 ` [PATCH v8 07/22] verification/dot2k: Replace is_container() hack with subparsers Nam Cao
2025-05-12 10:50 ` [PATCH v8 08/22] rv: rename CONFIG_DA_MON_EVENTS to CONFIG_RV_MON_EVENTS Nam Cao
2025-05-12 10:50 ` [PATCH v8 09/22] verification/dot2k: Prepare the frontend for LTL inclusion Nam Cao
2025-05-12 10:50 ` [PATCH v8 10/22] Documentation/rv: Prepare monitor synthesis document " Nam Cao
2025-05-12 10:50 ` [PATCH v8 11/22] verification/rvgen: Restructure the templates files Nam Cao
2025-05-12 10:50 ` [PATCH v8 12/22] verification/rvgen: Restructure the classes to prepare for LTL inclusion Nam Cao
2025-05-12 10:50 ` [PATCH v8 13/22] rv: Add support for LTL monitors Nam Cao
2025-05-12 10:50 ` [PATCH v8 14/22] rv: Add rtapp container monitor Nam Cao
2025-05-12 10:50 ` [PATCH v8 15/22] x86/tracing: Remove redundant trace_pagefault_key Nam Cao
2025-05-12 10:50 ` [PATCH v8 16/22] x86/tracing: Move page fault trace points to generic Nam Cao
2025-05-12 10:51 ` [PATCH v8 17/22] arm64: mm: Add page fault trace points Nam Cao
2025-05-19 14:49 ` Catalin Marinas
2025-05-20 12:25 ` Nam Cao
2025-05-20 14:15 ` Catalin Marinas [this message]
2025-05-21 9:03 ` Nam Cao
2025-05-12 10:51 ` [PATCH v8 18/22] riscv: " Nam Cao
2025-05-12 10:51 ` [PATCH v8 19/22] rv: Add rtapp_pagefault monitor Nam Cao
2025-05-12 10:51 ` [PATCH v8 20/22] rv: Add rtapp_sleep monitor Nam Cao
2025-05-16 16:31 ` Gabriele Monaco
2025-05-19 7:04 ` Nam Cao
2025-05-19 7:54 ` Gabriele Monaco
2025-05-12 10:51 ` [PATCH v8 21/22] rv: Add documentation for rtapp monitor Nam Cao
2025-05-12 10:51 ` [PATCH v8 22/22] rv: Allow to configure the number of per-task monitor Nam Cao
2025-05-16 8:21 ` [PATCH v8 00/22] RV: Linear temporal logic monitors for RT application Ingo Molnar
2025-05-16 8:55 ` Nam Cao
2025-05-16 9:07 ` Nam Cao
2025-05-16 9:12 ` Ingo Molnar
2025-08-10 21:12 ` patchwork-bot+linux-riscv
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=aCyOZVVioijWpEPY@arm.com \
--to=catalin.marinas@arm.com \
--cc=gmonaco@redhat.com \
--cc=john.ogness@linutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=namcao@linutronix.de \
--cc=rostedt@goodmis.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;
as well as URLs for NNTP newsgroup(s).