lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20161027233134.12117-2-alexis.berlemont@gmail.com>
Date:   Fri, 28 Oct 2016 01:31:34 +0200
From:   Alexis Berlemont <alexis.berlemont@...il.com>
To:     linux-kernel@...r.kernel.org
Cc:     Alexis Berlemont <alexis.berlemont@...il.com>,
        peterz@...radead.org, mingo@...hat.com, acme@...nel.org,
        alexander.shishkin@...ux.intel.com
Subject: [PATCH v2] perf, x86-mm: declare page-faults tracepoints like irq-vectors ones

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@...il.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.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ