ftrace_event.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595
  1. #ifndef _LINUX_FTRACE_EVENT_H
  2. #define _LINUX_FTRACE_EVENT_H
  3. #include <linux/ring_buffer.h>
  4. #include <linux/trace_seq.h>
  5. #include <linux/percpu.h>
  6. #include <linux/hardirq.h>
  7. #include <linux/perf_event.h>
  8. struct trace_array;
  9. struct trace_buffer;
  10. struct tracer;
  11. struct dentry;
  12. struct trace_print_flags {
  13. unsigned long mask;
  14. const char *name;
  15. };
  16. struct trace_print_flags_u64 {
  17. unsigned long long mask;
  18. const char *name;
  19. };
  20. const char *ftrace_print_flags_seq(struct trace_seq *p, const char *delim,
  21. unsigned long flags,
  22. const struct trace_print_flags *flag_array);
  23. const char *ftrace_print_symbols_seq(struct trace_seq *p, unsigned long val,
  24. const struct trace_print_flags *symbol_array);
  25. #if BITS_PER_LONG == 32
  26. const char *ftrace_print_symbols_seq_u64(struct trace_seq *p,
  27. unsigned long long val,
  28. const struct trace_print_flags_u64
  29. *symbol_array);
  30. #endif
  31. const char *ftrace_print_hex_seq(struct trace_seq *p,
  32. const unsigned char *buf, int len);
  33. struct trace_iterator;
  34. struct trace_event;
  35. int ftrace_raw_output_prep(struct trace_iterator *iter,
  36. struct trace_event *event);
  37. /*
  38. * The trace entry - the most basic unit of tracing. This is what
  39. * is printed in the end as a single line in the trace output, such as:
  40. *
  41. * bash-15816 [01] 235.197585: idle_cpu <- irq_enter
  42. */
  43. struct trace_entry {
  44. unsigned short type;
  45. unsigned char flags;
  46. unsigned char preempt_count;
  47. int pid;
  48. };
  49. #define FTRACE_MAX_EVENT \
  50. ((1 << (sizeof(((struct trace_entry *)0)->type) * 8)) - 1)
  51. /*
  52. * Trace iterator - used by printout routines who present trace
  53. * results to users and which routines might sleep, etc:
  54. */
  55. struct trace_iterator {
  56. struct trace_array *tr;
  57. struct tracer *trace;
  58. struct trace_buffer *trace_buffer;
  59. void *private;
  60. int cpu_file;
  61. struct mutex mutex;
  62. struct ring_buffer_iter **buffer_iter;
  63. unsigned long iter_flags;
  64. /* trace_seq for __print_flags() and __print_symbolic() etc. */
  65. struct trace_seq tmp_seq;
  66. cpumask_var_t started;
  67. /* it's true when current open file is snapshot */
  68. bool snapshot;
  69. /* The below is zeroed out in pipe_read */
  70. struct trace_seq seq;
  71. struct trace_entry *ent;
  72. unsigned long lost_events;
  73. int leftover;
  74. int ent_size;
  75. int cpu;
  76. u64 ts;
  77. loff_t pos;
  78. long idx;
  79. /* All new field here will be zeroed out in pipe_read */
  80. };
  81. enum trace_iter_flags {
  82. TRACE_FILE_LAT_FMT = 1,
  83. TRACE_FILE_ANNOTATE = 2,
  84. TRACE_FILE_TIME_IN_NS = 4,
  85. };
  86. typedef enum print_line_t (*trace_print_func)(struct trace_iterator *iter,
  87. int flags, struct trace_event *event);
  88. struct trace_event_functions {
  89. trace_print_func trace;
  90. trace_print_func raw;
  91. trace_print_func hex;
  92. trace_print_func binary;
  93. };
  94. struct trace_event {
  95. struct hlist_node node;
  96. struct list_head list;
  97. int type;
  98. struct trace_event_functions *funcs;
  99. };
  100. extern int register_ftrace_event(struct trace_event *event);
  101. extern int unregister_ftrace_event(struct trace_event *event);
  102. /* Return values for print_line callback */
  103. enum print_line_t {
  104. TRACE_TYPE_PARTIAL_LINE = 0, /* Retry after flushing the seq */
  105. TRACE_TYPE_HANDLED = 1,
  106. TRACE_TYPE_UNHANDLED = 2, /* Relay to other output functions */
  107. TRACE_TYPE_NO_CONSUME = 3 /* Handled but ask to not consume */
  108. };
  109. void tracing_generic_entry_update(struct trace_entry *entry,
  110. unsigned long flags,
  111. int pc);
  112. struct ftrace_event_file;
  113. struct ring_buffer_event *
  114. trace_event_buffer_lock_reserve(struct ring_buffer **current_buffer,
  115. struct ftrace_event_file *ftrace_file,
  116. int type, unsigned long len,
  117. unsigned long flags, int pc);
  118. struct ring_buffer_event *
  119. trace_current_buffer_lock_reserve(struct ring_buffer **current_buffer,
  120. int type, unsigned long len,
  121. unsigned long flags, int pc);
  122. void trace_current_buffer_unlock_commit(struct ring_buffer *buffer,
  123. struct ring_buffer_event *event,
  124. unsigned long flags, int pc);
  125. void trace_buffer_unlock_commit(struct ring_buffer *buffer,
  126. struct ring_buffer_event *event,
  127. unsigned long flags, int pc);
  128. void trace_buffer_unlock_commit_regs(struct ring_buffer *buffer,
  129. struct ring_buffer_event *event,
  130. unsigned long flags, int pc,
  131. struct pt_regs *regs);
  132. void trace_current_buffer_discard_commit(struct ring_buffer *buffer,
  133. struct ring_buffer_event *event);
  134. void tracing_record_cmdline(struct task_struct *tsk);
  135. int ftrace_output_call(struct trace_iterator *iter, char *name, char *fmt, ...);
  136. struct event_filter;
  137. enum trace_reg {
  138. TRACE_REG_REGISTER,
  139. TRACE_REG_UNREGISTER,
  140. #ifdef CONFIG_PERF_EVENTS
  141. TRACE_REG_PERF_REGISTER,
  142. TRACE_REG_PERF_UNREGISTER,
  143. TRACE_REG_PERF_OPEN,
  144. TRACE_REG_PERF_CLOSE,
  145. TRACE_REG_PERF_ADD,
  146. TRACE_REG_PERF_DEL,
  147. #endif
  148. };
  149. struct ftrace_event_call;
  150. struct ftrace_event_class {
  151. char *system;
  152. void *probe;
  153. #ifdef CONFIG_PERF_EVENTS
  154. void *perf_probe;
  155. #endif
  156. int (*reg)(struct ftrace_event_call *event,
  157. enum trace_reg type, void *data);
  158. int (*define_fields)(struct ftrace_event_call *);
  159. struct list_head *(*get_fields)(struct ftrace_event_call *);
  160. struct list_head fields;
  161. int (*raw_init)(struct ftrace_event_call *);
  162. };
  163. extern int ftrace_event_reg(struct ftrace_event_call *event,
  164. enum trace_reg type, void *data);
  165. int ftrace_output_event(struct trace_iterator *iter, struct ftrace_event_call *event,
  166. char *fmt, ...);
  167. enum {
  168. TRACE_EVENT_FL_FILTERED_BIT,
  169. TRACE_EVENT_FL_CAP_ANY_BIT,
  170. TRACE_EVENT_FL_NO_SET_FILTER_BIT,
  171. TRACE_EVENT_FL_IGNORE_ENABLE_BIT,
  172. TRACE_EVENT_FL_WAS_ENABLED_BIT,
  173. TRACE_EVENT_FL_USE_CALL_FILTER_BIT,
  174. };
  175. /*
  176. * Event flags:
  177. * FILTERED - The event has a filter attached
  178. * CAP_ANY - Any user can enable for perf
  179. * NO_SET_FILTER - Set when filter has error and is to be ignored
  180. * IGNORE_ENABLE - For ftrace internal events, do not enable with debugfs file
  181. * WAS_ENABLED - Set and stays set when an event was ever enabled
  182. * (used for module unloading, if a module event is enabled,
  183. * it is best to clear the buffers that used it).
  184. * USE_CALL_FILTER - For ftrace internal events, don't use file filter
  185. */
  186. enum {
  187. TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT),
  188. TRACE_EVENT_FL_CAP_ANY = (1 << TRACE_EVENT_FL_CAP_ANY_BIT),
  189. TRACE_EVENT_FL_NO_SET_FILTER = (1 << TRACE_EVENT_FL_NO_SET_FILTER_BIT),
  190. TRACE_EVENT_FL_IGNORE_ENABLE = (1 << TRACE_EVENT_FL_IGNORE_ENABLE_BIT),
  191. TRACE_EVENT_FL_WAS_ENABLED = (1 << TRACE_EVENT_FL_WAS_ENABLED_BIT),
  192. TRACE_EVENT_FL_USE_CALL_FILTER = (1 << TRACE_EVENT_FL_USE_CALL_FILTER_BIT),
  193. };
  194. struct ftrace_event_call {
  195. struct list_head list;
  196. struct ftrace_event_class *class;
  197. char *name;
  198. struct trace_event event;
  199. const char *print_fmt;
  200. struct event_filter *filter;
  201. struct list_head *files;
  202. void *mod;
  203. void *data;
  204. /*
  205. * bit 0: filter_active
  206. * bit 1: allow trace by non root (cap any)
  207. * bit 2: failed to apply filter
  208. * bit 3: ftrace internal event (do not enable)
  209. * bit 4: Event was enabled by module
  210. * bit 5: use call filter rather than file filter
  211. */
  212. int flags; /* static flags of different events */
  213. #ifdef CONFIG_PERF_EVENTS
  214. int perf_refcount;
  215. struct hlist_head __percpu *perf_events;
  216. int (*perf_perm)(struct ftrace_event_call *,
  217. struct perf_event *);
  218. #endif
  219. };
  220. struct trace_array;
  221. struct ftrace_subsystem_dir;
  222. enum {
  223. FTRACE_EVENT_FL_ENABLED_BIT,
  224. FTRACE_EVENT_FL_RECORDED_CMD_BIT,
  225. FTRACE_EVENT_FL_FILTERED_BIT,
  226. FTRACE_EVENT_FL_NO_SET_FILTER_BIT,
  227. FTRACE_EVENT_FL_SOFT_MODE_BIT,
  228. FTRACE_EVENT_FL_SOFT_DISABLED_BIT,
  229. FTRACE_EVENT_FL_TRIGGER_MODE_BIT,
  230. FTRACE_EVENT_FL_TRIGGER_COND_BIT,
  231. };
  232. /*
  233. * Ftrace event file flags:
  234. * ENABLED - The event is enabled
  235. * RECORDED_CMD - The comms should be recorded at sched_switch
  236. * FILTERED - The event has a filter attached
  237. * NO_SET_FILTER - Set when filter has error and is to be ignored
  238. * SOFT_MODE - The event is enabled/disabled by SOFT_DISABLED
  239. * SOFT_DISABLED - When set, do not trace the event (even though its
  240. * tracepoint may be enabled)
  241. * TRIGGER_MODE - When set, invoke the triggers associated with the event
  242. * TRIGGER_COND - When set, one or more triggers has an associated filter
  243. */
  244. enum {
  245. FTRACE_EVENT_FL_ENABLED = (1 << FTRACE_EVENT_FL_ENABLED_BIT),
  246. FTRACE_EVENT_FL_RECORDED_CMD = (1 << FTRACE_EVENT_FL_RECORDED_CMD_BIT),
  247. FTRACE_EVENT_FL_FILTERED = (1 << FTRACE_EVENT_FL_FILTERED_BIT),
  248. FTRACE_EVENT_FL_NO_SET_FILTER = (1 << FTRACE_EVENT_FL_NO_SET_FILTER_BIT),
  249. FTRACE_EVENT_FL_SOFT_MODE = (1 << FTRACE_EVENT_FL_SOFT_MODE_BIT),
  250. FTRACE_EVENT_FL_SOFT_DISABLED = (1 << FTRACE_EVENT_FL_SOFT_DISABLED_BIT),
  251. FTRACE_EVENT_FL_TRIGGER_MODE = (1 << FTRACE_EVENT_FL_TRIGGER_MODE_BIT),
  252. FTRACE_EVENT_FL_TRIGGER_COND = (1 << FTRACE_EVENT_FL_TRIGGER_COND_BIT),
  253. };
  254. struct ftrace_event_file {
  255. struct list_head list;
  256. struct ftrace_event_call *event_call;
  257. struct event_filter *filter;
  258. struct dentry *dir;
  259. struct trace_array *tr;
  260. struct ftrace_subsystem_dir *system;
  261. struct list_head triggers;
  262. /*
  263. * 32 bit flags:
  264. * bit 0: enabled
  265. * bit 1: enabled cmd record
  266. * bit 2: enable/disable with the soft disable bit
  267. * bit 3: soft disabled
  268. * bit 4: trigger enabled
  269. *
  270. * Note: The bits must be set atomically to prevent races
  271. * from other writers. Reads of flags do not need to be in
  272. * sync as they occur in critical sections. But the way flags
  273. * is currently used, these changes do not affect the code
  274. * except that when a change is made, it may have a slight
  275. * delay in propagating the changes to other CPUs due to
  276. * caching and such. Which is mostly OK ;-)
  277. */
  278. unsigned long flags;
  279. atomic_t sm_ref; /* soft-mode reference counter */
  280. atomic_t tm_ref; /* trigger-mode reference counter */
  281. };
  282. #define __TRACE_EVENT_FLAGS(name, value) \
  283. static int __init trace_init_flags_##name(void) \
  284. { \
  285. event_##name.flags = value; \
  286. return 0; \
  287. } \
  288. early_initcall(trace_init_flags_##name);
  289. #define __TRACE_EVENT_PERF_PERM(name, expr...) \
  290. static int perf_perm_##name(struct ftrace_event_call *tp_event, \
  291. struct perf_event *p_event) \
  292. { \
  293. return ({ expr; }); \
  294. } \
  295. static int __init trace_init_perf_perm_##name(void) \
  296. { \
  297. event_##name.perf_perm = &perf_perm_##name; \
  298. return 0; \
  299. } \
  300. early_initcall(trace_init_perf_perm_##name);
  301. #define PERF_MAX_TRACE_SIZE 2048
  302. #define MAX_FILTER_STR_VAL 256 /* Should handle KSYM_SYMBOL_LEN */
  303. enum event_trigger_type {
  304. ETT_NONE = (0),
  305. ETT_TRACE_ONOFF = (1 << 0),
  306. ETT_SNAPSHOT = (1 << 1),
  307. ETT_STACKTRACE = (1 << 2),
  308. ETT_EVENT_ENABLE = (1 << 3),
  309. };
  310. extern void destroy_preds(struct ftrace_event_file *file);
  311. extern void destroy_call_preds(struct ftrace_event_call *call);
  312. extern int filter_match_preds(struct event_filter *filter, void *rec);
  313. extern int filter_check_discard(struct ftrace_event_file *file, void *rec,
  314. struct ring_buffer *buffer,
  315. struct ring_buffer_event *event);
  316. extern int call_filter_check_discard(struct ftrace_event_call *call, void *rec,
  317. struct ring_buffer *buffer,
  318. struct ring_buffer_event *event);
  319. extern enum event_trigger_type event_triggers_call(struct ftrace_event_file *file,
  320. void *rec);
  321. extern void event_triggers_post_call(struct ftrace_event_file *file,
  322. enum event_trigger_type tt);
  323. /**
  324. * ftrace_trigger_soft_disabled - do triggers and test if soft disabled
  325. * @file: The file pointer of the event to test
  326. *
  327. * If any triggers without filters are attached to this event, they
  328. * will be called here. If the event is soft disabled and has no
  329. * triggers that require testing the fields, it will return true,
  330. * otherwise false.
  331. */
  332. static inline bool
  333. ftrace_trigger_soft_disabled(struct ftrace_event_file *file)
  334. {
  335. unsigned long eflags = file->flags;
  336. if (!(eflags & FTRACE_EVENT_FL_TRIGGER_COND)) {
  337. if (eflags & FTRACE_EVENT_FL_TRIGGER_MODE)
  338. event_triggers_call(file, NULL);
  339. if (eflags & FTRACE_EVENT_FL_SOFT_DISABLED)
  340. return true;
  341. }
  342. return false;
  343. }
  344. /*
  345. * Helper function for event_trigger_unlock_commit{_regs}().
  346. * If there are event triggers attached to this event that requires
  347. * filtering against its fields, then they wil be called as the
  348. * entry already holds the field information of the current event.
  349. *
  350. * It also checks if the event should be discarded or not.
  351. * It is to be discarded if the event is soft disabled and the
  352. * event was only recorded to process triggers, or if the event
  353. * filter is active and this event did not match the filters.
  354. *
  355. * Returns true if the event is discarded, false otherwise.
  356. */
  357. static inline bool
  358. __event_trigger_test_discard(struct ftrace_event_file *file,
  359. struct ring_buffer *buffer,
  360. struct ring_buffer_event *event,
  361. void *entry,
  362. enum event_trigger_type *tt)
  363. {
  364. unsigned long eflags = file->flags;
  365. if (eflags & FTRACE_EVENT_FL_TRIGGER_COND)
  366. *tt = event_triggers_call(file, entry);
  367. if (test_bit(FTRACE_EVENT_FL_SOFT_DISABLED_BIT, &file->flags))
  368. ring_buffer_discard_commit(buffer, event);
  369. else if (!filter_check_discard(file, entry, buffer, event))
  370. return false;
  371. return true;
  372. }
  373. /**
  374. * event_trigger_unlock_commit - handle triggers and finish event commit
  375. * @file: The file pointer assoctiated to the event
  376. * @buffer: The ring buffer that the event is being written to
  377. * @event: The event meta data in the ring buffer
  378. * @entry: The event itself
  379. * @irq_flags: The state of the interrupts at the start of the event
  380. * @pc: The state of the preempt count at the start of the event.
  381. *
  382. * This is a helper function to handle triggers that require data
  383. * from the event itself. It also tests the event against filters and
  384. * if the event is soft disabled and should be discarded.
  385. */
  386. static inline void
  387. event_trigger_unlock_commit(struct ftrace_event_file *file,
  388. struct ring_buffer *buffer,
  389. struct ring_buffer_event *event,
  390. void *entry, unsigned long irq_flags, int pc)
  391. {
  392. enum event_trigger_type tt = ETT_NONE;
  393. if (!__event_trigger_test_discard(file, buffer, event, entry, &tt))
  394. trace_buffer_unlock_commit(buffer, event, irq_flags, pc);
  395. if (tt)
  396. event_triggers_post_call(file, tt);
  397. }
  398. /**
  399. * event_trigger_unlock_commit_regs - handle triggers and finish event commit
  400. * @file: The file pointer assoctiated to the event
  401. * @buffer: The ring buffer that the event is being written to
  402. * @event: The event meta data in the ring buffer
  403. * @entry: The event itself
  404. * @irq_flags: The state of the interrupts at the start of the event
  405. * @pc: The state of the preempt count at the start of the event.
  406. *
  407. * This is a helper function to handle triggers that require data
  408. * from the event itself. It also tests the event against filters and
  409. * if the event is soft disabled and should be discarded.
  410. *
  411. * Same as event_trigger_unlock_commit() but calls
  412. * trace_buffer_unlock_commit_regs() instead of trace_buffer_unlock_commit().
  413. */
  414. static inline void
  415. event_trigger_unlock_commit_regs(struct ftrace_event_file *file,
  416. struct ring_buffer *buffer,
  417. struct ring_buffer_event *event,
  418. void *entry, unsigned long irq_flags, int pc,
  419. struct pt_regs *regs)
  420. {
  421. enum event_trigger_type tt = ETT_NONE;
  422. if (!__event_trigger_test_discard(file, buffer, event, entry, &tt))
  423. trace_buffer_unlock_commit_regs(buffer, event,
  424. irq_flags, pc, regs);
  425. if (tt)
  426. event_triggers_post_call(file, tt);
  427. }
  428. enum {
  429. FILTER_OTHER = 0,
  430. FILTER_STATIC_STRING,
  431. FILTER_DYN_STRING,
  432. FILTER_PTR_STRING,
  433. FILTER_TRACE_FN,
  434. };
  435. #define EVENT_STORAGE_SIZE 128
  436. extern struct mutex event_storage_mutex;
  437. extern char event_storage[EVENT_STORAGE_SIZE];
  438. extern int trace_event_raw_init(struct ftrace_event_call *call);
  439. extern int trace_define_field(struct ftrace_event_call *call, const char *type,
  440. const char *name, int offset, int size,
  441. int is_signed, int filter_type);
  442. extern int trace_add_event_call(struct ftrace_event_call *call);
  443. extern int trace_remove_event_call(struct ftrace_event_call *call);
  444. #define is_signed_type(type) (((type)(-1)) < (type)1)
  445. int trace_set_clr_event(const char *system, const char *event, int set);
  446. /*
  447. * The double __builtin_constant_p is because gcc will give us an error
  448. * if we try to allocate the static variable to fmt if it is not a
  449. * constant. Even with the outer if statement optimizing out.
  450. */
  451. #define event_trace_printk(ip, fmt, args...) \
  452. do { \
  453. __trace_printk_check_format(fmt, ##args); \
  454. tracing_record_cmdline(current); \
  455. if (__builtin_constant_p(fmt)) { \
  456. static const char *trace_printk_fmt \
  457. __attribute__((section("__trace_printk_fmt"))) = \
  458. __builtin_constant_p(fmt) ? fmt : NULL; \
  459. \
  460. __trace_bprintk(ip, trace_printk_fmt, ##args); \
  461. } else \
  462. __trace_printk(ip, fmt, ##args); \
  463. } while (0)
  464. /**
  465. * tracepoint_string - register constant persistent string to trace system
  466. * @str - a constant persistent string that will be referenced in tracepoints
  467. *
  468. * If constant strings are being used in tracepoints, it is faster and
  469. * more efficient to just save the pointer to the string and reference
  470. * that with a printf "%s" instead of saving the string in the ring buffer
  471. * and wasting space and time.
  472. *
  473. * The problem with the above approach is that userspace tools that read
  474. * the binary output of the trace buffers do not have access to the string.
  475. * Instead they just show the address of the string which is not very
  476. * useful to users.
  477. *
  478. * With tracepoint_string(), the string will be registered to the tracing
  479. * system and exported to userspace via the debugfs/tracing/printk_formats
  480. * file that maps the string address to the string text. This way userspace
  481. * tools that read the binary buffers have a way to map the pointers to
  482. * the ASCII strings they represent.
  483. *
  484. * The @str used must be a constant string and persistent as it would not
  485. * make sense to show a string that no longer exists. But it is still fine
  486. * to be used with modules, because when modules are unloaded, if they
  487. * had tracepoints, the ring buffers are cleared too. As long as the string
  488. * does not change during the life of the module, it is fine to use
  489. * tracepoint_string() within a module.
  490. */
  491. #define tracepoint_string(str) \
  492. ({ \
  493. static const char *___tp_str __tracepoint_string = str; \
  494. ___tp_str; \
  495. })
  496. #define __tracepoint_string __attribute__((section("__tracepoint_str")))
  497. #ifdef CONFIG_PERF_EVENTS
  498. struct perf_event;
  499. DECLARE_PER_CPU(struct pt_regs, perf_trace_regs);
  500. extern int perf_trace_init(struct perf_event *event);
  501. extern void perf_trace_destroy(struct perf_event *event);
  502. extern int perf_trace_add(struct perf_event *event, int flags);
  503. extern void perf_trace_del(struct perf_event *event, int flags);
  504. extern int ftrace_profile_set_filter(struct perf_event *event, int event_id,
  505. char *filter_str);
  506. extern void ftrace_profile_free_filter(struct perf_event *event);
  507. extern void *perf_trace_buf_prepare(int size, unsigned short type,
  508. struct pt_regs *regs, int *rctxp);
  509. static inline void
  510. perf_trace_buf_submit(void *raw_data, int size, int rctx, u64 addr,
  511. u64 count, struct pt_regs *regs, void *head,
  512. struct task_struct *task)
  513. {
  514. perf_tp_event(addr, count, raw_data, size, regs, head, rctx, task);
  515. }
  516. #endif
  517. #endif /* _LINUX_FTRACE_EVENT_H */