From mboxrd@z Thu Jan 1 00:00:00 1970 From: zhaolei@cn.fujitsu.com (Zhaolei) Date: Thu, 18 Dec 2008 11:03:03 +0800 Subject: [ltt-dev] [PATCH 2/2] tracepoints-kexec In-Reply-To: <4949BD17.2000704@cn.fujitsu.com> References: <4949BD17.2000704@cn.fujitsu.com> Message-ID: <4949BD67.40501@cn.fujitsu.com> Instrumentation of kexec related events : kernel_kexec and crash_kexec. It is useful for build flight-recorder program based on lttng infrastructure. Signed-off-by: Zhao lei --- include/trace/kexec.h | 14 ++++++++++++++ kernel/kexec.c | 8 ++++++++ 2 files changed, 22 insertions(+), 0 deletions(-) create mode 100644 include/trace/kexec.h diff --git a/include/trace/kexec.h b/include/trace/kexec.h new file mode 100644 index 0000000..928bdd2 --- /dev/null +++ b/include/trace/kexec.h @@ -0,0 +1,14 @@ +#ifndef _TRACE_KEXEC_H +#define _TRACE_KEXEC_H + +#include +#include + +DECLARE_TRACE(kexec_kernel_kexec, + TPPROTO(struct kimage *image), + TPARGS(image)); +DECLARE_TRACE(kexec_crash_kexec, + TPPROTO(struct kimage *image, struct pt_regs *regs), + TPARGS(image, regs)); + +#endif diff --git a/kernel/kexec.c b/kernel/kexec.c index aef2653..01ab16b 100644 --- a/kernel/kexec.c +++ b/kernel/kexec.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -37,6 +38,9 @@ #include #include +DEFINE_TRACE(kexec_kernel_kexec); +DEFINE_TRACE(kexec_crash_kexec); + /* Per cpu memory for storing cpu states in case of system crash. */ note_buf_t* crash_notes; @@ -1062,6 +1066,8 @@ asmlinkage long compat_sys_kexec_load(unsigned long entry, void crash_kexec(struct pt_regs *regs) { + trace_kexec_crash_kexec(kexec_crash_image, regs); + /* Take the kexec_mutex here to prevent sys_kexec_load * running on one cpu from replacing the crash kernel * we are using after a panic on a different cpu. @@ -1428,6 +1434,8 @@ int kernel_kexec(void) { int error = 0; + trace_kexec_kernel_kexec(kexec_image); + if (!mutex_trylock(&kexec_mutex)) return -EBUSY; if (!kexec_image) { -- 1.5.5.3