Skip to content

Commit 7ece55a

Browse files
joshtriplettrostedt
authored andcommitted
trace: Don't declare trace_*_rcuidle functions in modules
Tracepoints declare a static inline trace_*_rcuidle variant of the trace function, to support safely generating trace events from the idle loop. Module code never actually uses that variant of trace functions, because modules don't run code that needs tracing with RCU idled. However, the declaration of those otherwise unused functions causes the module to reference rcu_idle_exit and rcu_idle_enter, which RCU does not export to modules. To avoid this, don't generate trace_*_rcuidle functions for tracepoints declared in module code. Link: http://lkml.kernel.org/r/20120905062306.GA14756@leaf Reported-by: Steven Rostedt <[email protected]> Acked-by: Mathieu Desnoyers <[email protected]> Acked-by: Paul E. McKenney <[email protected]> Signed-off-by: Josh Triplett <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
1 parent 55d512e commit 7ece55a

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

include/linux/tracepoint.h

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,22 @@ static inline void tracepoint_synchronize_unregister(void)
136136
postrcu; \
137137
} while (0)
138138

139+
#ifndef MODULE
140+
#define __DECLARE_TRACE_RCU(name, proto, args, cond, data_proto, data_args) \
141+
static inline void trace_##name##_rcuidle(proto) \
142+
{ \
143+
if (static_key_false(&__tracepoint_##name.key)) \
144+
__DO_TRACE(&__tracepoint_##name, \
145+
TP_PROTO(data_proto), \
146+
TP_ARGS(data_args), \
147+
TP_CONDITION(cond), \
148+
rcu_idle_exit(), \
149+
rcu_idle_enter()); \
150+
}
151+
#else
152+
#define __DECLARE_TRACE_RCU(name, proto, args, cond, data_proto, data_args)
153+
#endif
154+
139155
/*
140156
* Make sure the alignment of the structure in the __tracepoints section will
141157
* not add unwanted padding between the beginning of the section and the
@@ -151,16 +167,8 @@ static inline void tracepoint_synchronize_unregister(void)
151167
TP_ARGS(data_args), \
152168
TP_CONDITION(cond),,); \
153169
} \
154-
static inline void trace_##name##_rcuidle(proto) \
155-
{ \
156-
if (static_key_false(&__tracepoint_##name.key)) \
157-
__DO_TRACE(&__tracepoint_##name, \
158-
TP_PROTO(data_proto), \
159-
TP_ARGS(data_args), \
160-
TP_CONDITION(cond), \
161-
rcu_idle_exit(), \
162-
rcu_idle_enter()); \
163-
} \
170+
__DECLARE_TRACE_RCU(name, PARAMS(proto), PARAMS(args), \
171+
PARAMS(cond), PARAMS(data_proto), PARAMS(data_args)) \
164172
static inline int \
165173
register_trace_##name(void (*probe)(data_proto), void *data) \
166174
{ \

0 commit comments

Comments
 (0)