1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #ifndef _LINUX_TRACEPOINT_H
3 #define _LINUX_TRACEPOINT_H
4 
5 /*
6  * Kernel Tracepoint API.
7  *
8  * See Documentation/trace/tracepoints.rst.
9  *
10  * Copyright (C) 2008-2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11  *
12  * Heavily inspired from the Linux Kernel Markers.
13  */
14 
15 #include <linux/smp.h>
16 #include <linux/srcu.h>
17 #include <linux/errno.h>
18 #include <linux/types.h>
19 #include <linux/rcupdate.h>
20 #include <linux/tracepoint-defs.h>
21 #include <linux/static_call.h>
22 
23 struct module;
24 struct tracepoint;
25 struct notifier_block;
26 
27 struct trace_eval_map {
28 	const char		*system;
29 	const char		*eval_string;
30 	unsigned long		eval_value;
31 };
32 
33 #define TRACEPOINT_DEFAULT_PRIO	10
34 
35 extern struct srcu_struct tracepoint_srcu;
36 
37 extern int
38 tracepoint_probe_register(struct tracepoint *tp, void *probe, void *data);
39 extern int
40 tracepoint_probe_register_prio(struct tracepoint *tp, void *probe, void *data,
41 			       int prio);
42 extern int
43 tracepoint_probe_register_prio_may_exist(struct tracepoint *tp, void *probe, void *data,
44 					 int prio);
45 extern int
46 tracepoint_probe_unregister(struct tracepoint *tp, void *probe, void *data);
47 static inline int
tracepoint_probe_register_may_exist(struct tracepoint * tp,void * probe,void * data)48 tracepoint_probe_register_may_exist(struct tracepoint *tp, void *probe,
49 				    void *data)
50 {
51 	return tracepoint_probe_register_prio_may_exist(tp, probe, data,
52 							TRACEPOINT_DEFAULT_PRIO);
53 }
54 extern void
55 for_each_kernel_tracepoint(void (*fct)(struct tracepoint *tp, void *priv),
56 		void *priv);
57 
58 #ifdef CONFIG_MODULES
59 struct tp_module {
60 	struct list_head list;
61 	struct module *mod;
62 };
63 
64 bool trace_module_has_bad_taint(struct module *mod);
65 extern int register_tracepoint_module_notifier(struct notifier_block *nb);
66 extern int unregister_tracepoint_module_notifier(struct notifier_block *nb);
67 void for_each_module_tracepoint(void (*fct)(struct tracepoint *,
68 					struct module *, void *),
69 				void *priv);
70 void for_each_tracepoint_in_module(struct module *,
71 				   void (*fct)(struct tracepoint *,
72 					struct module *, void *),
73 				   void *priv);
74 #else
trace_module_has_bad_taint(struct module * mod)75 static inline bool trace_module_has_bad_taint(struct module *mod)
76 {
77 	return false;
78 }
79 static inline
register_tracepoint_module_notifier(struct notifier_block * nb)80 int register_tracepoint_module_notifier(struct notifier_block *nb)
81 {
82 	return 0;
83 }
84 static inline
unregister_tracepoint_module_notifier(struct notifier_block * nb)85 int unregister_tracepoint_module_notifier(struct notifier_block *nb)
86 {
87 	return 0;
88 }
89 static inline
for_each_module_tracepoint(void (* fct)(struct tracepoint *,struct module *,void *),void * priv)90 void for_each_module_tracepoint(void (*fct)(struct tracepoint *,
91 					struct module *, void *),
92 				void *priv)
93 {
94 }
95 static inline
for_each_tracepoint_in_module(struct module * mod,void (* fct)(struct tracepoint *,struct module *,void *),void * priv)96 void for_each_tracepoint_in_module(struct module *mod,
97 				   void (*fct)(struct tracepoint *,
98 					struct module *, void *),
99 				   void *priv)
100 {
101 }
102 #endif /* CONFIG_MODULES */
103 
104 /*
105  * tracepoint_synchronize_unregister must be called between the last tracepoint
106  * probe unregistration and the end of module exit to make sure there is no
107  * caller executing a probe when it is freed.
108  */
109 #ifdef CONFIG_TRACEPOINTS
tracepoint_synchronize_unregister(void)110 static inline void tracepoint_synchronize_unregister(void)
111 {
112 	synchronize_srcu(&tracepoint_srcu);
113 	synchronize_rcu();
114 }
115 #else
tracepoint_synchronize_unregister(void)116 static inline void tracepoint_synchronize_unregister(void)
117 { }
118 #endif
119 
120 #ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS
121 extern int syscall_regfunc(void);
122 extern void syscall_unregfunc(void);
123 #endif /* CONFIG_HAVE_SYSCALL_TRACEPOINTS */
124 
125 #ifndef PARAMS
126 #define PARAMS(args...) args
127 #endif
128 
129 #define TRACE_DEFINE_ENUM(x)
130 #define TRACE_DEFINE_SIZEOF(x)
131 
132 #ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
tracepoint_ptr_deref(tracepoint_ptr_t * p)133 static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
134 {
135 	return offset_to_ptr(p);
136 }
137 
138 #define __TRACEPOINT_ENTRY(name)					\
139 	asm("	.section \"__tracepoints_ptrs\", \"a\"		\n"	\
140 	    "	.balign 4					\n"	\
141 	    "	.long 	__tracepoint_" #name " - .		\n"	\
142 	    "	.previous					\n")
143 #else
tracepoint_ptr_deref(tracepoint_ptr_t * p)144 static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
145 {
146 	return *p;
147 }
148 
149 #define __TRACEPOINT_ENTRY(name)					 \
150 	static tracepoint_ptr_t __tracepoint_ptr_##name __used		 \
151 	__section("__tracepoints_ptrs") = &__tracepoint_##name
152 #endif
153 
154 #endif /* _LINUX_TRACEPOINT_H */
155 
156 /*
157  * Note: we keep the TRACE_EVENT and DECLARE_TRACE outside the include
158  *  file ifdef protection.
159  *  This is due to the way trace events work. If a file includes two
160  *  trace event headers under one "CREATE_TRACE_POINTS" the first include
161  *  will override the TRACE_EVENT and break the second include.
162  */
163 
164 #ifndef DECLARE_TRACE
165 
166 #define TP_PROTO(args...)	args
167 #define TP_ARGS(args...)	args
168 #define TP_CONDITION(args...)	args
169 
170 /*
171  * Individual subsystem my have a separate configuration to
172  * enable their tracepoints. By default, this file will create
173  * the tracepoints if CONFIG_TRACEPOINTS is defined. If a subsystem
174  * wants to be able to disable its tracepoints from being created
175  * it can define NOTRACE before including the tracepoint headers.
176  */
177 #if defined(CONFIG_TRACEPOINTS) && !defined(NOTRACE)
178 #define TRACEPOINTS_ENABLED
179 #endif
180 
181 #ifdef TRACEPOINTS_ENABLED
182 
183 #ifdef CONFIG_HAVE_STATIC_CALL
184 #define __DO_TRACE_CALL(name, args)					\
185 	do {								\
186 		struct tracepoint_func *it_func_ptr;			\
187 		void *__data;						\
188 		it_func_ptr =						\
189 			rcu_dereference_raw((&__tracepoint_##name)->funcs); \
190 		if (it_func_ptr) {					\
191 			__data = (it_func_ptr)->data;			\
192 			static_call(tp_func_##name)(__data, args);	\
193 		}							\
194 	} while (0)
195 #else
196 #define __DO_TRACE_CALL(name, args)	__traceiter_##name(NULL, args)
197 #endif /* CONFIG_HAVE_STATIC_CALL */
198 
199 /*
200  * ARCH_WANTS_NO_INSTR archs are expected to have sanitized entry and idle
201  * code that disallow any/all tracing/instrumentation when RCU isn't watching.
202  */
203 #ifdef CONFIG_ARCH_WANTS_NO_INSTR
204 #define RCUIDLE_COND(rcuidle)	(rcuidle)
205 #else
206 /* srcu can't be used from NMI */
207 #define RCUIDLE_COND(rcuidle)	(rcuidle && in_nmi())
208 #endif
209 
210 /*
211  * it_func[0] is never NULL because there is at least one element in the array
212  * when the array itself is non NULL.
213  */
214 #define __DO_TRACE(name, args, cond, rcuidle)				\
215 	do {								\
216 		int __maybe_unused __idx = 0;				\
217 									\
218 		if (!(cond))						\
219 			return;						\
220 									\
221 		if (WARN_ONCE(RCUIDLE_COND(rcuidle),			\
222 			      "Bad RCU usage for tracepoint"))		\
223 			return;						\
224 									\
225 		/* keep srcu and sched-rcu usage consistent */		\
226 		preempt_disable_notrace();				\
227 									\
228 		/*							\
229 		 * For rcuidle callers, use srcu since sched-rcu	\
230 		 * doesn't work from the idle path.			\
231 		 */							\
232 		if (rcuidle) {						\
233 			__idx = srcu_read_lock_notrace(&tracepoint_srcu);\
234 			ct_irq_enter_irqson();				\
235 		}							\
236 									\
237 		__DO_TRACE_CALL(name, TP_ARGS(args));			\
238 									\
239 		if (rcuidle) {						\
240 			ct_irq_exit_irqson();				\
241 			srcu_read_unlock_notrace(&tracepoint_srcu, __idx);\
242 		}							\
243 									\
244 		preempt_enable_notrace();				\
245 	} while (0)
246 
247 #ifndef MODULE
248 #define __DECLARE_TRACE_RCU(name, proto, args, cond)			\
249 	static inline void trace_##name##_rcuidle(proto)		\
250 	{								\
251 		if (static_key_false(&__tracepoint_##name.key))		\
252 			__DO_TRACE(name,				\
253 				TP_ARGS(args),				\
254 				TP_CONDITION(cond), 1);			\
255 	}
256 #else
257 #define __DECLARE_TRACE_RCU(name, proto, args, cond)
258 #endif
259 
260 /*
261  * Declare an exported function that Rust code can call to trigger this
262  * tracepoint. This function does not include the static branch; that is done
263  * in Rust to avoid a function call when the tracepoint is disabled.
264  */
265 #define DEFINE_RUST_DO_TRACE(name, proto, args)
266 #define __DEFINE_RUST_DO_TRACE(name, proto, args)			\
267 	notrace void rust_do_trace_##name(proto)			\
268 	{								\
269 		__rust_do_trace_##name(args);				\
270 	}
271 
272 /*
273  * Make sure the alignment of the structure in the __tracepoints section will
274  * not add unwanted padding between the beginning of the section and the
275  * structure. Force alignment to the same alignment as the section start.
276  *
277  * When lockdep is enabled, we make sure to always test if RCU is
278  * "watching" regardless if the tracepoint is enabled or not. Tracepoints
279  * require RCU to be active, and it should always warn at the tracepoint
280  * site if it is not watching, as it will need to be active when the
281  * tracepoint is enabled.
282  */
283 #define __DECLARE_TRACE(name, proto, args, cond, data_proto)		\
284 	extern int __traceiter_##name(data_proto);			\
285 	DECLARE_STATIC_CALL(tp_func_##name, __traceiter_##name);	\
286 	extern struct tracepoint __tracepoint_##name;			\
287 	extern void rust_do_trace_##name(proto);			\
288 	static inline void __rust_do_trace_##name(proto)		\
289 	{								\
290 		__DO_TRACE(name,					\
291 			TP_ARGS(args),					\
292 			TP_CONDITION(cond), 0);				\
293 	}								\
294 	static inline void trace_##name(proto)				\
295 	{								\
296 		if (static_key_false(&__tracepoint_##name.key))		\
297 			__DO_TRACE(name,				\
298 				TP_ARGS(args),				\
299 				TP_CONDITION(cond), 0);			\
300 		if (IS_ENABLED(CONFIG_LOCKDEP) && (cond)) {		\
301 			WARN_ONCE(!rcu_is_watching(),			\
302 				  "RCU not watching for tracepoint");	\
303 		}							\
304 	}								\
305 	__DECLARE_TRACE_RCU(name, PARAMS(proto), PARAMS(args),		\
306 			    PARAMS(cond))				\
307 	static inline int						\
308 	register_trace_##name(void (*probe)(data_proto), void *data)	\
309 	{								\
310 		return tracepoint_probe_register(&__tracepoint_##name,	\
311 						(void *)probe, data);	\
312 	}								\
313 	static inline int						\
314 	register_trace_prio_##name(void (*probe)(data_proto), void *data,\
315 				   int prio)				\
316 	{								\
317 		return tracepoint_probe_register_prio(&__tracepoint_##name, \
318 					      (void *)probe, data, prio); \
319 	}								\
320 	static inline int						\
321 	unregister_trace_##name(void (*probe)(data_proto), void *data)	\
322 	{								\
323 		return tracepoint_probe_unregister(&__tracepoint_##name,\
324 						(void *)probe, data);	\
325 	}								\
326 	static inline void						\
327 	check_trace_callback_type_##name(void (*cb)(data_proto))	\
328 	{								\
329 	}								\
330 	static inline bool						\
331 	trace_##name##_enabled(void)					\
332 	{								\
333 		return static_key_false(&__tracepoint_##name.key);	\
334 	}
335 
336 /*
337  * We have no guarantee that gcc and the linker won't up-align the tracepoint
338  * structures, so we create an array of pointers that will be used for iteration
339  * on the tracepoints.
340  */
341 #define DEFINE_TRACE_FN(_name, _reg, _unreg, proto, args)		\
342 	static const char __tpstrtab_##_name[]				\
343 	__section("__tracepoints_strings") = #_name;			\
344 	extern struct static_call_key STATIC_CALL_KEY(tp_func_##_name);	\
345 	int __traceiter_##_name(void *__data, proto);			\
346 	void __probestub_##_name(void *__data, proto);			\
347 	struct tracepoint __tracepoint_##_name	__used			\
348 	__section("__tracepoints") = {					\
349 		.name = __tpstrtab_##_name,				\
350 		.key = STATIC_KEY_INIT_FALSE,				\
351 		.static_call_key = &STATIC_CALL_KEY(tp_func_##_name),	\
352 		.static_call_tramp = STATIC_CALL_TRAMP_ADDR(tp_func_##_name), \
353 		.iterator = &__traceiter_##_name,			\
354 		.probestub = &__probestub_##_name,			\
355 		.regfunc = _reg,					\
356 		.unregfunc = _unreg,					\
357 		.funcs = NULL };					\
358 	__TRACEPOINT_ENTRY(_name);					\
359 	int __traceiter_##_name(void *__data, proto)			\
360 	{								\
361 		struct tracepoint_func *it_func_ptr;			\
362 		void *it_func;						\
363 									\
364 		it_func_ptr =						\
365 			rcu_dereference_raw((&__tracepoint_##_name)->funcs); \
366 		if (it_func_ptr) {					\
367 			do {						\
368 				it_func = READ_ONCE((it_func_ptr)->func); \
369 				__data = (it_func_ptr)->data;		\
370 				((void(*)(void *, proto))(it_func))(__data, args); \
371 			} while ((++it_func_ptr)->func);		\
372 		}							\
373 		return 0;						\
374 	}								\
375 	void __probestub_##_name(void *__data, proto)			\
376 	{								\
377 	}								\
378 	DEFINE_STATIC_CALL(tp_func_##_name, __traceiter_##_name);	\
379 	DEFINE_RUST_DO_TRACE(_name, TP_PROTO(proto), TP_ARGS(args))
380 
381 #define DEFINE_TRACE(name, proto, args)		\
382 	DEFINE_TRACE_FN(name, NULL, NULL, PARAMS(proto), PARAMS(args));
383 
384 #define EXPORT_TRACEPOINT_SYMBOL_GPL(name)				\
385 	EXPORT_SYMBOL_GPL(__tracepoint_##name);				\
386 	EXPORT_SYMBOL_GPL(__traceiter_##name);				\
387 	EXPORT_STATIC_CALL_GPL(tp_func_##name)
388 #define EXPORT_TRACEPOINT_SYMBOL(name)					\
389 	EXPORT_SYMBOL(__tracepoint_##name);				\
390 	EXPORT_SYMBOL(__traceiter_##name);				\
391 	EXPORT_STATIC_CALL(tp_func_##name)
392 
393 
394 #else /* !TRACEPOINTS_ENABLED */
395 #define __DECLARE_TRACE(name, proto, args, cond, data_proto)		\
396 	static inline void trace_##name(proto)				\
397 	{ }								\
398 	static inline void trace_##name##_rcuidle(proto)		\
399 	{ }								\
400 	static inline int						\
401 	register_trace_##name(void (*probe)(data_proto),		\
402 			      void *data)				\
403 	{								\
404 		return -ENOSYS;						\
405 	}								\
406 	static inline int						\
407 	unregister_trace_##name(void (*probe)(data_proto),		\
408 				void *data)				\
409 	{								\
410 		return -ENOSYS;						\
411 	}								\
412 	static inline void check_trace_callback_type_##name(void (*cb)(data_proto)) \
413 	{								\
414 	}								\
415 	static inline bool						\
416 	trace_##name##_enabled(void)					\
417 	{								\
418 		return false;						\
419 	}
420 
421 #define DEFINE_TRACE_FN(name, reg, unreg, proto, args)
422 #define DEFINE_TRACE(name, proto, args)
423 #define EXPORT_TRACEPOINT_SYMBOL_GPL(name)
424 #define EXPORT_TRACEPOINT_SYMBOL(name)
425 
426 #endif /* TRACEPOINTS_ENABLED */
427 
428 #ifdef CONFIG_TRACING
429 /**
430  * tracepoint_string - register constant persistent string to trace system
431  * @str - a constant persistent string that will be referenced in tracepoints
432  *
433  * If constant strings are being used in tracepoints, it is faster and
434  * more efficient to just save the pointer to the string and reference
435  * that with a printf "%s" instead of saving the string in the ring buffer
436  * and wasting space and time.
437  *
438  * The problem with the above approach is that userspace tools that read
439  * the binary output of the trace buffers do not have access to the string.
440  * Instead they just show the address of the string which is not very
441  * useful to users.
442  *
443  * With tracepoint_string(), the string will be registered to the tracing
444  * system and exported to userspace via the debugfs/tracing/printk_formats
445  * file that maps the string address to the string text. This way userspace
446  * tools that read the binary buffers have a way to map the pointers to
447  * the ASCII strings they represent.
448  *
449  * The @str used must be a constant string and persistent as it would not
450  * make sense to show a string that no longer exists. But it is still fine
451  * to be used with modules, because when modules are unloaded, if they
452  * had tracepoints, the ring buffers are cleared too. As long as the string
453  * does not change during the life of the module, it is fine to use
454  * tracepoint_string() within a module.
455  */
456 #define tracepoint_string(str)						\
457 	({								\
458 		static const char *___tp_str __tracepoint_string = str; \
459 		___tp_str;						\
460 	})
461 #define __tracepoint_string	__used __section("__tracepoint_str")
462 #else
463 /*
464  * tracepoint_string() is used to save the string address for userspace
465  * tracing tools. When tracing isn't configured, there's no need to save
466  * anything.
467  */
468 # define tracepoint_string(str) str
469 # define __tracepoint_string
470 #endif
471 
472 #define DECLARE_TRACE(name, proto, args)				\
473 	__DECLARE_TRACE(name, PARAMS(proto), PARAMS(args),		\
474 			cpu_online(raw_smp_processor_id()),		\
475 			PARAMS(void *__data, proto))
476 
477 #define DECLARE_TRACE_CONDITION(name, proto, args, cond)		\
478 	__DECLARE_TRACE(name, PARAMS(proto), PARAMS(args),		\
479 			cpu_online(raw_smp_processor_id()) && (PARAMS(cond)), \
480 			PARAMS(void *__data, proto))
481 
482 #define TRACE_EVENT_FLAGS(event, flag)
483 
484 #define TRACE_EVENT_PERF_PERM(event, expr...)
485 
486 #endif /* DECLARE_TRACE */
487 
488 #ifndef TRACE_EVENT
489 /*
490  * For use with the TRACE_EVENT macro:
491  *
492  * We define a tracepoint, its arguments, its printk format
493  * and its 'fast binary record' layout.
494  *
495  * Firstly, name your tracepoint via TRACE_EVENT(name : the
496  * 'subsystem_event' notation is fine.
497  *
498  * Think about this whole construct as the
499  * 'trace_sched_switch() function' from now on.
500  *
501  *
502  *  TRACE_EVENT(sched_switch,
503  *
504  *	*
505  *	* A function has a regular function arguments
506  *	* prototype, declare it via TP_PROTO():
507  *	*
508  *
509  *	TP_PROTO(struct rq *rq, struct task_struct *prev,
510  *		 struct task_struct *next),
511  *
512  *	*
513  *	* Define the call signature of the 'function'.
514  *	* (Design sidenote: we use this instead of a
515  *	*  TP_PROTO1/TP_PROTO2/TP_PROTO3 ugliness.)
516  *	*
517  *
518  *	TP_ARGS(rq, prev, next),
519  *
520  *	*
521  *	* Fast binary tracing: define the trace record via
522  *	* TP_STRUCT__entry(). You can think about it like a
523  *	* regular C structure local variable definition.
524  *	*
525  *	* This is how the trace record is structured and will
526  *	* be saved into the ring buffer. These are the fields
527  *	* that will be exposed to user-space in
528  *	* /sys/kernel/tracing/events/<*>/format.
529  *	*
530  *	* The declared 'local variable' is called '__entry'
531  *	*
532  *	* __field(pid_t, prev_pid) is equivalent to a standard declaration:
533  *	*
534  *	*	pid_t	prev_pid;
535  *	*
536  *	* __array(char, prev_comm, TASK_COMM_LEN) is equivalent to:
537  *	*
538  *	*	char	prev_comm[TASK_COMM_LEN];
539  *	*
540  *
541  *	TP_STRUCT__entry(
542  *		__array(	char,	prev_comm,	TASK_COMM_LEN	)
543  *		__field(	pid_t,	prev_pid			)
544  *		__field(	int,	prev_prio			)
545  *		__array(	char,	next_comm,	TASK_COMM_LEN	)
546  *		__field(	pid_t,	next_pid			)
547  *		__field(	int,	next_prio			)
548  *	),
549  *
550  *	*
551  *	* Assign the entry into the trace record, by embedding
552  *	* a full C statement block into TP_fast_assign(). You
553  *	* can refer to the trace record as '__entry' -
554  *	* otherwise you can put arbitrary C code in here.
555  *	*
556  *	* Note: this C code will execute every time a trace event
557  *	* happens, on an active tracepoint.
558  *	*
559  *
560  *	TP_fast_assign(
561  *		memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN);
562  *		__entry->prev_pid	= prev->pid;
563  *		__entry->prev_prio	= prev->prio;
564  *		memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN);
565  *		__entry->next_pid	= next->pid;
566  *		__entry->next_prio	= next->prio;
567  *	),
568  *
569  *	*
570  *	* Formatted output of a trace record via TP_printk().
571  *	* This is how the tracepoint will appear under ftrace
572  *	* plugins that make use of this tracepoint.
573  *	*
574  *	* (raw-binary tracing wont actually perform this step.)
575  *	*
576  *
577  *	TP_printk("task %s:%d [%d] ==> %s:%d [%d]",
578  *		__entry->prev_comm, __entry->prev_pid, __entry->prev_prio,
579  *		__entry->next_comm, __entry->next_pid, __entry->next_prio),
580  *
581  * );
582  *
583  * This macro construct is thus used for the regular printk format
584  * tracing setup, it is used to construct a function pointer based
585  * tracepoint callback (this is used by programmatic plugins and
586  * can also by used by generic instrumentation like SystemTap), and
587  * it is also used to expose a structured trace record in
588  * /sys/kernel/tracing/events/.
589  *
590  * A set of (un)registration functions can be passed to the variant
591  * TRACE_EVENT_FN to perform any (un)registration work.
592  */
593 
594 #define DECLARE_EVENT_CLASS(name, proto, args, tstruct, assign, print)
595 #define DEFINE_EVENT(template, name, proto, args)		\
596 	DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
597 #define DEFINE_EVENT_FN(template, name, proto, args, reg, unreg)\
598 	DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
599 #define DEFINE_EVENT_PRINT(template, name, proto, args, print)	\
600 	DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
601 #define DEFINE_EVENT_CONDITION(template, name, proto,		\
602 			       args, cond)			\
603 	DECLARE_TRACE_CONDITION(name, PARAMS(proto),		\
604 				PARAMS(args), PARAMS(cond))
605 
606 #define TRACE_EVENT(name, proto, args, struct, assign, print)	\
607 	DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
608 #define TRACE_EVENT_FN(name, proto, args, struct,		\
609 		assign, print, reg, unreg)			\
610 	DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
611 #define TRACE_EVENT_FN_COND(name, proto, args, cond, struct,		\
612 		assign, print, reg, unreg)			\
613 	DECLARE_TRACE_CONDITION(name, PARAMS(proto),	\
614 			PARAMS(args), PARAMS(cond))
615 #define TRACE_EVENT_CONDITION(name, proto, args, cond,		\
616 			      struct, assign, print)		\
617 	DECLARE_TRACE_CONDITION(name, PARAMS(proto),		\
618 				PARAMS(args), PARAMS(cond))
619 
620 #define TRACE_EVENT_FLAGS(event, flag)
621 
622 #define TRACE_EVENT_PERF_PERM(event, expr...)
623 
624 #define DECLARE_EVENT_NOP(name, proto, args)				\
625 	static inline void trace_##name(proto)				\
626 	{ }								\
627 	static inline bool trace_##name##_enabled(void)			\
628 	{								\
629 		return false;						\
630 	}
631 
632 #define TRACE_EVENT_NOP(name, proto, args, struct, assign, print)	\
633 	DECLARE_EVENT_NOP(name, PARAMS(proto), PARAMS(args))
634 
635 #define DECLARE_EVENT_CLASS_NOP(name, proto, args, tstruct, assign, print)
636 #define DEFINE_EVENT_NOP(template, name, proto, args)			\
637 	DECLARE_EVENT_NOP(name, PARAMS(proto), PARAMS(args))
638 
639 #endif /* ifdef TRACE_EVENT (see note above) */
640