All of lore.kernel.org
 help / color / mirror / Atom feed
From: credmonster@gmail.com (Chris Redmon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] arm64: Utilize trace events for major and minor page faults
Date: Wed, 12 Apr 2017 22:20:40 -0400	[thread overview]
Message-ID: <20170413022040.10156-4-credmonster@gmail.com> (raw)
In-Reply-To: <20170413022040.10156-1-credmonster@gmail.com>

Signed-off-by: Chris Redmon <credmonster@gmail.com>
---
 arch/arm64/mm/fault.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c
index 1b35b8bddbfb..d3097ff6fb8e 100644
--- a/arch/arm64/mm/fault.c
+++ b/arch/arm64/mm/fault.c
@@ -42,6 +42,9 @@
 #include <asm/pgtable.h>
 #include <asm/tlbflush.h>
 
+#define CREATE_TRACE_POINTS
+#include <trace/events/fault.h>
+
 struct fault_info {
 	int	(*fn)(unsigned long addr, unsigned int esr,
 		      struct pt_regs *regs);
@@ -315,6 +318,8 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr,
 	int fault, sig, code;
 	unsigned long vm_flags = VM_READ | VM_WRITE;
 	unsigned int mm_flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
+	ktime_t start_time;
+	bool trace_fault_enabled = false;
 
 	if (notify_page_fault(regs, esr))
 		return 0;
@@ -351,6 +356,11 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr,
 			die("Accessing user space memory outside uaccess.h routines", regs, esr);
 	}
 
+	if (trace_fault_major_enabled() || trace_fault_minor_enabled()) {
+		start_time = ktime_get();
+		trace_fault_enabled = true;
+	}
+
 	/*
 	 * As per x86, we may deadlock here. However, since the kernel only
 	 * validly references user space from well defined areas of the code,
@@ -395,10 +405,14 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr,
 			tsk->maj_flt++;
 			perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, regs,
 				      addr);
+			if (trace_fault_enabled)
+				trace_fault_major(addr, regs, esr, start_time, mm_flags, fault);
 		} else {
 			tsk->min_flt++;
 			perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, regs,
 				      addr);
+			if (trace_fault_enabled)
+				trace_fault_minor(addr, regs, esr, start_time, mm_flags, fault);
 		}
 		if (fault & VM_FAULT_RETRY) {
 			/*
-- 
2.12.2.599.gcf11a67

  parent reply	other threads:[~2017-04-13  2:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-13  2:20 [PATCH 0/3] Add fault_major, fault_minor page fault trace events Chris Redmon
2017-04-13  2:20 ` [PATCH 1/3] tracing: Introduce traces for major and minor page faults Chris Redmon
2017-04-13  2:20 ` [PATCH 2/3] arm: Utilize trace events " Chris Redmon
2017-04-13  2:20 ` Chris Redmon [this message]
2017-04-25 16:49 ` [PATCH 0/3] Add fault_major, fault_minor page fault trace events Will Deacon

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=20170413022040.10156-4-credmonster@gmail.com \
    --to=credmonster@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.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.