mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Nam Cao <namcao@linutronix.de>,
	Alexandre Ghiti <alexghiti@rivosinc.com>
Subject: [for-next][PATCH 08/12] riscv: mm: Add page fault trace points
Date: Wed, 09 Jul 2025 20:32:04 -0400	[thread overview]
Message-ID: <20250710003236.710679622@kernel.org> (raw)
In-Reply-To: <20250710003156.209859354@kernel.org>

From: Nam Cao <namcao@linutronix.de>

Add page fault trace points, which are useful to implement RV monitor that
watches page faults.

Signed-off-by: Nam Cao <namcao@linutronix.de>
Acked-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 arch/riscv/mm/fault.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/riscv/mm/fault.c b/arch/riscv/mm/fault.c
index 0194324a0c50..04ed6f8acae4 100644
--- a/arch/riscv/mm/fault.c
+++ b/arch/riscv/mm/fault.c
@@ -20,6 +20,9 @@
 #include <asm/ptrace.h>
 #include <asm/tlbflush.h>
 
+#define CREATE_TRACE_POINTS
+#include <trace/events/exceptions.h>
+
 #include "../kernel/head.h"
 
 static void show_pte(unsigned long addr)
@@ -291,6 +294,11 @@ void handle_page_fault(struct pt_regs *regs)
 	if (kprobe_page_fault(regs, cause))
 		return;
 
+	if (user_mode(regs))
+		trace_page_fault_user(addr, regs, cause);
+	else
+		trace_page_fault_kernel(addr, regs, cause);
+
 	/*
 	 * Fault-in kernel-space virtual memory on-demand.
 	 * The 'reference' page table is init_mm.pgd.
-- 
2.47.2



  parent reply	other threads:[~2025-07-10  0:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-10  0:31 [for-next][PATCH 00/12] tracing: rv: Updates for v6.17 Steven Rostedt
2025-07-10  0:31 ` [for-next][PATCH 01/12] rv: Add #undef TRACE_INCLUDE_FILE Steven Rostedt
2025-07-10  0:31 ` [for-next][PATCH 02/12] printk: Make vprintk_deferred() public Steven Rostedt
2025-07-10  0:31 ` [for-next][PATCH 03/12] panic: Add vpanic() Steven Rostedt
2025-07-10  0:32 ` [for-next][PATCH 04/12] rv: Let the reactors take care of buffers Steven Rostedt
2025-07-10  0:32 ` [for-next][PATCH 05/12] rv: rename CONFIG_DA_MON_EVENTS to CONFIG_RV_MON_EVENTS Steven Rostedt
2025-07-10  0:32 ` [for-next][PATCH 06/12] rv: Add support for LTL monitors Steven Rostedt
2025-07-10  0:32 ` [for-next][PATCH 07/12] rv: Add rtapp container monitor Steven Rostedt
2025-07-10  0:32 ` Steven Rostedt [this message]
2025-07-10  0:32 ` [for-next][PATCH 09/12] rv: Add rtapp_pagefault monitor Steven Rostedt
2025-07-10  0:32 ` [for-next][PATCH 10/12] rv: Add rtapp_sleep monitor Steven Rostedt
2025-07-10  0:32 ` [for-next][PATCH 11/12] rv: Add documentation for rtapp monitor Steven Rostedt
2025-07-10  0:32 ` [for-next][PATCH 12/12] rv: Allow to configure the number of per-task monitor Steven Rostedt

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=20250710003236.710679622@kernel.org \
    --to=rostedt@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=alexghiti@rivosinc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=namcao@linutronix.de \
    /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

all inboxes | Powered by JetHome®