Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752766Ab3EIGGg (ORCPT ); Thu, 9 May 2013 02:06:36 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:41797 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752524Ab3EIGGb (ORCPT ); Thu, 9 May 2013 02:06:31 -0400 From: Francis Deslauriers To: linux-mm@kvack.org, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, rostedt@goodmis.org, fweisbec@gmail.com Cc: raphael.beamonte@gmail.com, mathieu.desnoyers@efficios.com, linux-kernel@vger.kernel.org, Francis Deslauriers Subject: [page fault tracepoint 2/2] x86:Instruments page fault trace event Date: Thu, 9 May 2013 02:05:20 -0400 Message-Id: <1368079520-11015-2-git-send-email-fdeslaur@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1368079520-11015-1-git-send-email-fdeslaur@gmail.com> References: <1368079520-11015-1-git-send-email-fdeslaur@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2552 Lines: 83 Signed-off-by: Francis Deslauriers Reviewed-by: Raphaƫl Beamonte --- arch/x86/mm/fault.c | 11 +++++++++++ mm/memory.c | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index 654be4a..e227828 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c @@ -20,6 +20,9 @@ #include /* kmemcheck_*(), ... */ #include /* VSYSCALL_START */ +#define CREATE_TRACE_POINTS +#include /* trace_page_fault_*(), ... */ + /* * Page fault error code bits: * @@ -756,12 +759,18 @@ __bad_area_nosemaphore(struct pt_regs *regs, unsigned long error_code, if (likely(show_unhandled_signals)) show_signal_msg(regs, error_code, address, tsk); + trace_page_fault_entry(regs, address, error_code & PF_WRITE); tsk->thread.cr2 = address; tsk->thread.error_code = error_code; tsk->thread.trap_nr = X86_TRAP_PF; force_sig_info_fault(SIGSEGV, si_code, address, tsk, 0); + /* + * Using -1 here, since there is no VM_FAULT flag to identify + * user accesses triggering SIGSEGV. + */ + trace_page_fault_exit(-1); return; } @@ -1185,7 +1194,9 @@ good_area: * make sure we exit gracefully rather than endlessly redo * the fault: */ + trace_page_fault_entry(regs, address, write); fault = handle_mm_fault(mm, vma, address, flags); + trace_page_fault_exit(fault); if (unlikely(fault & (VM_FAULT_RETRY|VM_FAULT_ERROR))) { if (mm_fault_error(regs, error_code, address, fault)) diff --git a/mm/memory.c b/mm/memory.c index 6dc1882..0bd86f8 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -67,6 +67,8 @@ #include #include +#include + #include "internal.h" #ifdef LAST_NID_NOT_IN_PAGE_FLAGS @@ -1829,8 +1831,11 @@ long __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, if (foll_flags & FOLL_NOWAIT) fault_flags |= (FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_RETRY_NOWAIT); + trace_page_fault_entry(0, start, + foll_flags & FOLL_WRITE); ret = handle_mm_fault(mm, vma, start, fault_flags); + trace_page_fault_exit(ret); if (ret & VM_FAULT_ERROR) { if (ret & VM_FAULT_OOM) -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/