public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@redhat.com>
To: Ingo Molnar <mingo@elte.hu>, lkml<linux-kernel@vger.kernel.org>
Cc: systemtap<systemtap@sources.redhat.com>,
	        DLE<dle-develop@lists.sourceforge.net>,
	        Masami Hiramatsu <mhiramat@redhat.com>,
	        Roland McGrath <roland@redhat.com>
Subject: [PATCH -tip 2/3] Add coredump tracepoint
Date: Fri, 13 Nov 2009 22:52:00 -0000	[thread overview]
Message-ID: <20091113225233.15079.41600.stgit@harusame> (raw)
In-Reply-To: <20091113225226.15079.90813.stgit@harusame>

Add coredump tracepoint for tracing coredump event. This event shows coredump
caused signal, limit size, dumpable flag, dump-filter, and core name.

Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Cc: Roland McGrath <roland@redhat.com>
---

 fs/exec.c                    |    9 +++++++++
 include/trace/events/sched.h |   34 ++++++++++++++++++++++++++++++++++
 2 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/fs/exec.c b/fs/exec.c
index dc418e3..6b77d10 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -56,6 +56,7 @@
 #include <linux/fsnotify.h>
 #include <linux/fs_struct.h>
 #include <linux/pipe_fs_i.h>
+#include <trace/events/sched.h>
 
 #include <asm/uaccess.h>
 #include <asm/mmu_context.h>
@@ -1907,6 +1908,14 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
 	if (!ispipe && do_truncate(file->f_path.dentry, 0, 0, file) != 0)
 		goto close_fail;
 
+	/*
+	 * Trace core dump event.
+	 * Casting signr to int is safe because it comes from
+	 * si->signo int field.
+	 */
+	trace_sched_process_coredump((int)signr, core_limit, mm_flags,
+				     corename);
+
 	retval = binfmt->core_dump(signr, regs, file, core_limit, mm_flags);
 
 	if (retval)
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index b50b985..ff9d5fb 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -320,6 +320,40 @@ TRACE_EVENT(sched_process_fork,
 );
 
 /*
+ * Tracepoint for core_dump:
+ */
+TRACE_EVENT(sched_process_coredump,
+
+	TP_PROTO(int sig, unsigned long core_limit, unsigned long mm_flags,
+		 const char *core_name),
+
+	TP_ARGS(sig, core_limit, mm_flags, core_name),
+
+	TP_STRUCT__entry(
+		__field(	int,		sig		)
+		__field(	unsigned long,	limit		)
+		__field(	unsigned long,	flags		)
+		__string(	name,		core_name	)
+	),
+
+
+	TP_fast_assign(
+		__entry->sig	= sig;
+		__entry->limit	= core_limit;
+		__entry->flags	= mm_flags;
+		__assign_str(name,	core_name);
+	),
+
+	TP_printk("sig: %d limit: %lu dumpable: %lx dump_filter: %lx "
+		  "corename: %s",
+		  __entry->sig, __entry->limit,
+		  __entry->flags & MMF_DUMPABLE_MASK,
+		  (__entry->flags & MMF_DUMP_FILTER_MASK) >>
+		  MMF_DUMP_FILTER_SHIFT,
+		  __get_str(name))
+);
+
+/*
  * Tracepoint for sending a signal:
  */
 TRACE_EVENT(sched_signal_send,


-- 
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America), Inc.
Software Solutions Division

e-mail: mhiramat@redhat.com

  parent reply	other threads:[~2009-11-13 22:52 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-13 22:52 [PATCH -tip 1/3] Pass mm->flags to binfmt core_dump for bitflag consistency Masami Hiramatsu
2009-11-13 22:52 ` [PATCH -tip 3/3] Add get_signal tracepoint Masami Hiramatsu
2009-11-13 23:53   ` Roland McGrath
2009-11-14  0:12     ` Ingo Molnar
2009-11-16 21:52       ` Masami Hiramatsu
2009-11-16 22:11         ` Roland McGrath
2009-11-16 22:40           ` Masami Hiramatsu
2009-11-16 23:01             ` Roland McGrath
2009-11-16 23:46               ` Masami Hiramatsu
2009-11-17  6:03         ` Ingo Molnar
2009-11-17 15:25           ` Masami Hiramatsu
2009-11-14  0:29     ` Masami Hiramatsu
2009-11-13 22:52 ` Masami Hiramatsu [this message]
2009-11-13 23:39   ` [PATCH -tip 2/3] Add coredump tracepoint Roland McGrath
2009-11-14  0:00     ` Masami Hiramatsu
2009-11-14  0:02     ` Ingo Molnar
2009-11-14  0:06       ` Roland McGrath
2009-11-14  0:14         ` Ingo Molnar
2009-11-14  1:49           ` Roland McGrath
2009-11-14  0:26         ` Masami Hiramatsu
2009-11-13 23:09 ` [PATCH -tip 1/3] Pass mm->flags to binfmt core_dump for bitflag consistency Andrew Morton
2009-11-13 23:25   ` Ingo Molnar
2009-11-13 23:45     ` Masami Hiramatsu
2009-11-13 23:16 ` Roland McGrath
2009-11-13 23:23   ` Ingo Molnar
2009-11-13 23:30     ` Roland McGrath

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=20091113225233.15079.41600.stgit@harusame \
    --to=mhiramat@redhat.com \
    --cc=dle-develop@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=roland@redhat.com \
    --cc=systemtap@sources.redhat.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).