1 /* SPDX-License-Identifier: GPL-2.0 */ 2 3 #ifndef _LINUX_TRACE_EVENT_H 4 #define _LINUX_TRACE_EVENT_H 5 6 #include <linux/ring_buffer.h> 7 #include <linux/trace_seq.h> 8 #include <linux/percpu.h> 9 #include <linux/hardirq.h> 10 #include <linux/perf_event.h> 11 #include <linux/tracepoint.h> 12 13 struct trace_array; 14 struct trace_buffer; 15 struct tracer; 16 struct dentry; 17 struct bpf_prog; 18 19 const char *trace_print_flags_seq(struct trace_seq *p, const char *delim, 20 unsigned long flags, 21 const struct trace_print_flags *flag_array); 22 23 const char *trace_print_symbols_seq(struct trace_seq *p, unsigned long val, 24 const struct trace_print_flags *symbol_array); 25 26 #if BITS_PER_LONG == 32 27 const char *trace_print_flags_seq_u64(struct trace_seq *p, const char *delim, 28 unsigned long long flags, 29 const struct trace_print_flags_u64 *flag_array); 30 31 const char *trace_print_symbols_seq_u64(struct trace_seq *p, 32 unsigned long long val, 33 const struct trace_print_flags_u64 34 *symbol_array); 35 #endif 36 37 const char *trace_print_bitmask_seq(struct trace_seq *p, void *bitmask_ptr, 38 unsigned int bitmask_size); 39 40 const char *trace_print_hex_seq(struct trace_seq *p, 41 const unsigned char *buf, int len, 42 bool concatenate); 43 44 const char *trace_print_array_seq(struct trace_seq *p, 45 const void *buf, int count, 46 size_t el_size); 47 48 const char * 49 trace_print_hex_dump_seq(struct trace_seq *p, const char *prefix_str, 50 int prefix_type, int rowsize, int groupsize, 51 const void *buf, size_t len, bool ascii); 52 53 struct trace_iterator; 54 struct trace_event; 55 56 int trace_raw_output_prep(struct trace_iterator *iter, 57 struct trace_event *event); 58 59 /* 60 * The trace entry - the most basic unit of tracing. This is what 61 * is printed in the end as a single line in the trace output, such as: 62 * 63 * bash-15816 [01] 235.197585: idle_cpu <- irq_enter 64 */ 65 struct trace_entry { 66 unsigned short type; 67 unsigned char flags; 68 unsigned char preempt_count; 69 int pid; 70 }; 71 72 #define TRACE_EVENT_TYPE_MAX \ 73 ((1 << (sizeof(((struct trace_entry *)0)->type) * 8)) - 1) 74 75 /* 76 * Trace iterator - used by printout routines who present trace 77 * results to users and which routines might sleep, etc: 78 */ 79 struct trace_iterator { 80 struct trace_array *tr; 81 struct tracer *trace; 82 struct trace_buffer *trace_buffer; 83 void *private; 84 int cpu_file; 85 struct mutex mutex; 86 struct ring_buffer_iter **buffer_iter; 87 unsigned long iter_flags; 88 89 /* trace_seq for __print_flags() and __print_symbolic() etc. */ 90 struct trace_seq tmp_seq; 91 92 cpumask_var_t started; 93 94 /* it's true when current open file is snapshot */ 95 bool snapshot; 96 97 /* The below is zeroed out in pipe_read */ 98 struct trace_seq seq; 99 struct trace_entry *ent; 100 unsigned long lost_events; 101 int leftover; 102 int ent_size; 103 int cpu; 104 u64 ts; 105 106 loff_t pos; 107 long idx; 108 109 /* All new field here will be zeroed out in pipe_read */ 110 }; 111 112 enum trace_iter_flags { 113 TRACE_FILE_LAT_FMT = 1, 114 TRACE_FILE_ANNOTATE = 2, 115 TRACE_FILE_TIME_IN_NS = 4, 116 }; 117 118 119 typedef enum print_line_t (*trace_print_func)(struct trace_iterator *iter, 120 int flags, struct trace_event *event); 121 122 struct trace_event_functions { 123 trace_print_func trace; 124 trace_print_func raw; 125 trace_print_func hex; 126 trace_print_func binary; 127 }; 128 129 struct trace_event { 130 struct hlist_node node; 131 struct list_head list; 132 int type; 133 struct trace_event_functions *funcs; 134 }; 135 136 extern int register_trace_event(struct trace_event *event); 137 extern int unregister_trace_event(struct trace_event *event); 138 139 /* Return values for print_line callback */ 140 enum print_line_t { 141 TRACE_TYPE_PARTIAL_LINE = 0, /* Retry after flushing the seq */ 142 TRACE_TYPE_HANDLED = 1, 143 TRACE_TYPE_UNHANDLED = 2, /* Relay to other output functions */ 144 TRACE_TYPE_NO_CONSUME = 3 /* Handled but ask to not consume */ 145 }; 146 147 enum print_line_t trace_handle_return(struct trace_seq *s); 148 149 void tracing_generic_entry_update(struct trace_entry *entry, 150 unsigned short type, 151 unsigned long flags, 152 int pc); 153 struct trace_event_file; 154 155 struct ring_buffer_event * 156 trace_event_buffer_lock_reserve(struct ring_buffer **current_buffer, 157 struct trace_event_file *trace_file, 158 int type, unsigned long len, 159 unsigned long flags, int pc); 160 161 #define TRACE_RECORD_CMDLINE BIT(0) 162 #define TRACE_RECORD_TGID BIT(1) 163 164 void tracing_record_taskinfo(struct task_struct *task, int flags); 165 void tracing_record_taskinfo_sched_switch(struct task_struct *prev, 166 struct task_struct *next, int flags); 167 168 void tracing_record_cmdline(struct task_struct *task); 169 void tracing_record_tgid(struct task_struct *task); 170 171 int trace_output_call(struct trace_iterator *iter, char *name, char *fmt, ...); 172 173 struct event_filter; 174 175 enum trace_reg { 176 TRACE_REG_REGISTER, 177 TRACE_REG_UNREGISTER, 178 #ifdef CONFIG_PERF_EVENTS 179 TRACE_REG_PERF_REGISTER, 180 TRACE_REG_PERF_UNREGISTER, 181 TRACE_REG_PERF_OPEN, 182 TRACE_REG_PERF_CLOSE, 183 /* 184 * These (ADD/DEL) use a 'boolean' return value, where 1 (true) means a 185 * custom action was taken and the default action is not to be 186 * performed. 187 */ 188 TRACE_REG_PERF_ADD, 189 TRACE_REG_PERF_DEL, 190 #endif 191 }; 192 193 struct trace_event_call; 194 195 #define TRACE_FUNCTION_TYPE ((const char *)~0UL) 196 197 struct trace_event_fields { 198 const char *type; 199 union { 200 struct { 201 const char *name; 202 const int size; 203 const int align; 204 const int is_signed; 205 const int filter_type; 206 }; 207 int (*define_fields)(struct trace_event_call *); 208 }; 209 }; 210 211 struct trace_event_class { 212 const char *system; 213 void *probe; 214 #ifdef CONFIG_PERF_EVENTS 215 void *perf_probe; 216 #endif 217 int (*reg)(struct trace_event_call *event, 218 enum trace_reg type, void *data); 219 struct trace_event_fields *fields_array; 220 struct list_head *(*get_fields)(struct trace_event_call *); 221 struct list_head fields; 222 int (*raw_init)(struct trace_event_call *); 223 }; 224 225 extern int trace_event_reg(struct trace_event_call *event, 226 enum trace_reg type, void *data); 227 228 struct trace_event_buffer { 229 struct ring_buffer *buffer; 230 struct ring_buffer_event *event; 231 struct trace_event_file *trace_file; 232 void *entry; 233 unsigned long flags; 234 int pc; 235 }; 236 237 void *trace_event_buffer_reserve(struct trace_event_buffer *fbuffer, 238 struct trace_event_file *trace_file, 239 unsigned long len); 240 241 void trace_event_buffer_commit(struct trace_event_buffer *fbuffer); 242 243 enum { 244 TRACE_EVENT_FL_FILTERED_BIT, 245 TRACE_EVENT_FL_CAP_ANY_BIT, 246 TRACE_EVENT_FL_NO_SET_FILTER_BIT, 247 TRACE_EVENT_FL_IGNORE_ENABLE_BIT, 248 TRACE_EVENT_FL_TRACEPOINT_BIT, 249 TRACE_EVENT_FL_KPROBE_BIT, 250 TRACE_EVENT_FL_UPROBE_BIT, 251 }; 252 253 /* 254 * Event flags: 255 * FILTERED - The event has a filter attached 256 * CAP_ANY - Any user can enable for perf 257 * NO_SET_FILTER - Set when filter has error and is to be ignored 258 * IGNORE_ENABLE - For trace internal events, do not enable with debugfs file 259 * TRACEPOINT - Event is a tracepoint 260 * KPROBE - Event is a kprobe 261 * UPROBE - Event is a uprobe 262 */ 263 enum { 264 TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT), 265 TRACE_EVENT_FL_CAP_ANY = (1 << TRACE_EVENT_FL_CAP_ANY_BIT), 266 TRACE_EVENT_FL_NO_SET_FILTER = (1 << TRACE_EVENT_FL_NO_SET_FILTER_BIT), 267 TRACE_EVENT_FL_IGNORE_ENABLE = (1 << TRACE_EVENT_FL_IGNORE_ENABLE_BIT), 268 TRACE_EVENT_FL_TRACEPOINT = (1 << TRACE_EVENT_FL_TRACEPOINT_BIT), 269 TRACE_EVENT_FL_KPROBE = (1 << TRACE_EVENT_FL_KPROBE_BIT), 270 TRACE_EVENT_FL_UPROBE = (1 << TRACE_EVENT_FL_UPROBE_BIT), 271 }; 272 273 #define TRACE_EVENT_FL_UKPROBE (TRACE_EVENT_FL_KPROBE | TRACE_EVENT_FL_UPROBE) 274 275 struct trace_event_call { 276 struct list_head list; 277 struct trace_event_class *class; 278 union { 279 char *name; 280 /* Set TRACE_EVENT_FL_TRACEPOINT flag when using "tp" */ 281 struct tracepoint *tp; 282 }; 283 struct trace_event event; 284 char *print_fmt; 285 struct event_filter *filter; 286 void *mod; 287 void *data; 288 /* 289 * bit 0: filter_active 290 * bit 1: allow trace by non root (cap any) 291 * bit 2: failed to apply filter 292 * bit 3: trace internal event (do not enable) 293 * bit 4: Event was enabled by module 294 * bit 5: use call filter rather than file filter 295 * bit 6: Event is a tracepoint 296 */ 297 int flags; /* static flags of different events */ 298 299 #ifdef CONFIG_PERF_EVENTS 300 int perf_refcount; 301 struct hlist_head __percpu *perf_events; 302 struct bpf_prog_array __rcu *prog_array; 303 304 int (*perf_perm)(struct trace_event_call *, 305 struct perf_event *); 306 #endif 307 }; 308 309 #ifdef CONFIG_PERF_EVENTS 310 static inline bool bpf_prog_array_valid(struct trace_event_call *call) 311 { 312 /* 313 * This inline function checks whether call->prog_array 314 * is valid or not. The function is called in various places, 315 * outside rcu_read_lock/unlock, as a heuristic to speed up execution. 316 * 317 * If this function returns true, and later call->prog_array 318 * becomes false inside rcu_read_lock/unlock region, 319 * we bail out then. If this function return false, 320 * there is a risk that we might miss a few events if the checking 321 * were delayed until inside rcu_read_lock/unlock region and 322 * call->prog_array happened to become non-NULL then. 323 * 324 * Here, READ_ONCE() is used instead of rcu_access_pointer(). 325 * rcu_access_pointer() requires the actual definition of 326 * "struct bpf_prog_array" while READ_ONCE() only needs 327 * a declaration of the same type. 328 */ 329 return !!READ_ONCE(call->prog_array); 330 } 331 #endif 332 333 static inline const char * 334 trace_event_name(struct trace_event_call *call) 335 { 336 if (call->flags & TRACE_EVENT_FL_TRACEPOINT) 337 return call->tp ? call->tp->name : NULL; 338 else 339 return call->name; 340 } 341 342 static inline struct list_head * 343 trace_get_fields(struct trace_event_call *event_call) 344 { 345 if (!event_call->class->get_fields) 346 return &event_call->class->fields; 347 return event_call->class->get_fields(event_call); 348 } 349 350 struct trace_array; 351 struct trace_subsystem_dir; 352 353 enum { 354 EVENT_FILE_FL_ENABLED_BIT, 355 EVENT_FILE_FL_RECORDED_CMD_BIT, 356 EVENT_FILE_FL_RECORDED_TGID_BIT, 357 EVENT_FILE_FL_FILTERED_BIT, 358 EVENT_FILE_FL_NO_SET_FILTER_BIT, 359 EVENT_FILE_FL_SOFT_MODE_BIT, 360 EVENT_FILE_FL_SOFT_DISABLED_BIT, 361 EVENT_FILE_FL_TRIGGER_MODE_BIT, 362 EVENT_FILE_FL_TRIGGER_COND_BIT, 363 EVENT_FILE_FL_PID_FILTER_BIT, 364 EVENT_FILE_FL_WAS_ENABLED_BIT, 365 }; 366 367 /* 368 * Event file flags: 369 * ENABLED - The event is enabled 370 * RECORDED_CMD - The comms should be recorded at sched_switch 371 * RECORDED_TGID - The tgids should be recorded at sched_switch 372 * FILTERED - The event has a filter attached 373 * NO_SET_FILTER - Set when filter has error and is to be ignored 374 * SOFT_MODE - The event is enabled/disabled by SOFT_DISABLED 375 * SOFT_DISABLED - When set, do not trace the event (even though its 376 * tracepoint may be enabled) 377 * TRIGGER_MODE - When set, invoke the triggers associated with the event 378 * TRIGGER_COND - When set, one or more triggers has an associated filter 379 * PID_FILTER - When set, the event is filtered based on pid 380 * WAS_ENABLED - Set when enabled to know to clear trace on module removal 381 */ 382 enum { 383 EVENT_FILE_FL_ENABLED = (1 << EVENT_FILE_FL_ENABLED_BIT), 384 EVENT_FILE_FL_RECORDED_CMD = (1 << EVENT_FILE_FL_RECORDED_CMD_BIT), 385 EVENT_FILE_FL_RECORDED_TGID = (1 << EVENT_FILE_FL_RECORDED_TGID_BIT), 386 EVENT_FILE_FL_FILTERED = (1 << EVENT_FILE_FL_FILTERED_BIT), 387 EVENT_FILE_FL_NO_SET_FILTER = (1 << EVENT_FILE_FL_NO_SET_FILTER_BIT), 388 EVENT_FILE_FL_SOFT_MODE = (1 << EVENT_FILE_FL_SOFT_MODE_BIT), 389 EVENT_FILE_FL_SOFT_DISABLED = (1 << EVENT_FILE_FL_SOFT_DISABLED_BIT), 390 EVENT_FILE_FL_TRIGGER_MODE = (1 << EVENT_FILE_FL_TRIGGER_MODE_BIT), 391 EVENT_FILE_FL_TRIGGER_COND = (1 << EVENT_FILE_FL_TRIGGER_COND_BIT), 392 EVENT_FILE_FL_PID_FILTER = (1 << EVENT_FILE_FL_PID_FILTER_BIT), 393 EVENT_FILE_FL_WAS_ENABLED = (1 << EVENT_FILE_FL_WAS_ENABLED_BIT), 394 }; 395 396 struct trace_event_file { 397 struct list_head list; 398 struct trace_event_call *event_call; 399 struct event_filter __rcu *filter; 400 struct dentry *dir; 401 struct trace_array *tr; 402 struct trace_subsystem_dir *system; 403 struct list_head triggers; 404 405 /* 406 * 32 bit flags: 407 * bit 0: enabled 408 * bit 1: enabled cmd record 409 * bit 2: enable/disable with the soft disable bit 410 * bit 3: soft disabled 411 * bit 4: trigger enabled 412 * 413 * Note: The bits must be set atomically to prevent races 414 * from other writers. Reads of flags do not need to be in 415 * sync as they occur in critical sections. But the way flags 416 * is currently used, these changes do not affect the code 417 * except that when a change is made, it may have a slight 418 * delay in propagating the changes to other CPUs due to 419 * caching and such. Which is mostly OK ;-) 420 */ 421 unsigned long flags; 422 atomic_t sm_ref; /* soft-mode reference counter */ 423 atomic_t tm_ref; /* trigger-mode reference counter */ 424 }; 425 426 #define __TRACE_EVENT_FLAGS(name, value) \ 427 static int __init trace_init_flags_##name(void) \ 428 { \ 429 event_##name.flags |= value; \ 430 return 0; \ 431 } \ 432 early_initcall(trace_init_flags_##name); 433 434 #define __TRACE_EVENT_PERF_PERM(name, expr...) \ 435 static int perf_perm_##name(struct trace_event_call *tp_event, \ 436 struct perf_event *p_event) \ 437 { \ 438 return ({ expr; }); \ 439 } \ 440 static int __init trace_init_perf_perm_##name(void) \ 441 { \ 442 event_##name.perf_perm = &perf_perm_##name; \ 443 return 0; \ 444 } \ 445 early_initcall(trace_init_perf_perm_##name); 446 447 #define PERF_MAX_TRACE_SIZE 2048 448 449 #define MAX_FILTER_STR_VAL 256 /* Should handle KSYM_SYMBOL_LEN */ 450 451 enum event_trigger_type { 452 ETT_NONE = (0), 453 ETT_TRACE_ONOFF = (1 << 0), 454 ETT_SNAPSHOT = (1 << 1), 455 ETT_STACKTRACE = (1 << 2), 456 ETT_EVENT_ENABLE = (1 << 3), 457 ETT_EVENT_HIST = (1 << 4), 458 ETT_HIST_ENABLE = (1 << 5), 459 }; 460 461 extern int filter_match_preds(struct event_filter *filter, void *rec); 462 463 extern enum event_trigger_type 464 event_triggers_call(struct trace_event_file *file, void *rec, 465 struct ring_buffer_event *event); 466 extern void 467 event_triggers_post_call(struct trace_event_file *file, 468 enum event_trigger_type tt); 469 470 bool trace_event_ignore_this_pid(struct trace_event_file *trace_file); 471 472 /** 473 * trace_trigger_soft_disabled - do triggers and test if soft disabled 474 * @file: The file pointer of the event to test 475 * 476 * If any triggers without filters are attached to this event, they 477 * will be called here. If the event is soft disabled and has no 478 * triggers that require testing the fields, it will return true, 479 * otherwise false. 480 */ 481 static inline bool 482 trace_trigger_soft_disabled(struct trace_event_file *file) 483 { 484 unsigned long eflags = file->flags; 485 486 if (!(eflags & EVENT_FILE_FL_TRIGGER_COND)) { 487 if (eflags & EVENT_FILE_FL_TRIGGER_MODE) 488 event_triggers_call(file, NULL, NULL); 489 if (eflags & EVENT_FILE_FL_SOFT_DISABLED) 490 return true; 491 if (eflags & EVENT_FILE_FL_PID_FILTER) 492 return trace_event_ignore_this_pid(file); 493 } 494 return false; 495 } 496 497 #ifdef CONFIG_BPF_EVENTS 498 unsigned int trace_call_bpf(struct trace_event_call *call, void *ctx); 499 int perf_event_attach_bpf_prog(struct perf_event *event, struct bpf_prog *prog); 500 void perf_event_detach_bpf_prog(struct perf_event *event); 501 int perf_event_query_prog_array(struct perf_event *event, void __user *info); 502 int bpf_probe_register(struct bpf_raw_event_map *btp, struct bpf_prog *prog); 503 int bpf_probe_unregister(struct bpf_raw_event_map *btp, struct bpf_prog *prog); 504 struct bpf_raw_event_map *bpf_get_raw_tracepoint(const char *name); 505 void bpf_put_raw_tracepoint(struct bpf_raw_event_map *btp); 506 int bpf_get_perf_event_info(const struct perf_event *event, u32 *prog_id, 507 u32 *fd_type, const char **buf, 508 u64 *probe_offset, u64 *probe_addr); 509 #else 510 static inline unsigned int trace_call_bpf(struct trace_event_call *call, void *ctx) 511 { 512 return 1; 513 } 514 515 static inline int 516 perf_event_attach_bpf_prog(struct perf_event *event, struct bpf_prog *prog) 517 { 518 return -EOPNOTSUPP; 519 } 520 521 static inline void perf_event_detach_bpf_prog(struct perf_event *event) { } 522 523 static inline int 524 perf_event_query_prog_array(struct perf_event *event, void __user *info) 525 { 526 return -EOPNOTSUPP; 527 } 528 static inline int bpf_probe_register(struct bpf_raw_event_map *btp, struct bpf_prog *p) 529 { 530 return -EOPNOTSUPP; 531 } 532 static inline int bpf_probe_unregister(struct bpf_raw_event_map *btp, struct bpf_prog *p) 533 { 534 return -EOPNOTSUPP; 535 } 536 static inline struct bpf_raw_event_map *bpf_get_raw_tracepoint(const char *name) 537 { 538 return NULL; 539 } 540 static inline void bpf_put_raw_tracepoint(struct bpf_raw_event_map *btp) 541 { 542 } 543 static inline int bpf_get_perf_event_info(const struct perf_event *event, 544 u32 *prog_id, u32 *fd_type, 545 const char **buf, u64 *probe_offset, 546 u64 *probe_addr) 547 { 548 return -EOPNOTSUPP; 549 } 550 #endif 551 552 enum { 553 FILTER_OTHER = 0, 554 FILTER_STATIC_STRING, 555 FILTER_DYN_STRING, 556 FILTER_PTR_STRING, 557 FILTER_TRACE_FN, 558 FILTER_COMM, 559 FILTER_CPU, 560 }; 561 562 extern int trace_event_raw_init(struct trace_event_call *call); 563 extern int trace_define_field(struct trace_event_call *call, const char *type, 564 const char *name, int offset, int size, 565 int is_signed, int filter_type); 566 extern int trace_add_event_call(struct trace_event_call *call); 567 extern int trace_remove_event_call(struct trace_event_call *call); 568 extern int trace_event_get_offsets(struct trace_event_call *call); 569 570 #define is_signed_type(type) (((type)(-1)) < (type)1) 571 572 int ftrace_set_clr_event(struct trace_array *tr, char *buf, int set); 573 int trace_set_clr_event(const char *system, const char *event, int set); 574 int trace_array_set_clr_event(struct trace_array *tr, const char *system, 575 const char *event, bool enable); 576 /* 577 * The double __builtin_constant_p is because gcc will give us an error 578 * if we try to allocate the static variable to fmt if it is not a 579 * constant. Even with the outer if statement optimizing out. 580 */ 581 #define event_trace_printk(ip, fmt, args...) \ 582 do { \ 583 __trace_printk_check_format(fmt, ##args); \ 584 tracing_record_cmdline(current); \ 585 if (__builtin_constant_p(fmt)) { \ 586 static const char *trace_printk_fmt \ 587 __attribute__((section("__trace_printk_fmt"))) = \ 588 __builtin_constant_p(fmt) ? fmt : NULL; \ 589 \ 590 __trace_bprintk(ip, trace_printk_fmt, ##args); \ 591 } else \ 592 __trace_printk(ip, fmt, ##args); \ 593 } while (0) 594 595 #ifdef CONFIG_PERF_EVENTS 596 struct perf_event; 597 598 DECLARE_PER_CPU(struct pt_regs, perf_trace_regs); 599 DECLARE_PER_CPU(int, bpf_kprobe_override); 600 601 extern int perf_trace_init(struct perf_event *event); 602 extern void perf_trace_destroy(struct perf_event *event); 603 extern int perf_trace_add(struct perf_event *event, int flags); 604 extern void perf_trace_del(struct perf_event *event, int flags); 605 #ifdef CONFIG_KPROBE_EVENTS 606 extern int perf_kprobe_init(struct perf_event *event, bool is_retprobe); 607 extern void perf_kprobe_destroy(struct perf_event *event); 608 extern int bpf_get_kprobe_info(const struct perf_event *event, 609 u32 *fd_type, const char **symbol, 610 u64 *probe_offset, u64 *probe_addr, 611 bool perf_type_tracepoint); 612 #endif 613 #ifdef CONFIG_UPROBE_EVENTS 614 extern int perf_uprobe_init(struct perf_event *event, 615 unsigned long ref_ctr_offset, bool is_retprobe); 616 extern void perf_uprobe_destroy(struct perf_event *event); 617 extern int bpf_get_uprobe_info(const struct perf_event *event, 618 u32 *fd_type, const char **filename, 619 u64 *probe_offset, bool perf_type_tracepoint); 620 #endif 621 extern int ftrace_profile_set_filter(struct perf_event *event, int event_id, 622 char *filter_str); 623 extern void ftrace_profile_free_filter(struct perf_event *event); 624 void perf_trace_buf_update(void *record, u16 type); 625 void *perf_trace_buf_alloc(int size, struct pt_regs **regs, int *rctxp); 626 627 void bpf_trace_run1(struct bpf_prog *prog, u64 arg1); 628 void bpf_trace_run2(struct bpf_prog *prog, u64 arg1, u64 arg2); 629 void bpf_trace_run3(struct bpf_prog *prog, u64 arg1, u64 arg2, 630 u64 arg3); 631 void bpf_trace_run4(struct bpf_prog *prog, u64 arg1, u64 arg2, 632 u64 arg3, u64 arg4); 633 void bpf_trace_run5(struct bpf_prog *prog, u64 arg1, u64 arg2, 634 u64 arg3, u64 arg4, u64 arg5); 635 void bpf_trace_run6(struct bpf_prog *prog, u64 arg1, u64 arg2, 636 u64 arg3, u64 arg4, u64 arg5, u64 arg6); 637 void bpf_trace_run7(struct bpf_prog *prog, u64 arg1, u64 arg2, 638 u64 arg3, u64 arg4, u64 arg5, u64 arg6, u64 arg7); 639 void bpf_trace_run8(struct bpf_prog *prog, u64 arg1, u64 arg2, 640 u64 arg3, u64 arg4, u64 arg5, u64 arg6, u64 arg7, 641 u64 arg8); 642 void bpf_trace_run9(struct bpf_prog *prog, u64 arg1, u64 arg2, 643 u64 arg3, u64 arg4, u64 arg5, u64 arg6, u64 arg7, 644 u64 arg8, u64 arg9); 645 void bpf_trace_run10(struct bpf_prog *prog, u64 arg1, u64 arg2, 646 u64 arg3, u64 arg4, u64 arg5, u64 arg6, u64 arg7, 647 u64 arg8, u64 arg9, u64 arg10); 648 void bpf_trace_run11(struct bpf_prog *prog, u64 arg1, u64 arg2, 649 u64 arg3, u64 arg4, u64 arg5, u64 arg6, u64 arg7, 650 u64 arg8, u64 arg9, u64 arg10, u64 arg11); 651 void bpf_trace_run12(struct bpf_prog *prog, u64 arg1, u64 arg2, 652 u64 arg3, u64 arg4, u64 arg5, u64 arg6, u64 arg7, 653 u64 arg8, u64 arg9, u64 arg10, u64 arg11, u64 arg12); 654 void perf_trace_run_bpf_submit(void *raw_data, int size, int rctx, 655 struct trace_event_call *call, u64 count, 656 struct pt_regs *regs, struct hlist_head *head, 657 struct task_struct *task); 658 659 static inline void 660 perf_trace_buf_submit(void *raw_data, int size, int rctx, u16 type, 661 u64 count, struct pt_regs *regs, void *head, 662 struct task_struct *task) 663 { 664 perf_tp_event(type, count, raw_data, size, regs, head, rctx, task); 665 } 666 667 #endif 668 669 #endif /* _LINUX_TRACE_EVENT_H */ 670