History

Merge branch 'tip/perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into perf/core

Ingo Molnar committed 15 years ago

Commit 9fb67202 parents 8c1df40 287050d7 files · +77 −18Browse files

Unified · Split

7 files
  1. include/linux/ftrace_event.h +4 −0
  2. include/linux/tracepoint.h +23 −6
  3. include/trace/define_trace.h +15 −0
  4. include/trace/ftrace.h +10 −4
  5. kernel/trace/trace_events.c +6 −0
  6. kernel/trace/trace_export.c +10 −4
  7. scripts/Makefile.build +9 −4
include/linux/ftrace_event.h+4−0
@@ -225,6 +225,10 @@ enum { · 224 unmodified lines
225 FILTER_PTR_STRING,225 FILTER_PTR_STRING,
226};226};
227 227
228#define EVENT_STORAGE_SIZE 128
229extern struct mutex event_storage_mutex;
230extern char event_storage[EVENT_STORAGE_SIZE];
231
228extern int trace_event_raw_init(struct ftrace_event_call *call);232extern int trace_event_raw_init(struct ftrace_event_call *call);
229extern int trace_define_field(struct ftrace_event_call *call, const char *type,233extern int trace_define_field(struct ftrace_event_call *call, const char *type,
230 const char *name, int offset, int size,234 const char *name, int offset, int size,
include/linux/tracepoint.h+23−6
@@ -106,6 +106,7 @@ static inline void tracepoint_update_probe_range(struct tracepoint *begin, · 105 unmodified lines
106 106
107#define TP_PROTO(args...) args107#define TP_PROTO(args...) args
108#define TP_ARGS(args...) args108#define TP_ARGS(args...) args
109#define TP_CONDITION(args...) args
109 110
110#ifdef CONFIG_TRACEPOINTS111#ifdef CONFIG_TRACEPOINTS
111 112
@@ -119,12 +120,14 @@ static inline void tracepoint_update_probe_range(struct tracepoint *begin, · 7 unmodified lines
119 * as "(void *, void)". The DECLARE_TRACE_NOARGS() will pass in just120 * as "(void *, void)". The DECLARE_TRACE_NOARGS() will pass in just
120 * "void *data", where as the DECLARE_TRACE() will pass in "void *data, proto".121 * "void *data", where as the DECLARE_TRACE() will pass in "void *data, proto".
121 */122 */
122#define __DO_TRACE(tp, proto, args) \123#define __DO_TRACE(tp, proto, args, cond) \
123 do { \124 do { \
124 struct tracepoint_func *it_func_ptr; \125 struct tracepoint_func *it_func_ptr; \
125 void *it_func; \126 void *it_func; \
126 void *__data; \127 void *__data; \
127 \128 \
129 if (!(cond)) \
130 return; \
128 rcu_read_lock_sched_notrace(); \131 rcu_read_lock_sched_notrace(); \
129 it_func_ptr = rcu_dereference_sched((tp)->funcs); \132 it_func_ptr = rcu_dereference_sched((tp)->funcs); \
130 if (it_func_ptr) { \133 if (it_func_ptr) { \
@@ -142,7 +145,7 @@ static inline void tracepoint_update_probe_range(struct tracepoint *begin, · 11 unmodified lines
142 * not add unwanted padding between the beginning of the section and the145 * not add unwanted padding between the beginning of the section and the
143 * structure. Force alignment to the same alignment as the section start.146 * structure. Force alignment to the same alignment as the section start.
144 */147 */
145#define __DECLARE_TRACE(name, proto, args, data_proto, data_args) \148#define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \
146 extern struct tracepoint __tracepoint_##name; \149 extern struct tracepoint __tracepoint_##name; \
147 static inline void trace_##name(proto) \150 static inline void trace_##name(proto) \
148 { \151 { \
@@ -151,7 +154,8 @@ static inline void tracepoint_update_probe_range(struct tracepoint *begin, · 2 unmodified lines
151do_trace: \154do_trace: \
152 __DO_TRACE(&__tracepoint_##name, \155 __DO_TRACE(&__tracepoint_##name, \
153 TP_PROTO(data_proto), \156 TP_PROTO(data_proto), \
154 TP_ARGS(data_args)); \157 TP_ARGS(data_args), \
158 TP_CONDITION(cond)); \
155 } \159 } \
156 static inline int \160 static inline int \
157 register_trace_##name(void (*probe)(data_proto), void *data) \161 register_trace_##name(void (*probe)(data_proto), void *data) \
@@ -186,7 +190,7 @@ do_trace: \ · 28 unmodified lines
186 EXPORT_SYMBOL(__tracepoint_##name)190 EXPORT_SYMBOL(__tracepoint_##name)
187 191
188#else /* !CONFIG_TRACEPOINTS */192#else /* !CONFIG_TRACEPOINTS */
189#define __DECLARE_TRACE(name, proto, args, data_proto, data_args) \193#define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \
190 static inline void trace_##name(proto) \194 static inline void trace_##name(proto) \
191 { } \195 { } \
192 static inline int \196 static inline int \
@@ -227,13 +231,18 @@ do_trace: \ · 34 unmodified lines
227 * "void *__data, proto" as the callback prototype.231 * "void *__data, proto" as the callback prototype.
228 */232 */
229#define DECLARE_TRACE_NOARGS(name) \233#define DECLARE_TRACE_NOARGS(name) \
230 __DECLARE_TRACE(name, void, , void *__data, __data)234 __DECLARE_TRACE(name, void, , 1, void *__data, __data)
231 235
232#define DECLARE_TRACE(name, proto, args) \236#define DECLARE_TRACE(name, proto, args) \
233 __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \237 __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), 1, \
234 PARAMS(void *__data, proto), \238 PARAMS(void *__data, proto), \
235 PARAMS(__data, args))239 PARAMS(__data, args))
236 240
241#define DECLARE_TRACE_CONDITION(name, proto, args, cond) \
242 __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), PARAMS(cond), \
243 PARAMS(void *__data, proto), \
244 PARAMS(__data, args))
245
237#define TRACE_EVENT_FLAGS(event, flag)246#define TRACE_EVENT_FLAGS(event, flag)
238 247
239#endif /* DECLARE_TRACE */248#endif /* DECLARE_TRACE */
@@ -349,12 +358,20 @@ do_trace: \ · 109 unmodified lines
349 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))358 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
350#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \359#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
351 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))360 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
361#define DEFINE_EVENT_CONDITION(template, name, proto, \
362 args, cond) \
363 DECLARE_TRACE_CONDITION(name, PARAMS(proto), \
364 PARAMS(args), PARAMS(cond))
352 365
353#define TRACE_EVENT(name, proto, args, struct, assign, print) \366#define TRACE_EVENT(name, proto, args, struct, assign, print) \
354 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))367 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
355#define TRACE_EVENT_FN(name, proto, args, struct, \368#define TRACE_EVENT_FN(name, proto, args, struct, \
356 assign, print, reg, unreg) \369 assign, print, reg, unreg) \
357 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))370 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
371#define TRACE_EVENT_CONDITION(name, proto, args, cond, \
372 struct, assign, print) \
373 DECLARE_TRACE_CONDITION(name, PARAMS(proto), \
374 PARAMS(args), PARAMS(cond))
358 375
359#define TRACE_EVENT_FLAGS(event, flag)376#define TRACE_EVENT_FLAGS(event, flag)
360 377
include/trace/define_trace.h+15−0
@@ -26,6 +26,15 @@ · 25 unmodified lines
26#define TRACE_EVENT(name, proto, args, tstruct, assign, print) \26#define TRACE_EVENT(name, proto, args, tstruct, assign, print) \
27 DEFINE_TRACE(name)27 DEFINE_TRACE(name)
28 28
29#undef TRACE_EVENT_CONDITION
30#define TRACE_EVENT_CONDITION(name, proto, args, cond, tstruct, assign, print) \
31 TRACE_EVENT(name, \
32 PARAMS(proto), \
33 PARAMS(args), \
34 PARAMS(tstruct), \
35 PARAMS(assign), \
36 PARAMS(print))
37
29#undef TRACE_EVENT_FN38#undef TRACE_EVENT_FN
30#define TRACE_EVENT_FN(name, proto, args, tstruct, \39#define TRACE_EVENT_FN(name, proto, args, tstruct, \
31 assign, print, reg, unreg) \40 assign, print, reg, unreg) \
@@ -39,6 +48,10 @@ · 7 unmodified lines
39#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \48#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
40 DEFINE_TRACE(name)49 DEFINE_TRACE(name)
41 50
51#undef DEFINE_EVENT_CONDITION
52#define DEFINE_EVENT_CONDITION(template, name, proto, args, cond) \
53 DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
54
42#undef DECLARE_TRACE55#undef DECLARE_TRACE
43#define DECLARE_TRACE(name, proto, args) \56#define DECLARE_TRACE(name, proto, args) \
44 DEFINE_TRACE(name)57 DEFINE_TRACE(name)
@@ -75,9 +88,11 @@ · 30 unmodified lines
75 88
76#undef TRACE_EVENT89#undef TRACE_EVENT
77#undef TRACE_EVENT_FN90#undef TRACE_EVENT_FN
91#undef TRACE_EVENT_CONDITION
78#undef DECLARE_EVENT_CLASS92#undef DECLARE_EVENT_CLASS
79#undef DEFINE_EVENT93#undef DEFINE_EVENT
80#undef DEFINE_EVENT_PRINT94#undef DEFINE_EVENT_PRINT
95#undef DEFINE_EVENT_CONDITION
81#undef TRACE_HEADER_MULTI_READ96#undef TRACE_HEADER_MULTI_READ
82#undef DECLARE_TRACE97#undef DECLARE_TRACE
83 98
include/trace/ftrace.h+10−4
@@ -296,13 +296,19 @@ static struct trace_event_functions ftrace_event_type_funcs_##call = { \ · 295 unmodified lines
296 296
297#undef __array297#undef __array
298#define __array(type, item, len) \298#define __array(type, item, len) \
299 BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \299 do { \
300 ret = trace_define_field(event_call, #type "[" #len "]", #item, \300 mutex_lock(&event_storage_mutex); \
301 BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \
302 snprintf(event_storage, sizeof(event_storage), \
303 "%s[%d]", #type, len); \
304 ret = trace_define_field(event_call, event_storage, #item, \
301 offsetof(typeof(field), item), \305 offsetof(typeof(field), item), \
302 sizeof(field.item), \306 sizeof(field.item), \
303 is_signed_type(type), FILTER_OTHER); \307 is_signed_type(type), FILTER_OTHER); \
304 if (ret) \308 mutex_unlock(&event_storage_mutex); \
305 return ret;309 if (ret) \
310 return ret; \
311 } while (0);
306 312
307#undef __dynamic_array313#undef __dynamic_array
308#define __dynamic_array(type, item, len) \314#define __dynamic_array(type, item, len) \
kernel/trace/trace_events.c+6−0
@@ -27,6 +27,12 @@ · 26 unmodified lines
27 27
28DEFINE_MUTEX(event_mutex);28DEFINE_MUTEX(event_mutex);
29 29
30DEFINE_MUTEX(event_storage_mutex);
31EXPORT_SYMBOL_GPL(event_storage_mutex);
32
33char event_storage[EVENT_STORAGE_SIZE];
34EXPORT_SYMBOL_GPL(event_storage);
35
30LIST_HEAD(ftrace_events);36LIST_HEAD(ftrace_events);
31LIST_HEAD(ftrace_common_fields);37LIST_HEAD(ftrace_common_fields);
32 38
kernel/trace/trace_export.c+10−4
@@ -83,13 +83,19 @@ static void __always_unused ____ftrace_check_##name(void) \ · 82 unmodified lines
83 83
84#undef __array84#undef __array
85#define __array(type, item, len) \85#define __array(type, item, len) \
86 BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \86 do { \
87 ret = trace_define_field(event_call, #type "[" #len "]", #item, \87 BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \
88 mutex_lock(&event_storage_mutex); \
89 snprintf(event_storage, sizeof(event_storage), \
90 "%s[%d]", #type, len); \
91 ret = trace_define_field(event_call, event_storage, #item, \
88 offsetof(typeof(field), item), \92 offsetof(typeof(field), item), \
89 sizeof(field.item), \93 sizeof(field.item), \
90 is_signed_type(type), FILTER_OTHER); \94 is_signed_type(type), FILTER_OTHER); \
91 if (ret) \95 mutex_unlock(&event_storage_mutex); \
92 return ret;96 if (ret) \
97 return ret; \
98 } while (0);
93 99
94#undef __array_desc100#undef __array_desc
95#define __array_desc(type, container, item, len) \101#define __array_desc(type, container, item, len) \
scripts/Makefile.build+9−4
@@ -214,17 +214,22 @@ ifdef BUILD_C_RECORDMCOUNT · 213 unmodified lines
214# The empty.o file is created in the make process in order to determine214# The empty.o file is created in the make process in order to determine
215# the target endianness and word size. It is made before all other C215# the target endianness and word size. It is made before all other C
216# files, including recordmcount.216# files, including recordmcount.
217cmd_record_mcount = if [ $(@) != "scripts/mod/empty.o" ]; then \217sub_cmd_record_mcount = \
218 $(objtree)/scripts/recordmcount "$(@)"; \218 if [ $(@) != "scripts/mod/empty.o" ]; then \
219 fi;219 $(objtree)/scripts/recordmcount "$(@)"; \
220 fi;
220else221else
221cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \222sub_cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \
222 "$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \223 "$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \
223 "$(if $(CONFIG_64BIT),64,32)" \224 "$(if $(CONFIG_64BIT),64,32)" \
224 "$(OBJDUMP)" "$(OBJCOPY)" "$(CC) $(KBUILD_CFLAGS)" \225 "$(OBJDUMP)" "$(OBJCOPY)" "$(CC) $(KBUILD_CFLAGS)" \
225 "$(LD)" "$(NM)" "$(RM)" "$(MV)" \226 "$(LD)" "$(NM)" "$(RM)" "$(MV)" \
226 "$(if $(part-of-module),1,0)" "$(@)";227 "$(if $(part-of-module),1,0)" "$(@)";
227endif228endif
229cmd_record_mcount = \
230 if [ "$(findstring -pg,$(_c_flags))" = "-pg" ]; then \
231 $(sub_cmd_record_mcount) \
232 fi;
228endif233endif
229 234
230define rule_cc_o_c235define rule_cc_o_c