1 From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
2 Subject: LTTng instrumentation - ipc
5 LTTng instrumentation - ipc
7 Interprocess communication, core events.
15 Those tracepoints are used by LTTng.
17 About the performance impact of tracepoints (which is comparable to markers),
18 even without immediate values optimizations, tests done by Hideo Aoki on ia64
19 show no regression. His test case was using hackbench on a kernel where
20 scheduler instrumentation (about 5 events in code scheduler code) was added.
21 See the "Tracepoints" patch header for performance result detail.
23 Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
24 CC: Masami Hiramatsu <mhiramat@redhat.com>
25 CC: 'Peter Zijlstra' <peterz@infradead.org>
26 CC: "Frank Ch. Eigler" <fche@redhat.com>
27 CC: 'Ingo Molnar' <mingo@elte.hu>
28 CC: 'Hideo AOKI' <haoki@redhat.com>
29 CC: Takashi Nishiie <t-nishiie@np.css.fujitsu.com>
30 CC: 'Steven Rostedt' <rostedt@goodmis.org>
31 CC: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
33 Acked-by: Jan Blunck <jblunck@suse.de>
35 Index: linux-2.6-lttng/ipc/msg.c
36 ===================================================================
37 --- linux-2.6-lttng.orig/ipc/msg.c 2008-08-06 00:41:47.000000000 -0400
38 +++ linux-2.6-lttng/ipc/msg.c 2008-08-06 01:04:20.000000000 -0400
40 #include <linux/rwsem.h>
41 #include <linux/nsproxy.h>
42 #include <linux/ipc_namespace.h>
43 +#include <trace/ipc.h>
45 #include <asm/current.h>
46 #include <asm/uaccess.h>
47 @@ -314,6 +315,7 @@ asmlinkage long sys_msgget(key_t key, in
48 struct ipc_namespace *ns;
49 struct ipc_ops msg_ops;
50 struct ipc_params msg_params;
53 ns = current->nsproxy->ipc_ns;
55 @@ -324,7 +326,9 @@ asmlinkage long sys_msgget(key_t key, in
57 msg_params.flg = msgflg;
59 - return ipcget(ns, &msg_ids(ns), &msg_ops, &msg_params);
60 + ret = ipcget(ns, &msg_ids(ns), &msg_ops, &msg_params);
61 + trace_ipc_msg_create(ret, msgflg);
65 static inline unsigned long
66 Index: linux-2.6-lttng/ipc/sem.c
67 ===================================================================
68 --- linux-2.6-lttng.orig/ipc/sem.c 2008-08-06 00:41:47.000000000 -0400
69 +++ linux-2.6-lttng/ipc/sem.c 2008-08-06 01:04:20.000000000 -0400
71 #include <linux/rwsem.h>
72 #include <linux/nsproxy.h>
73 #include <linux/ipc_namespace.h>
74 +#include <trace/ipc.h>
76 #include <asm/uaccess.h>
78 @@ -313,6 +314,7 @@ asmlinkage long sys_semget(key_t key, in
79 struct ipc_namespace *ns;
80 struct ipc_ops sem_ops;
81 struct ipc_params sem_params;
84 ns = current->nsproxy->ipc_ns;
86 @@ -327,7 +329,9 @@ asmlinkage long sys_semget(key_t key, in
87 sem_params.flg = semflg;
88 sem_params.u.nsems = nsems;
90 - return ipcget(ns, &sem_ids(ns), &sem_ops, &sem_params);
91 + err = ipcget(ns, &sem_ids(ns), &sem_ops, &sem_params);
92 + trace_ipc_sem_create(err, semflg);
97 Index: linux-2.6-lttng/ipc/shm.c
98 ===================================================================
99 --- linux-2.6-lttng.orig/ipc/shm.c 2008-08-06 00:41:47.000000000 -0400
100 +++ linux-2.6-lttng/ipc/shm.c 2008-08-06 01:04:20.000000000 -0400
102 #include <linux/nsproxy.h>
103 #include <linux/mount.h>
104 #include <linux/ipc_namespace.h>
105 +#include <trace/ipc.h>
107 #include <asm/uaccess.h>
109 @@ -445,6 +446,7 @@ asmlinkage long sys_shmget (key_t key, s
110 struct ipc_namespace *ns;
111 struct ipc_ops shm_ops;
112 struct ipc_params shm_params;
115 ns = current->nsproxy->ipc_ns;
117 @@ -456,7 +458,9 @@ asmlinkage long sys_shmget (key_t key, s
118 shm_params.flg = shmflg;
119 shm_params.u.size = size;
121 - return ipcget(ns, &shm_ids(ns), &shm_ops, &shm_params);
122 + err = ipcget(ns, &shm_ids(ns), &shm_ops, &shm_params);
123 + trace_ipc_shm_create(err, shmflg);
127 static inline unsigned long copy_shmid_to_user(void __user *buf, struct shmid64_ds *in, int version)
128 Index: linux-2.6-lttng/include/trace/ipc.h
129 ===================================================================
130 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
131 +++ linux-2.6-lttng/include/trace/ipc.h 2008-08-06 01:04:20.000000000 -0400
133 +#ifndef _TRACE_IPC_H
134 +#define _TRACE_IPC_H
136 +#include <linux/tracepoint.h>
138 +DEFINE_TRACE(ipc_msg_create,
139 + TPPROTO(long id, int flags),
140 + TPARGS(id, flags));
141 +DEFINE_TRACE(ipc_sem_create,
142 + TPPROTO(long id, int flags),
143 + TPARGS(id, flags));
144 +DEFINE_TRACE(ipc_shm_create,
145 + TPPROTO(long id, int flags),
146 + TPARGS(id, flags));