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