[ltt-dev] [PATCH 2/1] tracepoints-panic

Zhaolei zhaolei at cn.fujitsu.com
Wed Dec 17 22:02:30 EST 2008


Instrumentation of panic related events : now include panic event only.
It is useful for build flight-recorder program based on lttng infrastructure.

Signed-off-by: Zhao lei <zhaolei at cn.fujitsu.com>
---
 include/trace/panic.h |   10 ++++++++++
 kernel/panic.c        |    7 +++++++
 2 files changed, 17 insertions(+), 0 deletions(-)
 create mode 100644 include/trace/panic.h

diff --git a/include/trace/panic.h b/include/trace/panic.h
new file mode 100644
index 0000000..eede4ca
--- /dev/null
+++ b/include/trace/panic.h
@@ -0,0 +1,10 @@
+#ifndef _TRACE_PANIC_H
+#define _TRACE_PANIC_H
+
+#include <linux/tracepoint.h>
+
+DECLARE_TRACE(panic_panic,
+	TPPROTO(const char *fmt, va_list args),
+	TPARGS(fmt, args));
+
+#endif
diff --git a/kernel/panic.c b/kernel/panic.c
index 12c5a0a..33b4440 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -21,6 +21,9 @@
 #include <linux/debug_locks.h>
 #include <linux/random.h>
 #include <linux/kallsyms.h>
+#include <trace/panic.h>
+
+DEFINE_TRACE(panic_panic);
 
 int panic_on_oops;
 int tainted;
@@ -68,6 +71,10 @@ NORET_TYPE void panic(const char * fmt, ...)
 	unsigned long caller = (unsigned long) __builtin_return_address(0);
 #endif
 
+	va_start(args, fmt);
+	trace_panic_panic(fmt, args);
+	va_end(args);
+
 	/*
 	 * It's possible to come here directly from a panic-assertion and not
 	 * have preempt disabled. Some functions called from here want
-- 
1.5.5.3






More information about the lttng-dev mailing list