Add page fault trace points, which are useful to implement RV monitor that watches page faults.
Signed-off-by: Nam Cao <[email protected]> Acked-by: Alexandre Ghiti <[email protected]> --- Cc: Paul Walmsley <[email protected]> Cc: Palmer Dabbelt <[email protected]> Cc: Albert Ou <[email protected]> Cc: [email protected] --- 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..03b048108896 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) @@ -288,6 +291,11 @@ void handle_page_fault(struct pt_regs *regs) tsk = current; mm = tsk->mm; + if (user_mode(regs)) + trace_page_fault_user(addr, regs, cause); + else + trace_page_fault_kernel(addr, regs, cause); + if (kprobe_page_fault(regs, cause)) return; -- 2.39.5
