diff options
author | Steven Rostedt <srostedt@redhat.com> | 2010-05-05 10:52:31 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2010-05-05 11:46:17 -0400 |
commit | 2e26ca7150a4f2ab3e69471dfc65f131e7dd7a05 (patch) | |
tree | 6570a1670df3baafc7ab95b7f718a5dc2d04bd53 /include | |
parent | 03d646e62b06e9364e2dbb939d67934c6c9826cd (diff) |
tracing: Fix tracepoint.h DECLARE_TRACE() to allow more than one header
When more than one header is included under CREATE_TRACE_POINTS
the DECLARE_TRACE() macro is not defined back to its original meaning
and the second include will fail to initialize the TRACE_EVENT()
and DECLARE_TRACE() correctly.
To fix this the tracepoint.h file moves the define of DECLARE_TRACE()
out of the #ifdef _LINUX_TRACEPOINT_H protection (just like the
define of the TRACE_EVENT()). This way the define_trace.h will undef
the DECLARE_TRACE() at the end and allow new headers to start
from scratch.
This patch also requires fixing the include/events/napi.h
It currently uses DECLARE_TRACE() and should be converted to a TRACE_EVENT()
format. But I'll leave that change to the authors of that file.
But since the napi.h file depends on using the CREATE_TRACE_POINTS
and does not define its own DEFINE_TRACE() it must use the define_trace.h
method instead.
Cc: Neil Horman <nhorman@tuxdriver.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/tracepoint.h | 114 | ||||
-rw-r--r-- | include/trace/define_trace.h | 5 | ||||
-rw-r--r-- | include/trace/events/napi.h | 10 |
3 files changed, 72 insertions, 57 deletions
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index 78b4bd3be496..1d85f9a6a199 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h | |||
@@ -33,6 +33,65 @@ struct tracepoint { | |||
33 | * Keep in sync with vmlinux.lds.h. | 33 | * Keep in sync with vmlinux.lds.h. |
34 | */ | 34 | */ |
35 | 35 | ||
36 | /* | ||
37 | * Connect a probe to a tracepoint. | ||
38 | * Internal API, should not be used directly. | ||
39 | */ | ||
40 | extern int tracepoint_probe_register(const char *name, void *probe); | ||
41 | |||
42 | /* | ||
43 | * Disconnect a probe from a tracepoint. | ||
44 | * Internal API, should not be used directly. | ||
45 | */ | ||
46 | extern int tracepoint_probe_unregister(const char *name, void *probe); | ||
47 | |||
48 | extern int tracepoint_probe_register_noupdate(const char *name, void *probe); | ||
49 | extern int tracepoint_probe_unregister_noupdate(const char *name, void *probe); | ||
50 | extern void tracepoint_probe_update_all(void); | ||
51 | |||
52 | struct tracepoint_iter { | ||
53 | struct module *module; | ||
54 | struct tracepoint *tracepoint; | ||
55 | }; | ||
56 | |||
57 | extern void tracepoint_iter_start(struct tracepoint_iter *iter); | ||
58 | extern void tracepoint_iter_next(struct tracepoint_iter *iter); | ||
59 | extern void tracepoint_iter_stop(struct tracepoint_iter *iter); | ||
60 | extern void tracepoint_iter_reset(struct tracepoint_iter *iter); | ||
61 | extern int tracepoint_get_iter_range(struct tracepoint **tracepoint, | ||
62 | struct tracepoint *begin, struct tracepoint *end); | ||
63 | |||
64 | /* | ||
65 | * tracepoint_synchronize_unregister must be called between the last tracepoint | ||
66 | * probe unregistration and the end of module exit to make sure there is no | ||
67 | * caller executing a probe when it is freed. | ||
68 | */ | ||
69 | static inline void tracepoint_synchronize_unregister(void) | ||
70 | { | ||
71 | synchronize_sched(); | ||
72 | } | ||
73 | |||
74 | #define PARAMS(args...) args | ||
75 | |||
76 | #ifdef CONFIG_TRACEPOINTS | ||
77 | extern void tracepoint_update_probe_range(struct tracepoint *begin, | ||
78 | struct tracepoint *end); | ||
79 | #else | ||
80 | static inline void tracepoint_update_probe_range(struct tracepoint *begin, | ||
81 | struct tracepoint *end) | ||
82 | { } | ||
83 | #endif /* CONFIG_TRACEPOINTS */ | ||
84 | |||
85 | #endif /* _LINUX_TRACEPOINT_H */ | ||
86 | |||
87 | /* | ||
88 | * Note: we keep the TRACE_EVENT and DECLARE_TRACE outside the include | ||
89 | * file ifdef protection. | ||
90 | * This is due to the way trace events work. If a file includes two | ||
91 | * trace event headers under one "CREATE_TRACE_POINTS" the first include | ||
92 | * will override the TRACE_EVENT and break the second include. | ||
93 | */ | ||
94 | |||
36 | #ifndef DECLARE_TRACE | 95 | #ifndef DECLARE_TRACE |
37 | 96 | ||
38 | #define TP_PROTO(args...) args | 97 | #define TP_PROTO(args...) args |
@@ -96,9 +155,6 @@ struct tracepoint { | |||
96 | #define EXPORT_TRACEPOINT_SYMBOL(name) \ | 155 | #define EXPORT_TRACEPOINT_SYMBOL(name) \ |
97 | EXPORT_SYMBOL(__tracepoint_##name) | 156 | EXPORT_SYMBOL(__tracepoint_##name) |
98 | 157 | ||
99 | extern void tracepoint_update_probe_range(struct tracepoint *begin, | ||
100 | struct tracepoint *end); | ||
101 | |||
102 | #else /* !CONFIG_TRACEPOINTS */ | 158 | #else /* !CONFIG_TRACEPOINTS */ |
103 | #define DECLARE_TRACE(name, proto, args) \ | 159 | #define DECLARE_TRACE(name, proto, args) \ |
104 | static inline void _do_trace_##name(struct tracepoint *tp, proto) \ | 160 | static inline void _do_trace_##name(struct tracepoint *tp, proto) \ |
@@ -119,61 +175,9 @@ extern void tracepoint_update_probe_range(struct tracepoint *begin, | |||
119 | #define EXPORT_TRACEPOINT_SYMBOL_GPL(name) | 175 | #define EXPORT_TRACEPOINT_SYMBOL_GPL(name) |
120 | #define EXPORT_TRACEPOINT_SYMBOL(name) | 176 | #define EXPORT_TRACEPOINT_SYMBOL(name) |
121 | 177 | ||
122 | static inline void tracepoint_update_probe_range(struct tracepoint *begin, | ||
123 | struct tracepoint *end) | ||
124 | { } | ||
125 | #endif /* CONFIG_TRACEPOINTS */ | 178 | #endif /* CONFIG_TRACEPOINTS */ |
126 | #endif /* DECLARE_TRACE */ | 179 | #endif /* DECLARE_TRACE */ |
127 | 180 | ||
128 | /* | ||
129 | * Connect a probe to a tracepoint. | ||
130 | * Internal API, should not be used directly. | ||
131 | */ | ||
132 | extern int tracepoint_probe_register(const char *name, void *probe); | ||
133 | |||
134 | /* | ||
135 | * Disconnect a probe from a tracepoint. | ||
136 | * Internal API, should not be used directly. | ||
137 | */ | ||
138 | extern int tracepoint_probe_unregister(const char *name, void *probe); | ||
139 | |||
140 | extern int tracepoint_probe_register_noupdate(const char *name, void *probe); | ||
141 | extern int tracepoint_probe_unregister_noupdate(const char *name, void *probe); | ||
142 | extern void tracepoint_probe_update_all(void); | ||
143 | |||
144 | struct tracepoint_iter { | ||
145 | struct module *module; | ||
146 | struct tracepoint *tracepoint; | ||
147 | }; | ||
148 | |||
149 | extern void tracepoint_iter_start(struct tracepoint_iter *iter); | ||
150 | extern void tracepoint_iter_next(struct tracepoint_iter *iter); | ||
151 | extern void tracepoint_iter_stop(struct tracepoint_iter *iter); | ||
152 | extern void tracepoint_iter_reset(struct tracepoint_iter *iter); | ||
153 | extern int tracepoint_get_iter_range(struct tracepoint **tracepoint, | ||
154 | struct tracepoint *begin, struct tracepoint *end); | ||
155 | |||
156 | /* | ||
157 | * tracepoint_synchronize_unregister must be called between the last tracepoint | ||
158 | * probe unregistration and the end of module exit to make sure there is no | ||
159 | * caller executing a probe when it is freed. | ||
160 | */ | ||
161 | static inline void tracepoint_synchronize_unregister(void) | ||
162 | { | ||
163 | synchronize_sched(); | ||
164 | } | ||
165 | |||
166 | #define PARAMS(args...) args | ||
167 | |||
168 | #endif /* _LINUX_TRACEPOINT_H */ | ||
169 | |||
170 | /* | ||
171 | * Note: we keep the TRACE_EVENT outside the include file ifdef protection. | ||
172 | * This is due to the way trace events work. If a file includes two | ||
173 | * trace event headers under one "CREATE_TRACE_POINTS" the first include | ||
174 | * will override the TRACE_EVENT and break the second include. | ||
175 | */ | ||
176 | |||
177 | #ifndef TRACE_EVENT | 181 | #ifndef TRACE_EVENT |
178 | /* | 182 | /* |
179 | * For use with the TRACE_EVENT macro: | 183 | * For use with the TRACE_EVENT macro: |
diff --git a/include/trace/define_trace.h b/include/trace/define_trace.h index 5acfb1eb4df9..1dfab5401511 100644 --- a/include/trace/define_trace.h +++ b/include/trace/define_trace.h | |||
@@ -65,6 +65,10 @@ | |||
65 | 65 | ||
66 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) | 66 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
67 | 67 | ||
68 | /* Make all open coded DECLARE_TRACE nops */ | ||
69 | #undef DECLARE_TRACE | ||
70 | #define DECLARE_TRACE(name, proto, args) | ||
71 | |||
68 | #ifdef CONFIG_EVENT_TRACING | 72 | #ifdef CONFIG_EVENT_TRACING |
69 | #include <trace/ftrace.h> | 73 | #include <trace/ftrace.h> |
70 | #endif | 74 | #endif |
@@ -75,6 +79,7 @@ | |||
75 | #undef DEFINE_EVENT | 79 | #undef DEFINE_EVENT |
76 | #undef DEFINE_EVENT_PRINT | 80 | #undef DEFINE_EVENT_PRINT |
77 | #undef TRACE_HEADER_MULTI_READ | 81 | #undef TRACE_HEADER_MULTI_READ |
82 | #undef DECLARE_TRACE | ||
78 | 83 | ||
79 | /* Only undef what we defined in this file */ | 84 | /* Only undef what we defined in this file */ |
80 | #ifdef UNDEF_TRACE_INCLUDE_FILE | 85 | #ifdef UNDEF_TRACE_INCLUDE_FILE |
diff --git a/include/trace/events/napi.h b/include/trace/events/napi.h index a8989c4547e7..188deca2f3c7 100644 --- a/include/trace/events/napi.h +++ b/include/trace/events/napi.h | |||
@@ -1,4 +1,7 @@ | |||
1 | #ifndef _TRACE_NAPI_H_ | 1 | #undef TRACE_SYSTEM |
2 | #define TRACE_SYSTEM napi | ||
3 | |||
4 | #if !defined(_TRACE_NAPI_H) || defined(TRACE_HEADER_MULTI_READ) | ||
2 | #define _TRACE_NAPI_H_ | 5 | #define _TRACE_NAPI_H_ |
3 | 6 | ||
4 | #include <linux/netdevice.h> | 7 | #include <linux/netdevice.h> |
@@ -8,4 +11,7 @@ DECLARE_TRACE(napi_poll, | |||
8 | TP_PROTO(struct napi_struct *napi), | 11 | TP_PROTO(struct napi_struct *napi), |
9 | TP_ARGS(napi)); | 12 | TP_ARGS(napi)); |
10 | 13 | ||
11 | #endif | 14 | #endif /* _TRACE_NAPI_H_ */ |
15 | |||
16 | /* This part must be outside protection */ | ||
17 | #include <trace/define_trace.h> | ||