From: Luming Yu <luming.yu@intel.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] spurious check tace point
Date: Tue, 27 Nov 2018 13:16:12 +0200 [thread overview]
Message-ID: <20181127111612.74578-2-luming.yu@intel.com> (raw)
In-Reply-To: <20181127111612.74578-1-luming.yu@intel.com>
Add a trace point for debugging spurious fault problem.
Signed-off-by: Luming Yu <luming.yu@intel.com>
Signed-off-by: Yongkai Wu <yongkaiwu@tencent.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
prev parent reply other threads:[~2018-11-27 11:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-27 11:16 [PATCH 1/2] spurious check for user space address Luming Yu
2018-11-27 11:16 ` Luming Yu [this message]
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=20181127111612.74578-2-luming.yu@intel.com \
--to=luming.yu@intel.com \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®