Commit 9fb67204 authored by Ingo Molnar's avatar Ingo Molnar

Merge branch 'tip/perf/core' of...

Merge branch 'tip/perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into perf/core
parents 8c1df400 287050d3
...@@ -225,6 +225,10 @@ enum { ...@@ -225,6 +225,10 @@ enum {
FILTER_PTR_STRING, FILTER_PTR_STRING,
}; };
#define EVENT_STORAGE_SIZE 128
extern struct mutex event_storage_mutex;
extern char event_storage[EVENT_STORAGE_SIZE];
extern int trace_event_raw_init(struct ftrace_event_call *call); extern int trace_event_raw_init(struct ftrace_event_call *call);
extern int trace_define_field(struct ftrace_event_call *call, const char *type, extern int trace_define_field(struct ftrace_event_call *call, const char *type,
const char *name, int offset, int size, const char *name, int offset, int size,
......
...@@ -106,6 +106,7 @@ static inline void tracepoint_update_probe_range(struct tracepoint *begin, ...@@ -106,6 +106,7 @@ static inline void tracepoint_update_probe_range(struct tracepoint *begin,
#define TP_PROTO(args...) args #define TP_PROTO(args...) args
#define TP_ARGS(args...) args #define TP_ARGS(args...) args
#define TP_CONDITION(args...) args
#ifdef CONFIG_TRACEPOINTS #ifdef CONFIG_TRACEPOINTS
...@@ -119,12 +120,14 @@ static inline void tracepoint_update_probe_range(struct tracepoint *begin, ...@@ -119,12 +120,14 @@ static inline void tracepoint_update_probe_range(struct tracepoint *begin,
* as "(void *, void)". The DECLARE_TRACE_NOARGS() will pass in just * as "(void *, void)". The DECLARE_TRACE_NOARGS() will pass in just
* "void *data", where as the DECLARE_TRACE() will pass in "void *data, proto". * "void *data", where as the DECLARE_TRACE() will pass in "void *data, proto".
*/ */
#define __DO_TRACE(tp, proto, args) \ #define __DO_TRACE(tp, proto, args, cond) \
do { \ do { \
struct tracepoint_func *it_func_ptr; \ struct tracepoint_func *it_func_ptr; \
void *it_func; \ void *it_func; \
void *__data; \ void *__data; \
\ \
if (!(cond)) \
return; \
rcu_read_lock_sched_notrace(); \ rcu_read_lock_sched_notrace(); \
it_func_ptr = rcu_dereference_sched((tp)->funcs); \ it_func_ptr = rcu_dereference_sched((tp)->funcs); \
if (it_func_ptr) { \ if (it_func_ptr) { \
...@@ -142,7 +145,7 @@ static inline void tracepoint_update_probe_range(struct tracepoint *begin, ...@@ -142,7 +145,7 @@ static inline void tracepoint_update_probe_range(struct tracepoint *begin,
* not add unwanted padding between the beginning of the section and the * not add unwanted padding between the beginning of the section and the
* structure. Force alignment to the same alignment as the section start. * structure. Force alignment to the same alignment as the section start.
*/ */
#define __DECLARE_TRACE(name, proto, args, data_proto, data_args) \ #define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \
extern struct tracepoint __tracepoint_##name; \ extern struct tracepoint __tracepoint_##name; \
static inline void trace_##name(proto) \ static inline void trace_##name(proto) \
{ \ { \
...@@ -151,7 +154,8 @@ static inline void tracepoint_update_probe_range(struct tracepoint *begin, ...@@ -151,7 +154,8 @@ static inline void tracepoint_update_probe_range(struct tracepoint *begin,
do_trace: \ do_trace: \
__DO_TRACE(&__tracepoint_##name, \ __DO_TRACE(&__tracepoint_##name, \
TP_PROTO(data_proto), \ TP_PROTO(data_proto), \
TP_ARGS(data_args)); \ TP_ARGS(data_args), \
TP_CONDITION(cond)); \
} \ } \
static inline int \ static inline int \
register_trace_##name(void (*probe)(data_proto), void *data) \ register_trace_##name(void (*probe)(data_proto), void *data) \
...@@ -186,7 +190,7 @@ do_trace: \ ...@@ -186,7 +190,7 @@ do_trace: \
EXPORT_SYMBOL(__tracepoint_##name) EXPORT_SYMBOL(__tracepoint_##name)
#else /* !CONFIG_TRACEPOINTS */ #else /* !CONFIG_TRACEPOINTS */
#define __DECLARE_TRACE(name, proto, args, data_proto, data_args) \ #define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \
static inline void trace_##name(proto) \ static inline void trace_##name(proto) \
{ } \ { } \
static inline int \ static inline int \
...@@ -227,13 +231,18 @@ do_trace: \ ...@@ -227,13 +231,18 @@ do_trace: \
* "void *__data, proto" as the callback prototype. * "void *__data, proto" as the callback prototype.
*/ */
#define DECLARE_TRACE_NOARGS(name) \ #define DECLARE_TRACE_NOARGS(name) \
__DECLARE_TRACE(name, void, , void *__data, __data) __DECLARE_TRACE(name, void, , 1, void *__data, __data)
#define DECLARE_TRACE(name, proto, args) \ #define DECLARE_TRACE(name, proto, args) \
__DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \ __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), 1, \
PARAMS(void *__data, proto), \ PARAMS(void *__data, proto), \
PARAMS(__data, args)) PARAMS(__data, args))
#define DECLARE_TRACE_CONDITION(name, proto, args, cond) \
__DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), PARAMS(cond), \
PARAMS(void *__data, proto), \
PARAMS(__data, args))
#define TRACE_EVENT_FLAGS(event, flag) #define TRACE_EVENT_FLAGS(event, flag)
#endif /* DECLARE_TRACE */ #endif /* DECLARE_TRACE */
...@@ -349,12 +358,20 @@ do_trace: \ ...@@ -349,12 +358,20 @@ do_trace: \
DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
#define DEFINE_EVENT_CONDITION(template, name, proto, \
args, cond) \
DECLARE_TRACE_CONDITION(name, PARAMS(proto), \
PARAMS(args), PARAMS(cond))
#define TRACE_EVENT(name, proto, args, struct, assign, print) \ #define TRACE_EVENT(name, proto, args, struct, assign, print) \
DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
#define TRACE_EVENT_FN(name, proto, args, struct, \ #define TRACE_EVENT_FN(name, proto, args, struct, \
assign, print, reg, unreg) \ assign, print, reg, unreg) \
DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
#define TRACE_EVENT_CONDITION(name, proto, args, cond, \
struct, assign, print) \
DECLARE_TRACE_CONDITION(name, PARAMS(proto), \
PARAMS(args), PARAMS(cond))
#define TRACE_EVENT_FLAGS(event, flag) #define TRACE_EVENT_FLAGS(event, flag)
......
...@@ -26,6 +26,15 @@ ...@@ -26,6 +26,15 @@
#define TRACE_EVENT(name, proto, args, tstruct, assign, print) \ #define TRACE_EVENT(name, proto, args, tstruct, assign, print) \
DEFINE_TRACE(name) DEFINE_TRACE(name)
#undef TRACE_EVENT_CONDITION
#define TRACE_EVENT_CONDITION(name, proto, args, cond, tstruct, assign, print) \
TRACE_EVENT(name, \
PARAMS(proto), \
PARAMS(args), \
PARAMS(tstruct), \
PARAMS(assign), \
PARAMS(print))
#undef TRACE_EVENT_FN #undef TRACE_EVENT_FN
#define TRACE_EVENT_FN(name, proto, args, tstruct, \ #define TRACE_EVENT_FN(name, proto, args, tstruct, \
assign, print, reg, unreg) \ assign, print, reg, unreg) \
...@@ -39,6 +48,10 @@ ...@@ -39,6 +48,10 @@
#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
DEFINE_TRACE(name) DEFINE_TRACE(name)
#undef DEFINE_EVENT_CONDITION
#define DEFINE_EVENT_CONDITION(template, name, proto, args, cond) \
DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
#undef DECLARE_TRACE #undef DECLARE_TRACE
#define DECLARE_TRACE(name, proto, args) \ #define DECLARE_TRACE(name, proto, args) \
DEFINE_TRACE(name) DEFINE_TRACE(name)
...@@ -75,9 +88,11 @@ ...@@ -75,9 +88,11 @@
#undef TRACE_EVENT #undef TRACE_EVENT
#undef TRACE_EVENT_FN #undef TRACE_EVENT_FN
#undef TRACE_EVENT_CONDITION
#undef DECLARE_EVENT_CLASS #undef DECLARE_EVENT_CLASS
#undef DEFINE_EVENT #undef DEFINE_EVENT
#undef DEFINE_EVENT_PRINT #undef DEFINE_EVENT_PRINT
#undef DEFINE_EVENT_CONDITION
#undef TRACE_HEADER_MULTI_READ #undef TRACE_HEADER_MULTI_READ
#undef DECLARE_TRACE #undef DECLARE_TRACE
......
...@@ -296,13 +296,19 @@ static struct trace_event_functions ftrace_event_type_funcs_##call = { \ ...@@ -296,13 +296,19 @@ static struct trace_event_functions ftrace_event_type_funcs_##call = { \
#undef __array #undef __array
#define __array(type, item, len) \ #define __array(type, item, len) \
BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \ do { \
ret = trace_define_field(event_call, #type "[" #len "]", #item, \ mutex_lock(&event_storage_mutex); \
BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \
snprintf(event_storage, sizeof(event_storage), \
"%s[%d]", #type, len); \
ret = trace_define_field(event_call, event_storage, #item, \
offsetof(typeof(field), item), \ offsetof(typeof(field), item), \
sizeof(field.item), \ sizeof(field.item), \
is_signed_type(type), FILTER_OTHER); \ is_signed_type(type), FILTER_OTHER); \
if (ret) \ mutex_unlock(&event_storage_mutex); \
return ret; if (ret) \
return ret; \
} while (0);
#undef __dynamic_array #undef __dynamic_array
#define __dynamic_array(type, item, len) \ #define __dynamic_array(type, item, len) \
......
...@@ -27,6 +27,12 @@ ...@@ -27,6 +27,12 @@
DEFINE_MUTEX(event_mutex); DEFINE_MUTEX(event_mutex);
DEFINE_MUTEX(event_storage_mutex);
EXPORT_SYMBOL_GPL(event_storage_mutex);
char event_storage[EVENT_STORAGE_SIZE];
EXPORT_SYMBOL_GPL(event_storage);
LIST_HEAD(ftrace_events); LIST_HEAD(ftrace_events);
LIST_HEAD(ftrace_common_fields); LIST_HEAD(ftrace_common_fields);
......
...@@ -83,13 +83,19 @@ static void __always_unused ____ftrace_check_##name(void) \ ...@@ -83,13 +83,19 @@ static void __always_unused ____ftrace_check_##name(void) \
#undef __array #undef __array
#define __array(type, item, len) \ #define __array(type, item, len) \
BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \ do { \
ret = trace_define_field(event_call, #type "[" #len "]", #item, \ BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \
mutex_lock(&event_storage_mutex); \
snprintf(event_storage, sizeof(event_storage), \
"%s[%d]", #type, len); \
ret = trace_define_field(event_call, event_storage, #item, \
offsetof(typeof(field), item), \ offsetof(typeof(field), item), \
sizeof(field.item), \ sizeof(field.item), \
is_signed_type(type), FILTER_OTHER); \ is_signed_type(type), FILTER_OTHER); \
if (ret) \ mutex_unlock(&event_storage_mutex); \
return ret; if (ret) \
return ret; \
} while (0);
#undef __array_desc #undef __array_desc
#define __array_desc(type, container, item, len) \ #define __array_desc(type, container, item, len) \
......
...@@ -214,17 +214,22 @@ ifdef BUILD_C_RECORDMCOUNT ...@@ -214,17 +214,22 @@ ifdef BUILD_C_RECORDMCOUNT
# The empty.o file is created in the make process in order to determine # The empty.o file is created in the make process in order to determine
# the target endianness and word size. It is made before all other C # the target endianness and word size. It is made before all other C
# files, including recordmcount. # files, including recordmcount.
cmd_record_mcount = if [ $(@) != "scripts/mod/empty.o" ]; then \ sub_cmd_record_mcount = \
$(objtree)/scripts/recordmcount "$(@)"; \ if [ $(@) != "scripts/mod/empty.o" ]; then \
fi; $(objtree)/scripts/recordmcount "$(@)"; \
fi;
else else
cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \ sub_cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \
"$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \ "$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \
"$(if $(CONFIG_64BIT),64,32)" \ "$(if $(CONFIG_64BIT),64,32)" \
"$(OBJDUMP)" "$(OBJCOPY)" "$(CC) $(KBUILD_CFLAGS)" \ "$(OBJDUMP)" "$(OBJCOPY)" "$(CC) $(KBUILD_CFLAGS)" \
"$(LD)" "$(NM)" "$(RM)" "$(MV)" \ "$(LD)" "$(NM)" "$(RM)" "$(MV)" \
"$(if $(part-of-module),1,0)" "$(@)"; "$(if $(part-of-module),1,0)" "$(@)";
endif endif
cmd_record_mcount = \
if [ "$(findstring -pg,$(_c_flags))" = "-pg" ]; then \
$(sub_cmd_record_mcount) \
fi;
endif endif
define rule_cc_o_c define rule_cc_o_c
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment