.. | .. |
---|
11 | 11 | #include <linux/tracepoint.h> |
---|
12 | 12 | |
---|
13 | 13 | struct trace_array; |
---|
14 | | -struct trace_buffer; |
---|
| 14 | +struct array_buffer; |
---|
15 | 15 | struct tracer; |
---|
16 | 16 | struct dentry; |
---|
17 | 17 | struct bpf_prog; |
---|
.. | .. |
---|
45 | 45 | const void *buf, int count, |
---|
46 | 46 | size_t el_size); |
---|
47 | 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 | + |
---|
48 | 53 | struct trace_iterator; |
---|
49 | 54 | struct trace_event; |
---|
50 | 55 | |
---|
.. | .. |
---|
74 | 79 | struct trace_iterator { |
---|
75 | 80 | struct trace_array *tr; |
---|
76 | 81 | struct tracer *trace; |
---|
77 | | - struct trace_buffer *trace_buffer; |
---|
| 82 | + struct array_buffer *array_buffer; |
---|
78 | 83 | void *private; |
---|
79 | 84 | int cpu_file; |
---|
80 | 85 | struct mutex mutex; |
---|
81 | 86 | struct ring_buffer_iter **buffer_iter; |
---|
82 | 87 | unsigned long iter_flags; |
---|
| 88 | + void *temp; /* temp holder */ |
---|
| 89 | + unsigned int temp_size; |
---|
83 | 90 | |
---|
84 | 91 | /* trace_seq for __print_flags() and __print_symbolic() etc. */ |
---|
85 | 92 | struct trace_seq tmp_seq; |
---|
.. | .. |
---|
142 | 149 | enum print_line_t trace_handle_return(struct trace_seq *s); |
---|
143 | 150 | |
---|
144 | 151 | void tracing_generic_entry_update(struct trace_entry *entry, |
---|
| 152 | + unsigned short type, |
---|
145 | 153 | unsigned long flags, |
---|
146 | 154 | int pc); |
---|
147 | 155 | struct trace_event_file; |
---|
148 | 156 | |
---|
149 | 157 | struct ring_buffer_event * |
---|
150 | | -trace_event_buffer_lock_reserve(struct ring_buffer **current_buffer, |
---|
| 158 | +trace_event_buffer_lock_reserve(struct trace_buffer **current_buffer, |
---|
151 | 159 | struct trace_event_file *trace_file, |
---|
152 | 160 | int type, unsigned long len, |
---|
153 | 161 | unsigned long flags, int pc); |
---|
.. | .. |
---|
186 | 194 | |
---|
187 | 195 | struct trace_event_call; |
---|
188 | 196 | |
---|
| 197 | +#define TRACE_FUNCTION_TYPE ((const char *)~0UL) |
---|
| 198 | + |
---|
| 199 | +struct trace_event_fields { |
---|
| 200 | + const char *type; |
---|
| 201 | + union { |
---|
| 202 | + struct { |
---|
| 203 | + const char *name; |
---|
| 204 | + const int size; |
---|
| 205 | + const int align; |
---|
| 206 | + const int is_signed; |
---|
| 207 | + const int filter_type; |
---|
| 208 | + }; |
---|
| 209 | + int (*define_fields)(struct trace_event_call *); |
---|
| 210 | + }; |
---|
| 211 | +}; |
---|
| 212 | + |
---|
189 | 213 | struct trace_event_class { |
---|
190 | 214 | const char *system; |
---|
191 | 215 | void *probe; |
---|
.. | .. |
---|
194 | 218 | #endif |
---|
195 | 219 | int (*reg)(struct trace_event_call *event, |
---|
196 | 220 | enum trace_reg type, void *data); |
---|
197 | | - int (*define_fields)(struct trace_event_call *); |
---|
| 221 | + struct trace_event_fields *fields_array; |
---|
198 | 222 | struct list_head *(*get_fields)(struct trace_event_call *); |
---|
199 | 223 | struct list_head fields; |
---|
200 | 224 | int (*raw_init)(struct trace_event_call *); |
---|
.. | .. |
---|
204 | 228 | enum trace_reg type, void *data); |
---|
205 | 229 | |
---|
206 | 230 | struct trace_event_buffer { |
---|
207 | | - struct ring_buffer *buffer; |
---|
| 231 | + struct trace_buffer *buffer; |
---|
208 | 232 | struct ring_buffer_event *event; |
---|
209 | 233 | struct trace_event_file *trace_file; |
---|
210 | 234 | void *entry; |
---|
211 | 235 | unsigned long flags; |
---|
212 | 236 | int pc; |
---|
| 237 | + struct pt_regs *regs; |
---|
213 | 238 | }; |
---|
214 | 239 | |
---|
215 | 240 | void *trace_event_buffer_reserve(struct trace_event_buffer *fbuffer, |
---|
.. | .. |
---|
317 | 342 | return call->name; |
---|
318 | 343 | } |
---|
319 | 344 | |
---|
| 345 | +static inline struct list_head * |
---|
| 346 | +trace_get_fields(struct trace_event_call *event_call) |
---|
| 347 | +{ |
---|
| 348 | + if (!event_call->class->get_fields) |
---|
| 349 | + return &event_call->class->fields; |
---|
| 350 | + return event_call->class->get_fields(event_call); |
---|
| 351 | +} |
---|
| 352 | + |
---|
320 | 353 | struct trace_array; |
---|
321 | 354 | struct trace_subsystem_dir; |
---|
322 | 355 | |
---|
.. | .. |
---|
333 | 366 | EVENT_FILE_FL_PID_FILTER_BIT, |
---|
334 | 367 | EVENT_FILE_FL_WAS_ENABLED_BIT, |
---|
335 | 368 | }; |
---|
| 369 | + |
---|
| 370 | +extern struct trace_event_file *trace_get_event_file(const char *instance, |
---|
| 371 | + const char *system, |
---|
| 372 | + const char *event); |
---|
| 373 | +extern void trace_put_event_file(struct trace_event_file *file); |
---|
| 374 | + |
---|
| 375 | +#define MAX_DYNEVENT_CMD_LEN (2048) |
---|
| 376 | + |
---|
| 377 | +enum dynevent_type { |
---|
| 378 | + DYNEVENT_TYPE_SYNTH = 1, |
---|
| 379 | + DYNEVENT_TYPE_KPROBE, |
---|
| 380 | + DYNEVENT_TYPE_NONE, |
---|
| 381 | +}; |
---|
| 382 | + |
---|
| 383 | +struct dynevent_cmd; |
---|
| 384 | + |
---|
| 385 | +typedef int (*dynevent_create_fn_t)(struct dynevent_cmd *cmd); |
---|
| 386 | + |
---|
| 387 | +struct dynevent_cmd { |
---|
| 388 | + struct seq_buf seq; |
---|
| 389 | + const char *event_name; |
---|
| 390 | + unsigned int n_fields; |
---|
| 391 | + enum dynevent_type type; |
---|
| 392 | + dynevent_create_fn_t run_command; |
---|
| 393 | + void *private_data; |
---|
| 394 | +}; |
---|
| 395 | + |
---|
| 396 | +extern int dynevent_create(struct dynevent_cmd *cmd); |
---|
| 397 | + |
---|
| 398 | +extern int synth_event_delete(const char *name); |
---|
| 399 | + |
---|
| 400 | +extern void synth_event_cmd_init(struct dynevent_cmd *cmd, |
---|
| 401 | + char *buf, int maxlen); |
---|
| 402 | + |
---|
| 403 | +extern int __synth_event_gen_cmd_start(struct dynevent_cmd *cmd, |
---|
| 404 | + const char *name, |
---|
| 405 | + struct module *mod, ...); |
---|
| 406 | + |
---|
| 407 | +#define synth_event_gen_cmd_start(cmd, name, mod, ...) \ |
---|
| 408 | + __synth_event_gen_cmd_start(cmd, name, mod, ## __VA_ARGS__, NULL) |
---|
| 409 | + |
---|
| 410 | +struct synth_field_desc { |
---|
| 411 | + const char *type; |
---|
| 412 | + const char *name; |
---|
| 413 | +}; |
---|
| 414 | + |
---|
| 415 | +extern int synth_event_gen_cmd_array_start(struct dynevent_cmd *cmd, |
---|
| 416 | + const char *name, |
---|
| 417 | + struct module *mod, |
---|
| 418 | + struct synth_field_desc *fields, |
---|
| 419 | + unsigned int n_fields); |
---|
| 420 | +extern int synth_event_create(const char *name, |
---|
| 421 | + struct synth_field_desc *fields, |
---|
| 422 | + unsigned int n_fields, struct module *mod); |
---|
| 423 | + |
---|
| 424 | +extern int synth_event_add_field(struct dynevent_cmd *cmd, |
---|
| 425 | + const char *type, |
---|
| 426 | + const char *name); |
---|
| 427 | +extern int synth_event_add_field_str(struct dynevent_cmd *cmd, |
---|
| 428 | + const char *type_name); |
---|
| 429 | +extern int synth_event_add_fields(struct dynevent_cmd *cmd, |
---|
| 430 | + struct synth_field_desc *fields, |
---|
| 431 | + unsigned int n_fields); |
---|
| 432 | + |
---|
| 433 | +#define synth_event_gen_cmd_end(cmd) \ |
---|
| 434 | + dynevent_create(cmd) |
---|
| 435 | + |
---|
| 436 | +struct synth_event; |
---|
| 437 | + |
---|
| 438 | +struct synth_event_trace_state { |
---|
| 439 | + struct trace_event_buffer fbuffer; |
---|
| 440 | + struct synth_trace_event *entry; |
---|
| 441 | + struct trace_buffer *buffer; |
---|
| 442 | + struct synth_event *event; |
---|
| 443 | + unsigned int cur_field; |
---|
| 444 | + unsigned int n_u64; |
---|
| 445 | + bool disabled; |
---|
| 446 | + bool add_next; |
---|
| 447 | + bool add_name; |
---|
| 448 | +}; |
---|
| 449 | + |
---|
| 450 | +extern int synth_event_trace(struct trace_event_file *file, |
---|
| 451 | + unsigned int n_vals, ...); |
---|
| 452 | +extern int synth_event_trace_array(struct trace_event_file *file, u64 *vals, |
---|
| 453 | + unsigned int n_vals); |
---|
| 454 | +extern int synth_event_trace_start(struct trace_event_file *file, |
---|
| 455 | + struct synth_event_trace_state *trace_state); |
---|
| 456 | +extern int synth_event_add_next_val(u64 val, |
---|
| 457 | + struct synth_event_trace_state *trace_state); |
---|
| 458 | +extern int synth_event_add_val(const char *field_name, u64 val, |
---|
| 459 | + struct synth_event_trace_state *trace_state); |
---|
| 460 | +extern int synth_event_trace_end(struct synth_event_trace_state *trace_state); |
---|
| 461 | + |
---|
| 462 | +extern int kprobe_event_delete(const char *name); |
---|
| 463 | + |
---|
| 464 | +extern void kprobe_event_cmd_init(struct dynevent_cmd *cmd, |
---|
| 465 | + char *buf, int maxlen); |
---|
| 466 | + |
---|
| 467 | +#define kprobe_event_gen_cmd_start(cmd, name, loc, ...) \ |
---|
| 468 | + __kprobe_event_gen_cmd_start(cmd, false, name, loc, ## __VA_ARGS__, NULL) |
---|
| 469 | + |
---|
| 470 | +#define kretprobe_event_gen_cmd_start(cmd, name, loc, ...) \ |
---|
| 471 | + __kprobe_event_gen_cmd_start(cmd, true, name, loc, ## __VA_ARGS__, NULL) |
---|
| 472 | + |
---|
| 473 | +extern int __kprobe_event_gen_cmd_start(struct dynevent_cmd *cmd, |
---|
| 474 | + bool kretprobe, |
---|
| 475 | + const char *name, |
---|
| 476 | + const char *loc, ...); |
---|
| 477 | + |
---|
| 478 | +#define kprobe_event_add_fields(cmd, ...) \ |
---|
| 479 | + __kprobe_event_add_fields(cmd, ## __VA_ARGS__, NULL) |
---|
| 480 | + |
---|
| 481 | +#define kprobe_event_add_field(cmd, field) \ |
---|
| 482 | + __kprobe_event_add_fields(cmd, field, NULL) |
---|
| 483 | + |
---|
| 484 | +extern int __kprobe_event_add_fields(struct dynevent_cmd *cmd, ...); |
---|
| 485 | + |
---|
| 486 | +#define kprobe_event_gen_cmd_end(cmd) \ |
---|
| 487 | + dynevent_create(cmd) |
---|
| 488 | + |
---|
| 489 | +#define kretprobe_event_gen_cmd_end(cmd) \ |
---|
| 490 | + dynevent_create(cmd) |
---|
336 | 491 | |
---|
337 | 492 | /* |
---|
338 | 493 | * Event file flags: |
---|
.. | .. |
---|
416 | 571 | |
---|
417 | 572 | #define PERF_MAX_TRACE_SIZE 2048 |
---|
418 | 573 | |
---|
419 | | -#define MAX_FILTER_STR_VAL 256 /* Should handle KSYM_SYMBOL_LEN */ |
---|
| 574 | +#define MAX_FILTER_STR_VAL 256U /* Should handle KSYM_SYMBOL_LEN */ |
---|
420 | 575 | |
---|
421 | 576 | enum event_trigger_type { |
---|
422 | 577 | ETT_NONE = (0), |
---|
.. | .. |
---|
471 | 626 | int perf_event_query_prog_array(struct perf_event *event, void __user *info); |
---|
472 | 627 | int bpf_probe_register(struct bpf_raw_event_map *btp, struct bpf_prog *prog); |
---|
473 | 628 | int bpf_probe_unregister(struct bpf_raw_event_map *btp, struct bpf_prog *prog); |
---|
474 | | -struct bpf_raw_event_map *bpf_find_raw_tracepoint(const char *name); |
---|
| 629 | +struct bpf_raw_event_map *bpf_get_raw_tracepoint(const char *name); |
---|
| 630 | +void bpf_put_raw_tracepoint(struct bpf_raw_event_map *btp); |
---|
475 | 631 | int bpf_get_perf_event_info(const struct perf_event *event, u32 *prog_id, |
---|
476 | 632 | u32 *fd_type, const char **buf, |
---|
477 | 633 | u64 *probe_offset, u64 *probe_addr); |
---|
.. | .. |
---|
502 | 658 | { |
---|
503 | 659 | return -EOPNOTSUPP; |
---|
504 | 660 | } |
---|
505 | | -static inline struct bpf_raw_event_map *bpf_find_raw_tracepoint(const char *name) |
---|
| 661 | +static inline struct bpf_raw_event_map *bpf_get_raw_tracepoint(const char *name) |
---|
506 | 662 | { |
---|
507 | 663 | return NULL; |
---|
| 664 | +} |
---|
| 665 | +static inline void bpf_put_raw_tracepoint(struct bpf_raw_event_map *btp) |
---|
| 666 | +{ |
---|
508 | 667 | } |
---|
509 | 668 | static inline int bpf_get_perf_event_info(const struct perf_event *event, |
---|
510 | 669 | u32 *prog_id, u32 *fd_type, |
---|
.. | .. |
---|
529 | 688 | extern int trace_define_field(struct trace_event_call *call, const char *type, |
---|
530 | 689 | const char *name, int offset, int size, |
---|
531 | 690 | int is_signed, int filter_type); |
---|
532 | | -extern int trace_add_event_call_nolock(struct trace_event_call *call); |
---|
533 | | -extern int trace_remove_event_call_nolock(struct trace_event_call *call); |
---|
534 | 691 | extern int trace_add_event_call(struct trace_event_call *call); |
---|
535 | 692 | extern int trace_remove_event_call(struct trace_event_call *call); |
---|
536 | 693 | extern int trace_event_get_offsets(struct trace_event_call *call); |
---|
537 | 694 | |
---|
538 | 695 | #define is_signed_type(type) (((type)(-1)) < (type)1) |
---|
539 | 696 | |
---|
| 697 | +int ftrace_set_clr_event(struct trace_array *tr, char *buf, int set); |
---|
540 | 698 | int trace_set_clr_event(const char *system, const char *event, int set); |
---|
541 | | - |
---|
| 699 | +int trace_array_set_clr_event(struct trace_array *tr, const char *system, |
---|
| 700 | + const char *event, bool enable); |
---|
542 | 701 | /* |
---|
543 | 702 | * The double __builtin_constant_p is because gcc will give us an error |
---|
544 | 703 | * if we try to allocate the static variable to fmt if it is not a |
---|
.. | .. |
---|
550 | 709 | tracing_record_cmdline(current); \ |
---|
551 | 710 | if (__builtin_constant_p(fmt)) { \ |
---|
552 | 711 | static const char *trace_printk_fmt \ |
---|
553 | | - __attribute__((section("__trace_printk_fmt"))) = \ |
---|
| 712 | + __section("__trace_printk_fmt") = \ |
---|
554 | 713 | __builtin_constant_p(fmt) ? fmt : NULL; \ |
---|
555 | 714 | \ |
---|
556 | 715 | __trace_bprintk(ip, trace_printk_fmt, ##args); \ |
---|
.. | .. |
---|
577 | 736 | bool perf_type_tracepoint); |
---|
578 | 737 | #endif |
---|
579 | 738 | #ifdef CONFIG_UPROBE_EVENTS |
---|
580 | | -extern int perf_uprobe_init(struct perf_event *event, bool is_retprobe); |
---|
| 739 | +extern int perf_uprobe_init(struct perf_event *event, |
---|
| 740 | + unsigned long ref_ctr_offset, bool is_retprobe); |
---|
581 | 741 | extern void perf_uprobe_destroy(struct perf_event *event); |
---|
582 | 742 | extern int bpf_get_uprobe_info(const struct perf_event *event, |
---|
583 | 743 | u32 *fd_type, const char **filename, |
---|