From: Li Zefan <lizf@cn.fujitsu.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Frederic Weisbecker <fweisbec@gmail.com>,
Steven Rostedt <rostedt@goodmis.org>,
LKML <linux-kernel@vger.kernel.org>,
Eric Biederman <ebiederm@xmission.com>
Subject: [PATCH 2/2] tracing/events: Add kexec tracepoints
Date: Wed, 09 Sep 2009 09:15:31 +0800 [thread overview]
Message-ID: <4AA701B3.704@cn.fujitsu.com> (raw)
In-Reply-To: <4AA70198.9070500@cn.fujitsu.com>
When panic, save in ring buffer the time when crash happened,
the panic message, etc. And the data can be retrieved from
core dump file using flight-recorder, which is going to be a
module of the crash utility.
Also if we implement flight-recorder in perf tool, those trace
outputs can be used by perf tool.
---
include/trace/events/kexec.h | 51 ++++++++++++++++++++++++++++++++++++++++++
kernel/kexec.c | 4 +++
kernel/panic.c | 4 +++
3 files changed, 59 insertions(+), 0 deletions(-)
create mode 100644 include/trace/events/kexec.h
diff --git a/include/trace/events/kexec.h b/include/trace/events/kexec.h
new file mode 100644
index 0000000..c1d740a
--- /dev/null
+++ b/include/trace/events/kexec.h
@@ -0,0 +1,51 @@
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM kexec
+
+#if !defined(_TRACE_KEXEC_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_KEXEC_H
+
+#include <linux/kexec.h>
+#include <linux/tracepoint.h>
+
+TRACE_EVENT(panic,
+
+ TP_PROTO(const char *msg),
+
+ TP_ARGS(msg),
+
+ TP_STRUCT__entry(
+ __string( msg, msg )
+ ),
+
+ TP_fast_assign(
+ __assign_str(msg, msg);
+ ),
+
+ TP_printk("%s", __get_str(msg))
+);
+
+TRACE_EVENT(crash_kexec,
+
+ TP_PROTO(struct kimage *image, struct pt_regs *regs),
+
+ TP_ARGS(image, regs),
+
+ TP_STRUCT__entry(
+ __field( void *, image )
+ __field( void *, ip )
+ ),
+
+ TP_fast_assign(
+ __entry->image = image;
+ __entry->ip = regs ?
+ (void *)instruction_pointer(regs) : NULL;
+ ),
+
+ TP_printk("image=%p, ip=%p", __entry->image, __entry->ip)
+);
+
+#endif /* _TRACE_KEXEC_H */
+
+/* This part must be outside protection */
+#include <trace/define_trace.h>
+
diff --git a/kernel/kexec.c b/kernel/kexec.c
index f336e21..3d7eda7 100644
--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -38,6 +38,8 @@
#include <asm/system.h>
#include <asm/sections.h>
+#include <trace/events/kexec.h>
+
/* Per cpu memory for storing cpu states in case of system crash. */
note_buf_t* crash_notes;
@@ -1073,6 +1075,8 @@ void crash_kexec(struct pt_regs *regs)
if (mutex_trylock(&kexec_mutex)) {
if (kexec_crash_image) {
struct pt_regs fixed_regs;
+
+ trace_crash_kexec(kexec_crash_image, regs);
crash_setup_regs(&fixed_regs, regs);
crash_save_vmcoreinfo();
machine_crash_shutdown(&fixed_regs);
diff --git a/kernel/panic.c b/kernel/panic.c
index 22ec502..c3baa23 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -23,6 +23,9 @@
#include <linux/nmi.h>
#include <linux/dmi.h>
+#define CREATE_TRACE_POINTS
+#include <trace/events/kexec.h>
+
int panic_on_oops;
static unsigned long tainted_mask;
static int pause_on_oops;
@@ -69,6 +72,7 @@ NORET_TYPE void panic(const char * fmt, ...)
va_start(args, fmt);
vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args);
+ trace_panic(buf);
printk(KERN_EMERG "Kernel panic - not syncing: %s\n",buf);
#ifdef CONFIG_DEBUG_BUGVERBOSE
dump_stack();
--
1.6.3
next prev parent reply other threads:[~2009-09-09 1:16 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-09 1:15 [PATCH 1/2] tracing: Add sysctl to enable/disable tracing on oops Li Zefan
2009-09-09 1:15 ` Li Zefan [this message]
2009-09-09 1:20 ` [PATCH 2/2] tracing/events: Add kexec tracepoints Daniel Walker
2009-09-09 1:26 ` Li Zefan
2009-09-09 4:59 ` Daniel Walker
2009-09-09 11:46 ` Steven Rostedt
2009-09-09 14:12 ` Daniel Walker
2009-09-09 15:19 ` Steven Rostedt
2009-09-09 15:58 ` Daniel Walker
2009-09-09 1:27 ` Eric W. Biederman
2009-09-09 1:39 ` Steven Rostedt
2009-09-09 2:02 ` Eric W. Biederman
2009-09-09 1:34 ` [PATCH 1/2] tracing: Add sysctl to enable/disable tracing on oops Steven Rostedt
2009-09-09 1:37 ` Li Zefan
2009-09-09 1:42 ` Steven Rostedt
2009-09-09 1:47 ` Li Zefan
2009-09-09 2:04 ` Steven Rostedt
2009-09-09 2:33 ` KOSAKI Motohiro
2009-09-09 2:40 ` Li Zefan
2009-09-09 2:53 ` Steven Rostedt
2009-09-09 4:19 ` KOSAKI Motohiro
2009-09-09 11:48 ` Steven Rostedt
2009-09-09 3:01 ` KOSAKI Motohiro
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=4AA701B3.704@cn.fujitsu.com \
--to=lizf@cn.fujitsu.com \
--cc=ebiederm@xmission.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.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