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