12
12
#undef __perf_task
13
13
#define __perf_task (t ) (__task = (t))
14
14
15
- #undef DECLARE_EVENT_CLASS
16
- #define DECLARE_EVENT_CLASS (call , proto , args , tstruct , assign , print ) \
15
+ #undef __DECLARE_EVENT_CLASS
16
+ #define __DECLARE_EVENT_CLASS (call , proto , args , tstruct , assign , print ) \
17
17
static notrace void \
18
- perf_trace_ ##call(void *__data, proto) \
18
+ do_perf_trace_ ##call(void *__data, proto) \
19
19
{ \
20
20
struct trace_event_call *event_call = __data; \
21
21
struct trace_event_data_offsets_##call __maybe_unused __data_offsets;\
@@ -55,8 +55,39 @@ perf_trace_##call(void *__data, proto) \
55
55
head, __task); \
56
56
}
57
57
58
+ /*
59
+ * Define unused __count and __task variables to use @args to pass
60
+ * arguments to do_perf_trace_##call. This is needed because the
61
+ * macros __perf_count and __perf_task introduce the side-effect to
62
+ * store copies into those local variables.
63
+ */
64
+ #undef DECLARE_EVENT_CLASS
65
+ #define DECLARE_EVENT_CLASS (call , proto , args , tstruct , assign , print ) \
66
+ __DECLARE_EVENT_CLASS(call, PARAMS(proto), PARAMS(args), PARAMS(tstruct), \
67
+ PARAMS(assign), PARAMS(print)) \
68
+ static notrace void \
69
+ perf_trace_##call(void *__data, proto) \
70
+ { \
71
+ u64 __count __attribute__((unused)); \
72
+ struct task_struct *__task __attribute__((unused)); \
73
+ \
74
+ do_perf_trace_##call(__data, args); \
75
+ }
76
+
58
77
#undef DECLARE_EVENT_SYSCALL_CLASS
59
- #define DECLARE_EVENT_SYSCALL_CLASS DECLARE_EVENT_CLASS
78
+ #define DECLARE_EVENT_SYSCALL_CLASS (call , proto , args , tstruct , assign , print ) \
79
+ __DECLARE_EVENT_CLASS(call, PARAMS(proto), PARAMS(args), PARAMS(tstruct), \
80
+ PARAMS(assign), PARAMS(print)) \
81
+ static notrace void \
82
+ perf_trace_##call(void *__data, proto) \
83
+ { \
84
+ u64 __count __attribute__((unused)); \
85
+ struct task_struct *__task __attribute__((unused)); \
86
+ \
87
+ preempt_disable_notrace(); \
88
+ do_perf_trace_##call(__data, args); \
89
+ preempt_enable_notrace(); \
90
+ }
60
91
61
92
/*
62
93
* This part is compiled out, it is only here as a build time check
@@ -76,4 +107,7 @@ static inline void perf_test_probe_##call(void) \
76
107
DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
77
108
78
109
#include TRACE_INCLUDE (TRACE_INCLUDE_FILE )
110
+
111
+ #undef __DECLARE_EVENT_CLASS
112
+
79
113
#endif /* CONFIG_PERF_EVENTS */
0 commit comments