x86, trace: Add page fault tracepoints
This patch introduces page fault tracepoints to x86 architecture by switching IDT. Two events, for user and kernel spaces, are introduced at the beginning of page fault handler for tracing. - User space event There is a request of page fault event for user space as below. https://lkml.kernel.org/r/1368079520-11015-2-git-send-email-fdeslaur+()+gmail+!+com https://lkml.kernel.org/r/1368079520-11015-1-git-send-email-fdeslaur+()+gmail+!+com - Kernel space event: When we measure an overhead in kernel space for investigating performance issues, we can check if it comes from the page fault events. Signed-off-by: Seiji Aguchi <seiji.aguchi@hds.com> Link: http://lkml.kernel.org/r/52716E67.6090705@hds.com Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
This commit is contained in:

committed by
H. Peter Anvin

parent
ac7956e269
commit
d34603b07c
@@ -20,6 +20,9 @@
|
||||
#include <asm/kmemcheck.h> /* kmemcheck_*(), ... */
|
||||
#include <asm/fixmap.h> /* VSYSCALL_START */
|
||||
|
||||
#define CREATE_TRACE_POINTS
|
||||
#include <asm/trace/exceptions.h>
|
||||
|
||||
/*
|
||||
* Page fault error code bits:
|
||||
*
|
||||
@@ -1232,12 +1235,22 @@ do_page_fault(struct pt_regs *regs, unsigned long error_code)
|
||||
exception_exit(prev_state);
|
||||
}
|
||||
|
||||
static void trace_page_fault_entries(struct pt_regs *regs,
|
||||
unsigned long error_code)
|
||||
{
|
||||
if (user_mode(regs))
|
||||
trace_user_page_fault(read_cr2(), regs, error_code);
|
||||
else
|
||||
trace_kernel_page_fault(read_cr2(), regs, error_code);
|
||||
}
|
||||
|
||||
dotraplinkage void __kprobes
|
||||
trace_do_page_fault(struct pt_regs *regs, unsigned long error_code)
|
||||
{
|
||||
enum ctx_state prev_state;
|
||||
|
||||
prev_state = exception_enter();
|
||||
trace_page_fault_entries(regs, error_code);
|
||||
__do_page_fault(regs, error_code);
|
||||
exception_exit(prev_state);
|
||||
}
|
||||
|
Reference in New Issue
Block a user