diff options
| author | Masami Hiramatsu <mhiramat@redhat.com> | 2009-11-24 16:56:45 -0500 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2009-11-26 04:55:37 -0500 |
| commit | d1eb650ff4130972fa21462fa49cd35a2865403b (patch) | |
| tree | e43cee89ccad8adfa06f2e5f746ad96d2e00d9b3 | |
| parent | 80bbf6b641c8843b9d751a1f299aa7ee073ab9d4 (diff) | |
tracepoint: Move signal sending tracepoint to events/signal.h
Move signal sending event to events/signal.h. This patch also
renames sched_signal_send event to signal_generate.
Changes in v4:
- Fix a typo of task_struct pointer.
Changes in v3:
- Add docbook style comments
Changes in v2:
- Add siginfo argument
- Add siginfo storing macro
Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Reviewed-by: Jason Baron <jbaron@redhat.com>
Acked-by: Roland McGrath <roland@redhat.com>
Cc: systemtap <systemtap@sources.redhat.com>
Cc: DLE <dle-develop@lists.sourceforge.net>
Cc: Oleg Nesterov <oleg@redhat.com>
LKML-Reference: <20091124215645.30449.60208.stgit@dhcp-100-2-132.bos.redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
| -rw-r--r-- | Documentation/DocBook/tracepoint.tmpl | 5 | ||||
| -rw-r--r-- | include/trace/events/sched.h | 25 | ||||
| -rw-r--r-- | include/trace/events/signal.h | 66 | ||||
| -rw-r--r-- | kernel/signal.c | 5 |
4 files changed, 74 insertions, 27 deletions
diff --git a/Documentation/DocBook/tracepoint.tmpl b/Documentation/DocBook/tracepoint.tmpl index b0756d0fd579..8bca1d5cec09 100644 --- a/Documentation/DocBook/tracepoint.tmpl +++ b/Documentation/DocBook/tracepoint.tmpl | |||
| @@ -86,4 +86,9 @@ | |||
| 86 | !Iinclude/trace/events/irq.h | 86 | !Iinclude/trace/events/irq.h |
| 87 | </chapter> | 87 | </chapter> |
| 88 | 88 | ||
| 89 | <chapter id="signal"> | ||
| 90 | <title>SIGNAL</title> | ||
| 91 | !Iinclude/trace/events/signal.h | ||
| 92 | </chapter> | ||
| 93 | |||
| 89 | </book> | 94 | </book> |
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h index 9d316b22388c..cfceb0b73e20 100644 --- a/include/trace/events/sched.h +++ b/include/trace/events/sched.h | |||
| @@ -288,31 +288,6 @@ TRACE_EVENT(sched_process_fork, | |||
| 288 | ); | 288 | ); |
| 289 | 289 | ||
| 290 | /* | 290 | /* |
| 291 | * Tracepoint for sending a signal: | ||
| 292 | */ | ||
| 293 | TRACE_EVENT(sched_signal_send, | ||
| 294 | |||
| 295 | TP_PROTO(int sig, struct task_struct *p), | ||
| 296 | |||
| 297 | TP_ARGS(sig, p), | ||
| 298 | |||
| 299 | TP_STRUCT__entry( | ||
| 300 | __field( int, sig ) | ||
| 301 | __array( char, comm, TASK_COMM_LEN ) | ||
| 302 | __field( pid_t, pid ) | ||
| 303 | ), | ||
| 304 | |||
| 305 | TP_fast_assign( | ||
| 306 | memcpy(__entry->comm, p->comm, TASK_COMM_LEN); | ||
| 307 | __entry->pid = p->pid; | ||
| 308 | __entry->sig = sig; | ||
| 309 | ), | ||
| 310 | |||
| 311 | TP_printk("sig=%d comm=%s pid=%d", | ||
| 312 | __entry->sig, __entry->comm, __entry->pid) | ||
| 313 | ); | ||
| 314 | |||
| 315 | /* | ||
| 316 | * XXX the below sched_stat tracepoints only apply to SCHED_OTHER/BATCH/IDLE | 291 | * XXX the below sched_stat tracepoints only apply to SCHED_OTHER/BATCH/IDLE |
| 317 | * adding sched_stat support to SCHED_FIFO/RR would be welcome. | 292 | * adding sched_stat support to SCHED_FIFO/RR would be welcome. |
| 318 | */ | 293 | */ |
diff --git a/include/trace/events/signal.h b/include/trace/events/signal.h new file mode 100644 index 000000000000..ef51756a801d --- /dev/null +++ b/include/trace/events/signal.h | |||
| @@ -0,0 +1,66 @@ | |||
| 1 | #undef TRACE_SYSTEM | ||
| 2 | #define TRACE_SYSTEM signal | ||
| 3 | |||
| 4 | #if !defined(_TRACE_SIGNAL_H) || defined(TRACE_HEADER_MULTI_READ) | ||
| 5 | #define _TRACE_SIGNAL_H | ||
| 6 | |||
| 7 | #include <linux/signal.h> | ||
| 8 | #include <linux/sched.h> | ||
| 9 | #include <linux/tracepoint.h> | ||
| 10 | |||
| 11 | #define TP_STORE_SIGINFO(__entry, info) \ | ||
| 12 | do { \ | ||
| 13 | if (info == SEND_SIG_NOINFO) { \ | ||
| 14 | __entry->errno = 0; \ | ||
| 15 | __entry->code = SI_USER; \ | ||
| 16 | } else if (info == SEND_SIG_PRIV) { \ | ||
| 17 | __entry->errno = 0; \ | ||
| 18 | __entry->code = SI_KERNEL; \ | ||
| 19 | } else { \ | ||
| 20 | __entry->errno = info->si_errno; \ | ||
| 21 | __entry->code = info->si_code; \ | ||
| 22 | } \ | ||
| 23 | } while (0) | ||
| 24 | |||
| 25 | /** | ||
| 26 | * signal_generate - called when a signal is generated | ||
| 27 | * @sig: signal number | ||
| 28 | * @info: pointer to struct siginfo | ||
| 29 | * @task: pointer to struct task_struct | ||
| 30 | * | ||
| 31 | * Current process sends a 'sig' signal to 'task' process with | ||
| 32 | * 'info' siginfo. If 'info' is SEND_SIG_NOINFO or SEND_SIG_PRIV, | ||
| 33 | * 'info' is not a pointer and you can't access its field. Instead, | ||
| 34 | * SEND_SIG_NOINFO means that si_code is SI_USER, and SEND_SIG_PRIV | ||
| 35 | * means that si_code is SI_KERNEL. | ||
| 36 | */ | ||
| 37 | TRACE_EVENT(signal_generate, | ||
| 38 | |||
| 39 | TP_PROTO(int sig, struct siginfo *info, struct task_struct *task), | ||
| 40 | |||
| 41 | TP_ARGS(sig, info, task), | ||
| 42 | |||
| 43 | TP_STRUCT__entry( | ||
| 44 | __field( int, sig ) | ||
| 45 | __field( int, errno ) | ||
| 46 | __field( int, code ) | ||
| 47 | __array( char, comm, TASK_COMM_LEN ) | ||
| 48 | __field( pid_t, pid ) | ||
| 49 | ), | ||
| 50 | |||
| 51 | TP_fast_assign( | ||
| 52 | __entry->sig = sig; | ||
| 53 | TP_STORE_SIGINFO(__entry, info); | ||
| 54 | memcpy(__entry->comm, task->comm, TASK_COMM_LEN); | ||
| 55 | __entry->pid = task->pid; | ||
| 56 | ), | ||
| 57 | |||
| 58 | TP_printk("sig=%d errno=%d code=%d comm=%s pid=%d", | ||
| 59 | __entry->sig, __entry->errno, __entry->code, | ||
| 60 | __entry->comm, __entry->pid) | ||
| 61 | ); | ||
| 62 | |||
| 63 | #endif /* _TRACE_SIGNAL_H */ | ||
| 64 | |||
| 65 | /* This part must be outside protection */ | ||
| 66 | #include <trace/define_trace.h> | ||
diff --git a/kernel/signal.c b/kernel/signal.c index 6705320784fd..a1e0cc6b32c3 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
| @@ -27,7 +27,8 @@ | |||
| 27 | #include <linux/freezer.h> | 27 | #include <linux/freezer.h> |
| 28 | #include <linux/pid_namespace.h> | 28 | #include <linux/pid_namespace.h> |
| 29 | #include <linux/nsproxy.h> | 29 | #include <linux/nsproxy.h> |
| 30 | #include <trace/events/sched.h> | 30 | #define CREATE_TRACE_POINTS |
| 31 | #include <trace/events/signal.h> | ||
| 31 | 32 | ||
| 32 | #include <asm/param.h> | 33 | #include <asm/param.h> |
| 33 | #include <asm/uaccess.h> | 34 | #include <asm/uaccess.h> |
| @@ -834,7 +835,7 @@ static int __send_signal(int sig, struct siginfo *info, struct task_struct *t, | |||
| 834 | struct sigqueue *q; | 835 | struct sigqueue *q; |
| 835 | int override_rlimit; | 836 | int override_rlimit; |
| 836 | 837 | ||
| 837 | trace_sched_signal_send(sig, t); | 838 | trace_signal_generate(sig, info, t); |
| 838 | 839 | ||
| 839 | assert_spin_locked(&t->sighand->siglock); | 840 | assert_spin_locked(&t->sighand->siglock); |
| 840 | 841 | ||
