[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20181127111612.74578-2-luming.yu@intel.com>
Date: Tue, 27 Nov 2018 13:16:12 +0200
From: Luming Yu <luming.yu@...el.com>
To: linux-kernel@...r.kernel.org
Subject: [PATCH 2/2] spurious check tace point
Add a trace point for debugging spurious fault problem.
Signed-off-by: Luming Yu <luming.yu@...el.com>
Signed-off-by: Yongkai Wu <yongkaiwu@...cent.com>
---
arch/x86/include/asm/trace/exceptions.h | 30 ++++++++++++++++++++++++++++++
arch/x86/mm/fault.c | 2 ++
2 files changed, 32 insertions(+)
diff --git a/arch/x86/include/asm/trace/exceptions.h b/arch/x86/include/asm/trace/exceptions.h
index 69615e387973..0cae50c5fcb2 100644
--- a/arch/x86/include/asm/trace/exceptions.h
+++ b/arch/x86/include/asm/trace/exceptions.h
@@ -44,6 +44,36 @@ DEFINE_EVENT_FN(x86_exceptions, name, \
DEFINE_PAGE_FAULT_EVENT(page_fault_user);
DEFINE_PAGE_FAULT_EVENT(page_fault_kernel);
+DECLARE_EVENT_CLASS(spurious_fault_check,
+
+ TP_PROTO(unsigned long error_code,
+ unsigned long pte),
+ TP_ARGS(error_code,
+ pte),
+ TP_STRUCT__entry(
+ __field(unsigned long, error_code)
+ __field(unsigned long, pte)
+ ),
+ TP_fast_assign(
+ __entry->error_code = error_code;
+ __entry->pte = pte;
+ ),
+ TP_printk("error_code=%lx pte=%lx",
+ __entry->error_code,
+ __entry->pte
+ )
+);
+
+#define DEFINE_SPURIOUS_FAULT_CHECK_EVENT(name) \
+DEFINE_EVENT_FN(spurious_fault_check, name, \
+ TP_PROTO(unsigned long error_code, \
+ unsigned long pte), \
+ TP_ARGS(error_code, pte), \
+ trace_pagefault_reg, \
+ trace_pagefault_unreg);
+
+DEFINE_SPURIOUS_FAULT_CHECK_EVENT(spurious_fault_1_sample);
+
#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH .
#define TRACE_INCLUDE_FILE exceptions
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 5e2a49010d87..aa9bc9609c68 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -1001,6 +1001,8 @@ static int spurious_kernel_fault_check(unsigned long error_code, pte_t *pte)
if ((error_code & X86_PF_INSTR) && !pte_exec(*pte))
return 0;
+ trace_spurious_fault_1_sample(error_code, (unsigned long)pte);
+
return 1;
}
--
2.14.4
Powered by blists - more mailing lists