Remove yang.z.zhang@intel.com as committer
[kvmfornfv.git] / kernel / include / linux / ftrace_event.h
1
2 #ifndef _LINUX_FTRACE_EVENT_H
3 #define _LINUX_FTRACE_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 *ftrace_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 *ftrace_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 *ftrace_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 *ftrace_print_bitmask_seq(struct trace_seq *p, void *bitmask_ptr,
43                                      unsigned int bitmask_size);
44
45 const char *ftrace_print_hex_seq(struct trace_seq *p,
46                                  const unsigned char *buf, int len);
47
48 const char *ftrace_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 ftrace_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 FTRACE_MAX_EVENT                                                \
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_ftrace_event(struct trace_event *event);
139 extern int unregister_ftrace_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 ftrace_event_file;
164
165 struct ring_buffer_event *
166 trace_event_buffer_lock_reserve(struct ring_buffer **current_buffer,
167                                 struct ftrace_event_file *ftrace_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_current_buffer_unlock_commit(struct ring_buffer *buffer,
175                                         struct ring_buffer_event *event,
176                                         unsigned long flags, int pc);
177 void trace_buffer_unlock_commit(struct ring_buffer *buffer,
178                                 struct ring_buffer_event *event,
179                                 unsigned long flags, int pc);
180 void trace_buffer_unlock_commit_regs(struct ring_buffer *buffer,
181                                      struct ring_buffer_event *event,
182                                      unsigned long flags, int pc,
183                                      struct pt_regs *regs);
184 void trace_current_buffer_discard_commit(struct ring_buffer *buffer,
185                                          struct ring_buffer_event *event);
186
187 void tracing_record_cmdline(struct task_struct *tsk);
188
189 int ftrace_output_call(struct trace_iterator *iter, char *name, char *fmt, ...);
190
191 struct event_filter;
192
193 enum trace_reg {
194         TRACE_REG_REGISTER,
195         TRACE_REG_UNREGISTER,
196 #ifdef CONFIG_PERF_EVENTS
197         TRACE_REG_PERF_REGISTER,
198         TRACE_REG_PERF_UNREGISTER,
199         TRACE_REG_PERF_OPEN,
200         TRACE_REG_PERF_CLOSE,
201         TRACE_REG_PERF_ADD,
202         TRACE_REG_PERF_DEL,
203 #endif
204 };
205
206 struct ftrace_event_call;
207
208 struct ftrace_event_class {
209         const char              *system;
210         void                    *probe;
211 #ifdef CONFIG_PERF_EVENTS
212         void                    *perf_probe;
213 #endif
214         int                     (*reg)(struct ftrace_event_call *event,
215                                        enum trace_reg type, void *data);
216         int                     (*define_fields)(struct ftrace_event_call *);
217         struct list_head        *(*get_fields)(struct ftrace_event_call *);
218         struct list_head        fields;
219         int                     (*raw_init)(struct ftrace_event_call *);
220 };
221
222 extern int ftrace_event_reg(struct ftrace_event_call *event,
223                             enum trace_reg type, void *data);
224
225 int ftrace_output_event(struct trace_iterator *iter, struct ftrace_event_call *event,
226                         char *fmt, ...);
227
228 int ftrace_event_define_field(struct ftrace_event_call *call,
229                               char *type, int len, char *item, int offset,
230                               int field_size, int sign, int filter);
231
232 struct ftrace_event_buffer {
233         struct ring_buffer              *buffer;
234         struct ring_buffer_event        *event;
235         struct ftrace_event_file        *ftrace_file;
236         void                            *entry;
237         unsigned long                   flags;
238         int                             pc;
239 };
240
241 void *ftrace_event_buffer_reserve(struct ftrace_event_buffer *fbuffer,
242                                   struct ftrace_event_file *ftrace_file,
243                                   unsigned long len);
244
245 void ftrace_event_buffer_commit(struct ftrace_event_buffer *fbuffer);
246
247 int ftrace_event_define_field(struct ftrace_event_call *call,
248                               char *type, int len, char *item, int offset,
249                               int field_size, int sign, int filter);
250
251 enum {
252         TRACE_EVENT_FL_FILTERED_BIT,
253         TRACE_EVENT_FL_CAP_ANY_BIT,
254         TRACE_EVENT_FL_NO_SET_FILTER_BIT,
255         TRACE_EVENT_FL_IGNORE_ENABLE_BIT,
256         TRACE_EVENT_FL_WAS_ENABLED_BIT,
257         TRACE_EVENT_FL_USE_CALL_FILTER_BIT,
258         TRACE_EVENT_FL_TRACEPOINT_BIT,
259         TRACE_EVENT_FL_KPROBE_BIT,
260 };
261
262 /*
263  * Event flags:
264  *  FILTERED      - The event has a filter attached
265  *  CAP_ANY       - Any user can enable for perf
266  *  NO_SET_FILTER - Set when filter has error and is to be ignored
267  *  IGNORE_ENABLE - For ftrace internal events, do not enable with debugfs file
268  *  WAS_ENABLED   - Set and stays set when an event was ever enabled
269  *                    (used for module unloading, if a module event is enabled,
270  *                     it is best to clear the buffers that used it).
271  *  USE_CALL_FILTER - For ftrace internal events, don't use file filter
272  *  TRACEPOINT    - Event is a tracepoint
273  *  KPROBE        - Event is a kprobe
274  */
275 enum {
276         TRACE_EVENT_FL_FILTERED         = (1 << TRACE_EVENT_FL_FILTERED_BIT),
277         TRACE_EVENT_FL_CAP_ANY          = (1 << TRACE_EVENT_FL_CAP_ANY_BIT),
278         TRACE_EVENT_FL_NO_SET_FILTER    = (1 << TRACE_EVENT_FL_NO_SET_FILTER_BIT),
279         TRACE_EVENT_FL_IGNORE_ENABLE    = (1 << TRACE_EVENT_FL_IGNORE_ENABLE_BIT),
280         TRACE_EVENT_FL_WAS_ENABLED      = (1 << TRACE_EVENT_FL_WAS_ENABLED_BIT),
281         TRACE_EVENT_FL_USE_CALL_FILTER  = (1 << TRACE_EVENT_FL_USE_CALL_FILTER_BIT),
282         TRACE_EVENT_FL_TRACEPOINT       = (1 << TRACE_EVENT_FL_TRACEPOINT_BIT),
283         TRACE_EVENT_FL_KPROBE           = (1 << TRACE_EVENT_FL_KPROBE_BIT),
284 };
285
286 struct ftrace_event_call {
287         struct list_head        list;
288         struct ftrace_event_class *class;
289         union {
290                 char                    *name;
291                 /* Set TRACE_EVENT_FL_TRACEPOINT flag when using "tp" */
292                 struct tracepoint       *tp;
293         };
294         struct trace_event      event;
295         char                    *print_fmt;
296         struct event_filter     *filter;
297         void                    *mod;
298         void                    *data;
299         /*
300          *   bit 0:             filter_active
301          *   bit 1:             allow trace by non root (cap any)
302          *   bit 2:             failed to apply filter
303          *   bit 3:             ftrace internal event (do not enable)
304          *   bit 4:             Event was enabled by module
305          *   bit 5:             use call filter rather than file filter
306          *   bit 6:             Event is a tracepoint
307          */
308         int                     flags; /* static flags of different events */
309
310 #ifdef CONFIG_PERF_EVENTS
311         int                             perf_refcount;
312         struct hlist_head __percpu      *perf_events;
313         struct bpf_prog                 *prog;
314
315         int     (*perf_perm)(struct ftrace_event_call *,
316                              struct perf_event *);
317 #endif
318 };
319
320 static inline const char *
321 ftrace_event_name(struct ftrace_event_call *call)
322 {
323         if (call->flags & TRACE_EVENT_FL_TRACEPOINT)
324                 return call->tp ? call->tp->name : NULL;
325         else
326                 return call->name;
327 }
328
329 struct trace_array;
330 struct ftrace_subsystem_dir;
331
332 enum {
333         FTRACE_EVENT_FL_ENABLED_BIT,
334         FTRACE_EVENT_FL_RECORDED_CMD_BIT,
335         FTRACE_EVENT_FL_FILTERED_BIT,
336         FTRACE_EVENT_FL_NO_SET_FILTER_BIT,
337         FTRACE_EVENT_FL_SOFT_MODE_BIT,
338         FTRACE_EVENT_FL_SOFT_DISABLED_BIT,
339         FTRACE_EVENT_FL_TRIGGER_MODE_BIT,
340         FTRACE_EVENT_FL_TRIGGER_COND_BIT,
341 };
342
343 /*
344  * Ftrace event file flags:
345  *  ENABLED       - The event is enabled
346  *  RECORDED_CMD  - The comms should be recorded at sched_switch
347  *  FILTERED      - The event has a filter attached
348  *  NO_SET_FILTER - Set when filter has error and is to be ignored
349  *  SOFT_MODE     - The event is enabled/disabled by SOFT_DISABLED
350  *  SOFT_DISABLED - When set, do not trace the event (even though its
351  *                   tracepoint may be enabled)
352  *  TRIGGER_MODE  - When set, invoke the triggers associated with the event
353  *  TRIGGER_COND  - When set, one or more triggers has an associated filter
354  */
355 enum {
356         FTRACE_EVENT_FL_ENABLED         = (1 << FTRACE_EVENT_FL_ENABLED_BIT),
357         FTRACE_EVENT_FL_RECORDED_CMD    = (1 << FTRACE_EVENT_FL_RECORDED_CMD_BIT),
358         FTRACE_EVENT_FL_FILTERED        = (1 << FTRACE_EVENT_FL_FILTERED_BIT),
359         FTRACE_EVENT_FL_NO_SET_FILTER   = (1 << FTRACE_EVENT_FL_NO_SET_FILTER_BIT),
360         FTRACE_EVENT_FL_SOFT_MODE       = (1 << FTRACE_EVENT_FL_SOFT_MODE_BIT),
361         FTRACE_EVENT_FL_SOFT_DISABLED   = (1 << FTRACE_EVENT_FL_SOFT_DISABLED_BIT),
362         FTRACE_EVENT_FL_TRIGGER_MODE    = (1 << FTRACE_EVENT_FL_TRIGGER_MODE_BIT),
363         FTRACE_EVENT_FL_TRIGGER_COND    = (1 << FTRACE_EVENT_FL_TRIGGER_COND_BIT),
364 };
365
366 struct ftrace_event_file {
367         struct list_head                list;
368         struct ftrace_event_call        *event_call;
369         struct event_filter             *filter;
370         struct dentry                   *dir;
371         struct trace_array              *tr;
372         struct ftrace_subsystem_dir     *system;
373         struct list_head                triggers;
374
375         /*
376          * 32 bit flags:
377          *   bit 0:             enabled
378          *   bit 1:             enabled cmd record
379          *   bit 2:             enable/disable with the soft disable bit
380          *   bit 3:             soft disabled
381          *   bit 4:             trigger enabled
382          *
383          * Note: The bits must be set atomically to prevent races
384          * from other writers. Reads of flags do not need to be in
385          * sync as they occur in critical sections. But the way flags
386          * is currently used, these changes do not affect the code
387          * except that when a change is made, it may have a slight
388          * delay in propagating the changes to other CPUs due to
389          * caching and such. Which is mostly OK ;-)
390          */
391         unsigned long           flags;
392         atomic_t                sm_ref; /* soft-mode reference counter */
393         atomic_t                tm_ref; /* trigger-mode reference counter */
394 };
395
396 #define __TRACE_EVENT_FLAGS(name, value)                                \
397         static int __init trace_init_flags_##name(void)                 \
398         {                                                               \
399                 event_##name.flags |= value;                            \
400                 return 0;                                               \
401         }                                                               \
402         early_initcall(trace_init_flags_##name);
403
404 #define __TRACE_EVENT_PERF_PERM(name, expr...)                          \
405         static int perf_perm_##name(struct ftrace_event_call *tp_event, \
406                                     struct perf_event *p_event)         \
407         {                                                               \
408                 return ({ expr; });                                     \
409         }                                                               \
410         static int __init trace_init_perf_perm_##name(void)             \
411         {                                                               \
412                 event_##name.perf_perm = &perf_perm_##name;             \
413                 return 0;                                               \
414         }                                                               \
415         early_initcall(trace_init_perf_perm_##name);
416
417 #define PERF_MAX_TRACE_SIZE     2048
418
419 #define MAX_FILTER_STR_VAL      256     /* Should handle KSYM_SYMBOL_LEN */
420
421 enum event_trigger_type {
422         ETT_NONE                = (0),
423         ETT_TRACE_ONOFF         = (1 << 0),
424         ETT_SNAPSHOT            = (1 << 1),
425         ETT_STACKTRACE          = (1 << 2),
426         ETT_EVENT_ENABLE        = (1 << 3),
427 };
428
429 extern int filter_match_preds(struct event_filter *filter, void *rec);
430
431 extern int filter_check_discard(struct ftrace_event_file *file, void *rec,
432                                 struct ring_buffer *buffer,
433                                 struct ring_buffer_event *event);
434 extern int call_filter_check_discard(struct ftrace_event_call *call, void *rec,
435                                      struct ring_buffer *buffer,
436                                      struct ring_buffer_event *event);
437 extern enum event_trigger_type event_triggers_call(struct ftrace_event_file *file,
438                                                    void *rec);
439 extern void event_triggers_post_call(struct ftrace_event_file *file,
440                                      enum event_trigger_type tt);
441
442 /**
443  * ftrace_trigger_soft_disabled - do triggers and test if soft disabled
444  * @file: The file pointer of the event to test
445  *
446  * If any triggers without filters are attached to this event, they
447  * will be called here. If the event is soft disabled and has no
448  * triggers that require testing the fields, it will return true,
449  * otherwise false.
450  */
451 static inline bool
452 ftrace_trigger_soft_disabled(struct ftrace_event_file *file)
453 {
454         unsigned long eflags = file->flags;
455
456         if (!(eflags & FTRACE_EVENT_FL_TRIGGER_COND)) {
457                 if (eflags & FTRACE_EVENT_FL_TRIGGER_MODE)
458                         event_triggers_call(file, NULL);
459                 if (eflags & FTRACE_EVENT_FL_SOFT_DISABLED)
460                         return true;
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 ftrace_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 & FTRACE_EVENT_FL_TRIGGER_COND)
488                 *tt = event_triggers_call(file, entry);
489
490         if (test_bit(FTRACE_EVENT_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 ftrace_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(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 ftrace_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(buffer, event,
553                                                 irq_flags, pc, regs);
554
555         if (tt)
556                 event_triggers_post_call(file, tt);
557 }
558
559 #ifdef CONFIG_BPF_SYSCALL
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 };
575
576 extern int trace_event_raw_init(struct ftrace_event_call *call);
577 extern int trace_define_field(struct ftrace_event_call *call, const char *type,
578                               const char *name, int offset, int size,
579                               int is_signed, int filter_type);
580 extern int trace_add_event_call(struct ftrace_event_call *call);
581 extern int trace_remove_event_call(struct ftrace_event_call *call);
582
583 #define is_signed_type(type)    (((type)(-1)) < (type)1)
584
585 int trace_set_clr_event(const char *system, const char *event, int set);
586
587 /*
588  * The double __builtin_constant_p is because gcc will give us an error
589  * if we try to allocate the static variable to fmt if it is not a
590  * constant. Even with the outer if statement optimizing out.
591  */
592 #define event_trace_printk(ip, fmt, args...)                            \
593 do {                                                                    \
594         __trace_printk_check_format(fmt, ##args);                       \
595         tracing_record_cmdline(current);                                \
596         if (__builtin_constant_p(fmt)) {                                \
597                 static const char *trace_printk_fmt                     \
598                   __attribute__((section("__trace_printk_fmt"))) =      \
599                         __builtin_constant_p(fmt) ? fmt : NULL;         \
600                                                                         \
601                 __trace_bprintk(ip, trace_printk_fmt, ##args);          \
602         } else                                                          \
603                 __trace_printk(ip, fmt, ##args);                        \
604 } while (0)
605
606 #ifdef CONFIG_PERF_EVENTS
607 struct perf_event;
608
609 DECLARE_PER_CPU(struct pt_regs, perf_trace_regs);
610
611 extern int  perf_trace_init(struct perf_event *event);
612 extern void perf_trace_destroy(struct perf_event *event);
613 extern int  perf_trace_add(struct perf_event *event, int flags);
614 extern void perf_trace_del(struct perf_event *event, int flags);
615 extern int  ftrace_profile_set_filter(struct perf_event *event, int event_id,
616                                      char *filter_str);
617 extern void ftrace_profile_free_filter(struct perf_event *event);
618 extern void *perf_trace_buf_prepare(int size, unsigned short type,
619                                     struct pt_regs **regs, int *rctxp);
620
621 static inline void
622 perf_trace_buf_submit(void *raw_data, int size, int rctx, u64 addr,
623                        u64 count, struct pt_regs *regs, void *head,
624                        struct task_struct *task)
625 {
626         perf_tp_event(addr, count, raw_data, size, regs, head, rctx, task);
627 }
628 #endif
629
630 #endif /* _LINUX_FTRACE_EVENT_H */