From: Alexis Berlemont <alexis.berlemont@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Alexis Berlemont <alexis.berlemont@gmail.com>,
peterz@infradead.org, mingo@redhat.com, acme@kernel.org,
alexander.shishkin@linux.intel.com
Subject: [PATCH v3 1/2] perf, x86-mm: declare page-faults tracepoints like irq-vectors ones
Date: Fri, 18 Nov 2016 01:21:37 +0100 [thread overview]
Message-ID: <20161118002138.29150-2-alexis.berlemont@gmail.com> (raw)
In-Reply-To: <20161118002138.29150-1-alexis.berlemont@gmail.com>
In-Reply-To: <20161027083714.GF3568@worktop.programming.kicks-ass.net>
The tracepoints "exceptions:page_fault_(user|kernel)" were renamed
"exceptions:page_fault_(user|kernel)_entry". Two more tracepoints were
added: "exceptions:page_fault_(user|kernel)_exit". These events are
called right before and after __do_page_fault().
Signed-off-by: Alexis Berlemont <alexis.berlemont@gmail.com>
---
arch/x86/include/asm/trace/exceptions.h | 17 ++++++++++++++++-
arch/x86/mm/fault.c | 17 ++++++++++++++---
2 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/arch/x86/include/asm/trace/exceptions.h b/arch/x86/include/asm/trace/exceptions.h
index 2fbc66c..ecbe64e 100644
--- a/arch/x86/include/asm/trace/exceptions.h
+++ b/arch/x86/include/asm/trace/exceptions.h
@@ -33,14 +33,29 @@ DECLARE_EVENT_CLASS(x86_exceptions,
__entry->error_code) );
#define DEFINE_PAGE_FAULT_EVENT(name) \
-DEFINE_EVENT_FN(x86_exceptions, name, \
+DEFINE_EVENT_FN(x86_exceptions, name##_entry, \
+ TP_PROTO(unsigned long address, struct pt_regs *regs, \
+ unsigned long error_code), \
+ TP_ARGS(address, regs, error_code), \
+ trace_irq_vector_regfunc, \
+ trace_irq_vector_unregfunc); \
+DEFINE_EVENT_FN(x86_exceptions, name##_exit, \
TP_PROTO(unsigned long address, struct pt_regs *regs, \
unsigned long error_code), \
TP_ARGS(address, regs, error_code), \
trace_irq_vector_regfunc, \
trace_irq_vector_unregfunc);
+/*
+ * page_fault_user - called when entering/exiting a page fault in
+ * user-space
+ */
DEFINE_PAGE_FAULT_EVENT(page_fault_user);
+
+/*
+ * page_fault_kernel - called when entering/exiting a page fault in
+ * kernel-space
+ */
DEFINE_PAGE_FAULT_EVENT(page_fault_kernel);
#undef TRACE_INCLUDE_PATH
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 9f72ca3..2ed2716 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -1465,12 +1465,22 @@ NOKPROBE_SYMBOL(do_page_fault);
#ifdef CONFIG_TRACING
static nokprobe_inline void
trace_page_fault_entries(unsigned long address, struct pt_regs *regs,
- unsigned long error_code)
+ unsigned long error_code)
{
if (user_mode(regs))
- trace_page_fault_user(address, regs, error_code);
+ trace_page_fault_user_entry(address, regs, error_code);
else
- trace_page_fault_kernel(address, regs, error_code);
+ trace_page_fault_kernel_entry(address, regs, error_code);
+}
+
+static nokprobe_inline void
+trace_page_fault_exits(unsigned long address, struct pt_regs *regs,
+ unsigned long error_code)
+{
+ if (user_mode(regs))
+ trace_page_fault_user_exit(address, regs, error_code);
+ else
+ trace_page_fault_kernel_exit(address, regs, error_code);
}
dotraplinkage void notrace
@@ -1488,6 +1498,7 @@ trace_do_page_fault(struct pt_regs *regs, unsigned long error_code)
prev_state = exception_enter();
trace_page_fault_entries(address, regs, error_code);
__do_page_fault(regs, error_code, address);
+ trace_page_fault_exits(address, regs, error_code);
exception_exit(prev_state);
}
NOKPROBE_SYMBOL(trace_do_page_fault);
--
2.10.2
next prev parent reply other threads:[~2016-11-18 0:26 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-25 23:51 [PATCH 0/2] perf: measure page fault duration in perf trace Alexis Berlemont
2016-10-25 23:51 ` [PATCH 1/2] perf, x86-mm: Add exit-fault tracing Alexis Berlemont
2016-10-26 8:51 ` Peter Zijlstra
2016-10-26 18:53 ` Arnaldo Carvalho de Melo
2016-10-27 8:37 ` Peter Zijlstra
2016-10-27 23:31 ` [PATCH v2] perf, x86-mm: declare page-faults tracepoints like irq-vectors ones Alexis Berlemont
2016-10-27 23:31 ` Alexis Berlemont
2016-11-18 0:21 ` [PATCH v3 0/2] perf: measure page fault duration in perf trace Alexis Berlemont
2016-12-05 23:40 ` Alexis Berlemont
2016-12-06 14:46 ` Arnaldo Carvalho de Melo
2016-11-18 0:21 ` Alexis Berlemont [this message]
2016-11-18 0:21 ` [PATCH v3 2/2] perf: add page fault duration measures " Alexis Berlemont
2016-10-27 8:38 ` [PATCH 1/2] perf, x86-mm: Add exit-fault tracing Peter Zijlstra
2016-10-25 23:52 ` [PATCH 2/2] perf: add page fault duration measures in perf trace Alexis Berlemont
2016-10-26 8:46 ` [PATCH 0/2] perf: measure page fault duration " Peter Zijlstra
2016-10-26 18:47 ` Arnaldo Carvalho de Melo
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=20161118002138.29150-2-alexis.berlemont@gmail.com \
--to=alexis.berlemont@gmail.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@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 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).