aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/trace_events.c12
-rw-r--r--kernel/trace/trace_export.c73
-rw-r--r--kernel/trace/trace_kprobe.c78
-rw-r--r--kernel/trace/trace_syscalls.c66
4 files changed, 0 insertions, 229 deletions
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 250ec865d5f5..c2a3077b7353 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -520,14 +520,6 @@ out:
520 return ret; 520 return ret;
521} 521}
522 522
523extern char *__bad_type_size(void);
524
525#undef FIELD
526#define FIELD(type, name) \
527 sizeof(type) != sizeof(field.name) ? __bad_type_size() : \
528 #type, "common_" #name, offsetof(typeof(field), name), \
529 sizeof(field.name), is_signed_type(type)
530
531static ssize_t 523static ssize_t
532event_format_read(struct file *filp, char __user *ubuf, size_t cnt, 524event_format_read(struct file *filp, char __user *ubuf, size_t cnt,
533 loff_t *ppos) 525 loff_t *ppos)
@@ -965,10 +957,6 @@ event_create_dir(struct ftrace_event_call *call, struct dentry *d_events,
965 filter); 957 filter);
966 } 958 }
967 959
968 /* A trace may not want to export its format */
969 if (!call->show_format)
970 return 0;
971
972 trace_create_file("format", 0444, call->dir, call, 960 trace_create_file("format", 0444, call->dir, call,
973 format); 961 format);
974 962
diff --git a/kernel/trace/trace_export.c b/kernel/trace/trace_export.c
index 95d14b640a66..e091f64ba6ce 100644
--- a/kernel/trace/trace_export.c
+++ b/kernel/trace/trace_export.c
@@ -62,78 +62,6 @@ static void __always_unused ____ftrace_check_##name(void) \
62 62
63#include "trace_entries.h" 63#include "trace_entries.h"
64 64
65
66#undef __field
67#define __field(type, item) \
68 ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \
69 "offset:%zu;\tsize:%zu;\tsigned:%u;\n", \
70 offsetof(typeof(field), item), \
71 sizeof(field.item), is_signed_type(type)); \
72 if (!ret) \
73 return 0;
74
75#undef __field_desc
76#define __field_desc(type, container, item) \
77 ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \
78 "offset:%zu;\tsize:%zu;\tsigned:%u;\n", \
79 offsetof(typeof(field), container.item), \
80 sizeof(field.container.item), \
81 is_signed_type(type)); \
82 if (!ret) \
83 return 0;
84
85#undef __array
86#define __array(type, item, len) \
87 ret = trace_seq_printf(s, "\tfield:" #type " " #item "[" #len "];\t" \
88 "offset:%zu;\tsize:%zu;\tsigned:%u;\n", \
89 offsetof(typeof(field), item), \
90 sizeof(field.item), is_signed_type(type)); \
91 if (!ret) \
92 return 0;
93
94#undef __array_desc
95#define __array_desc(type, container, item, len) \
96 ret = trace_seq_printf(s, "\tfield:" #type " " #item "[" #len "];\t" \
97 "offset:%zu;\tsize:%zu;\tsigned:%u;\n", \
98 offsetof(typeof(field), container.item), \
99 sizeof(field.container.item), \
100 is_signed_type(type)); \
101 if (!ret) \
102 return 0;
103
104#undef __dynamic_array
105#define __dynamic_array(type, item) \
106 ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \
107 "offset:%zu;\tsize:0;\tsigned:%u;\n", \
108 offsetof(typeof(field), item), \
109 is_signed_type(type)); \
110 if (!ret) \
111 return 0;
112
113#undef F_printk
114#define F_printk(fmt, args...) "%s, %s\n", #fmt, __stringify(args)
115
116#undef __entry
117#define __entry REC
118
119#undef FTRACE_ENTRY
120#define FTRACE_ENTRY(name, struct_name, id, tstruct, print) \
121static int \
122ftrace_format_##name(struct ftrace_event_call *unused, \
123 struct trace_seq *s) \
124{ \
125 struct struct_name field __attribute__((unused)); \
126 int ret = 0; \
127 \
128 tstruct; \
129 \
130 trace_seq_printf(s, "\nprint fmt: " print); \
131 \
132 return ret; \
133}
134
135#include "trace_entries.h"
136
137#undef __field 65#undef __field
138#define __field(type, item) \ 66#define __field(type, item) \
139 ret = trace_define_field(event_call, #type, #item, \ 67 ret = trace_define_field(event_call, #type, #item, \
@@ -235,7 +163,6 @@ __attribute__((section("_ftrace_events"))) event_##call = { \
235 .system = __stringify(TRACE_SYSTEM), \ 163 .system = __stringify(TRACE_SYSTEM), \
236 .raw_init = ftrace_raw_init_event, \ 164 .raw_init = ftrace_raw_init_event, \
237 .print_fmt = print, \ 165 .print_fmt = print, \
238 .show_format = ftrace_format_##call, \
239 .define_fields = ftrace_define_fields_##call, \ 166 .define_fields = ftrace_define_fields_##call, \
240}; \ 167}; \
241 168
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 147491dccead..c99029916c76 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -1174,82 +1174,6 @@ static int kretprobe_event_define_fields(struct ftrace_event_call *event_call)
1174 return 0; 1174 return 0;
1175} 1175}
1176 1176
1177static int __probe_event_show_format(struct trace_seq *s,
1178 struct trace_probe *tp, const char *fmt,
1179 const char *arg)
1180{
1181 int i;
1182
1183 /* Show format */
1184 if (!trace_seq_printf(s, "\nprint fmt: \"%s", fmt))
1185 return 0;
1186
1187 for (i = 0; i < tp->nr_args; i++)
1188 if (!trace_seq_printf(s, " %s=%%lx", tp->args[i].name))
1189 return 0;
1190
1191 if (!trace_seq_printf(s, "\", %s", arg))
1192 return 0;
1193
1194 for (i = 0; i < tp->nr_args; i++)
1195 if (!trace_seq_printf(s, ", REC->%s", tp->args[i].name))
1196 return 0;
1197
1198 return trace_seq_puts(s, "\n");
1199}
1200
1201#undef SHOW_FIELD
1202#define SHOW_FIELD(type, item, name) \
1203 do { \
1204 ret = trace_seq_printf(s, "\tfield:" #type " %s;\t" \
1205 "offset:%u;\tsize:%u;\tsigned:%d;\n", name,\
1206 (unsigned int)offsetof(typeof(field), item),\
1207 (unsigned int)sizeof(type), \
1208 is_signed_type(type)); \
1209 if (!ret) \
1210 return 0; \
1211 } while (0)
1212
1213static int kprobe_event_show_format(struct ftrace_event_call *call,
1214 struct trace_seq *s)
1215{
1216 struct kprobe_trace_entry field __attribute__((unused));
1217 int ret, i;
1218 struct trace_probe *tp = (struct trace_probe *)call->data;
1219
1220 SHOW_FIELD(unsigned long, ip, FIELD_STRING_IP);
1221 SHOW_FIELD(int, nargs, FIELD_STRING_NARGS);
1222
1223 /* Show fields */
1224 for (i = 0; i < tp->nr_args; i++)
1225 SHOW_FIELD(unsigned long, args[i], tp->args[i].name);
1226 trace_seq_puts(s, "\n");
1227
1228 return __probe_event_show_format(s, tp, "(%lx)",
1229 "REC->" FIELD_STRING_IP);
1230}
1231
1232static int kretprobe_event_show_format(struct ftrace_event_call *call,
1233 struct trace_seq *s)
1234{
1235 struct kretprobe_trace_entry field __attribute__((unused));
1236 int ret, i;
1237 struct trace_probe *tp = (struct trace_probe *)call->data;
1238
1239 SHOW_FIELD(unsigned long, func, FIELD_STRING_FUNC);
1240 SHOW_FIELD(unsigned long, ret_ip, FIELD_STRING_RETIP);
1241 SHOW_FIELD(int, nargs, FIELD_STRING_NARGS);
1242
1243 /* Show fields */
1244 for (i = 0; i < tp->nr_args; i++)
1245 SHOW_FIELD(unsigned long, args[i], tp->args[i].name);
1246 trace_seq_puts(s, "\n");
1247
1248 return __probe_event_show_format(s, tp, "(%lx <- %lx)",
1249 "REC->" FIELD_STRING_FUNC
1250 ", REC->" FIELD_STRING_RETIP);
1251}
1252
1253static int __set_print_fmt(struct trace_probe *tp, char *buf, int len) 1177static int __set_print_fmt(struct trace_probe *tp, char *buf, int len)
1254{ 1178{
1255 int i; 1179 int i;
@@ -1504,12 +1428,10 @@ static int register_probe_event(struct trace_probe *tp)
1504 if (probe_is_return(tp)) { 1428 if (probe_is_return(tp)) {
1505 tp->event.trace = print_kretprobe_event; 1429 tp->event.trace = print_kretprobe_event;
1506 call->raw_init = probe_event_raw_init; 1430 call->raw_init = probe_event_raw_init;
1507 call->show_format = kretprobe_event_show_format;
1508 call->define_fields = kretprobe_event_define_fields; 1431 call->define_fields = kretprobe_event_define_fields;
1509 } else { 1432 } else {
1510 tp->event.trace = print_kprobe_event; 1433 tp->event.trace = print_kprobe_event;
1511 call->raw_init = probe_event_raw_init; 1434 call->raw_init = probe_event_raw_init;
1512 call->show_format = kprobe_event_show_format;
1513 call->define_fields = kprobe_event_define_fields; 1435 call->define_fields = kprobe_event_define_fields;
1514 } 1436 }
1515 if (set_print_fmt(tp) < 0) 1437 if (set_print_fmt(tp) < 0)
diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c
index a78e86349ecb..49cea70fbf6d 100644
--- a/kernel/trace/trace_syscalls.c
+++ b/kernel/trace/trace_syscalls.c
@@ -143,54 +143,6 @@ extern char *__bad_type_size(void);
143 #type, #name, offsetof(typeof(trace), name), \ 143 #type, #name, offsetof(typeof(trace), name), \
144 sizeof(trace.name), is_signed_type(type) 144 sizeof(trace.name), is_signed_type(type)
145 145
146int syscall_enter_format(struct ftrace_event_call *call, struct trace_seq *s)
147{
148 int i;
149 int ret;
150 struct syscall_metadata *entry = call->data;
151 struct syscall_trace_enter trace;
152 int offset = offsetof(struct syscall_trace_enter, args);
153
154 ret = trace_seq_printf(s, "\tfield:%s %s;\toffset:%zu;\tsize:%zu;"
155 "\tsigned:%u;\n",
156 SYSCALL_FIELD(int, nr));
157 if (!ret)
158 return 0;
159
160 for (i = 0; i < entry->nb_args; i++) {
161 ret = trace_seq_printf(s, "\tfield:%s %s;", entry->types[i],
162 entry->args[i]);
163 if (!ret)
164 return 0;
165 ret = trace_seq_printf(s, "\toffset:%d;\tsize:%zu;"
166 "\tsigned:%u;\n", offset,
167 sizeof(unsigned long),
168 is_signed_type(unsigned long));
169 if (!ret)
170 return 0;
171 offset += sizeof(unsigned long);
172 }
173
174 trace_seq_puts(s, "\nprint fmt: \"");
175 for (i = 0; i < entry->nb_args; i++) {
176 ret = trace_seq_printf(s, "%s: 0x%%0%zulx%s", entry->args[i],
177 sizeof(unsigned long),
178 i == entry->nb_args - 1 ? "" : ", ");
179 if (!ret)
180 return 0;
181 }
182 trace_seq_putc(s, '"');
183
184 for (i = 0; i < entry->nb_args; i++) {
185 ret = trace_seq_printf(s, ", ((unsigned long)(REC->%s))",
186 entry->args[i]);
187 if (!ret)
188 return 0;
189 }
190
191 return trace_seq_putc(s, '\n');
192}
193
194static 146static
195int __set_enter_print_fmt(struct syscall_metadata *entry, char *buf, int len) 147int __set_enter_print_fmt(struct syscall_metadata *entry, char *buf, int len)
196{ 148{
@@ -252,24 +204,6 @@ static void free_syscall_print_fmt(struct ftrace_event_call *call)
252 kfree(call->print_fmt); 204 kfree(call->print_fmt);
253} 205}
254 206
255int syscall_exit_format(struct ftrace_event_call *call, struct trace_seq *s)
256{
257 int ret;
258 struct syscall_trace_exit trace;
259
260 ret = trace_seq_printf(s,
261 "\tfield:%s %s;\toffset:%zu;\tsize:%zu;"
262 "\tsigned:%u;\n"
263 "\tfield:%s %s;\toffset:%zu;\tsize:%zu;"
264 "\tsigned:%u;\n",
265 SYSCALL_FIELD(int, nr),
266 SYSCALL_FIELD(long, ret));
267 if (!ret)
268 return 0;
269
270 return trace_seq_printf(s, "\nprint fmt: \"0x%%lx\", REC->ret\n");
271}
272
273int syscall_enter_define_fields(struct ftrace_event_call *call) 207int syscall_enter_define_fields(struct ftrace_event_call *call)
274{ 208{
275 struct syscall_trace_enter trace; 209 struct syscall_trace_enter trace;