Commit 4f0dfd76 authored by Jeremy Linton's avatar Jeremy Linton Committed by Steven Rostedt (VMware)

tracing: define TRACE_DEFINE_SIZEOF() macro to map sizeof's to their values

Perf has a problem that if sizeof() macros are used within TRACE_EVENT()
macro's they end up in userspace as "sizeof(kernel structure)" which
cannot properly be parsed. Add a macro which can forward this data
through the eval_map for userspace utilization.

Link: http://lkml.kernel.org/r/20170531215653.3240-10-jeremy.linton@arm.comSigned-off-by: default avatarJeremy Linton <jeremy.linton@arm.com>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent 67ec0d85
...@@ -88,6 +88,7 @@ extern void syscall_unregfunc(void); ...@@ -88,6 +88,7 @@ extern void syscall_unregfunc(void);
#define PARAMS(args...) args #define PARAMS(args...) args
#define TRACE_DEFINE_ENUM(x) #define TRACE_DEFINE_ENUM(x)
#define TRACE_DEFINE_SIZEOF(x)
#endif /* _LINUX_TRACEPOINT_H */ #endif /* _LINUX_TRACEPOINT_H */
......
...@@ -46,6 +46,19 @@ TRACE_MAKE_SYSTEM_STR(); ...@@ -46,6 +46,19 @@ TRACE_MAKE_SYSTEM_STR();
__attribute__((section("_ftrace_eval_map"))) \ __attribute__((section("_ftrace_eval_map"))) \
*TRACE_SYSTEM##_##a = &__##TRACE_SYSTEM##_##a *TRACE_SYSTEM##_##a = &__##TRACE_SYSTEM##_##a
#undef TRACE_DEFINE_SIZEOF
#define TRACE_DEFINE_SIZEOF(a) \
static struct trace_eval_map __used __initdata \
__##TRACE_SYSTEM##_##a = \
{ \
.system = TRACE_SYSTEM_STRING, \
.eval_string = "sizeof(" #a ")", \
.eval_value = sizeof(a) \
}; \
static struct trace_eval_map __used \
__attribute__((section("_ftrace_eval_map"))) \
*TRACE_SYSTEM##_##a = &__##TRACE_SYSTEM##_##a
/* /*
* DECLARE_EVENT_CLASS can be used to add a generic function * DECLARE_EVENT_CLASS can be used to add a generic function
* handlers for events. That is, if all events have the same * handlers for events. That is, if all events have the same
...@@ -158,6 +171,9 @@ TRACE_MAKE_SYSTEM_STR(); ...@@ -158,6 +171,9 @@ TRACE_MAKE_SYSTEM_STR();
#undef TRACE_DEFINE_ENUM #undef TRACE_DEFINE_ENUM
#define TRACE_DEFINE_ENUM(a) #define TRACE_DEFINE_ENUM(a)
#undef TRACE_DEFINE_SIZEOF
#define TRACE_DEFINE_SIZEOF(a)
#undef __field #undef __field
#define __field(type, item) #define __field(type, item)
......
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