]>
Commit | Line | Data |
---|---|---|
2cb7cef9 BS |
1 | From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> |
2 | Subject: LTTng instrumentation - ipc | |
3 | ||
4 | Original patch header: | |
5 | LTTng instrumentation - ipc | |
6 | ||
7 | Interprocess communication, core events. | |
8 | ||
9 | Added tracepoints : | |
10 | ||
11 | ipc_msg_create | |
12 | ipc_sem_create | |
13 | ipc_shm_create | |
14 | ||
15 | Those tracepoints are used by LTTng. | |
16 | ||
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. | |
22 | ||
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> | |
32 | ||
33 | Acked-by: Jan Blunck <jblunck@suse.de> | |
34 | --- | |
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 | |
39 | @@ -38,6 +38,7 @@ | |
40 | #include <linux/rwsem.h> | |
41 | #include <linux/nsproxy.h> | |
42 | #include <linux/ipc_namespace.h> | |
43 | +#include <trace/ipc.h> | |
44 | ||
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; | |
51 | + long ret; | |
52 | ||
53 | ns = current->nsproxy->ipc_ns; | |
54 | ||
55 | @@ -324,7 +326,9 @@ asmlinkage long sys_msgget(key_t key, in | |
56 | msg_params.key = key; | |
57 | msg_params.flg = msgflg; | |
58 | ||
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); | |
62 | + return ret; | |
63 | } | |
64 | ||
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 | |
70 | @@ -83,6 +83,7 @@ | |
71 | #include <linux/rwsem.h> | |
72 | #include <linux/nsproxy.h> | |
73 | #include <linux/ipc_namespace.h> | |
74 | +#include <trace/ipc.h> | |
75 | ||
76 | #include <asm/uaccess.h> | |
77 | #include "util.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; | |
82 | + long err; | |
83 | ||
84 | ns = current->nsproxy->ipc_ns; | |
85 | ||
86 | @@ -327,7 +329,9 @@ asmlinkage long sys_semget(key_t key, in | |
87 | sem_params.flg = semflg; | |
88 | sem_params.u.nsems = nsems; | |
89 | ||
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); | |
93 | + return err; | |
94 | } | |
95 | ||
96 | /* | |
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 | |
101 | @@ -39,6 +39,7 @@ | |
102 | #include <linux/nsproxy.h> | |
103 | #include <linux/mount.h> | |
104 | #include <linux/ipc_namespace.h> | |
105 | +#include <trace/ipc.h> | |
106 | ||
107 | #include <asm/uaccess.h> | |
108 | ||
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; | |
113 | + long err; | |
114 | ||
115 | ns = current->nsproxy->ipc_ns; | |
116 | ||
117 | @@ -456,7 +458,9 @@ asmlinkage long sys_shmget (key_t key, s | |
118 | shm_params.flg = shmflg; | |
119 | shm_params.u.size = size; | |
120 | ||
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); | |
124 | + return err; | |
125 | } | |
126 | ||
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 | |
132 | @@ -0,0 +1,15 @@ | |
133 | +#ifndef _TRACE_IPC_H | |
134 | +#define _TRACE_IPC_H | |
135 | + | |
136 | +#include <linux/tracepoint.h> | |
137 | + | |
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)); | |
147 | +#endif |