xref: /linux/tools/perf/util/auxtrace.h (revision 22d55f02b8922a097cd4be1e2f131dfa7ef65901)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * auxtrace.h: AUX area trace support
4  * Copyright (c) 2013-2015, Intel Corporation.
5  */
6 
7 #ifndef __PERF_AUXTRACE_H
8 #define __PERF_AUXTRACE_H
9 
10 #include <sys/types.h>
11 #include <errno.h>
12 #include <stdbool.h>
13 #include <stddef.h>
14 #include <linux/list.h>
15 #include <linux/perf_event.h>
16 #include <linux/types.h>
17 #include <asm/bitsperlong.h>
18 
19 #include "../perf.h"
20 #include "event.h"
21 #include "session.h"
22 #include "debug.h"
23 
24 union perf_event;
25 struct perf_session;
26 struct perf_evlist;
27 struct perf_tool;
28 struct perf_mmap;
29 struct option;
30 struct record_opts;
31 struct auxtrace_info_event;
32 struct events_stats;
33 
34 /* Auxtrace records must have the same alignment as perf event records */
35 #define PERF_AUXTRACE_RECORD_ALIGNMENT 8
36 
37 enum auxtrace_type {
38 	PERF_AUXTRACE_UNKNOWN,
39 	PERF_AUXTRACE_INTEL_PT,
40 	PERF_AUXTRACE_INTEL_BTS,
41 	PERF_AUXTRACE_CS_ETM,
42 	PERF_AUXTRACE_ARM_SPE,
43 	PERF_AUXTRACE_S390_CPUMSF,
44 };
45 
46 enum itrace_period_type {
47 	PERF_ITRACE_PERIOD_INSTRUCTIONS,
48 	PERF_ITRACE_PERIOD_TICKS,
49 	PERF_ITRACE_PERIOD_NANOSECS,
50 };
51 
52 /**
53  * struct itrace_synth_opts - AUX area tracing synthesis options.
54  * @set: indicates whether or not options have been set
55  * @default_no_sample: Default to no sampling.
56  * @inject: indicates the event (not just the sample) must be fully synthesized
57  *          because 'perf inject' will write it out
58  * @instructions: whether to synthesize 'instructions' events
59  * @branches: whether to synthesize 'branches' events
60  * @transactions: whether to synthesize events for transactions
61  * @ptwrites: whether to synthesize events for ptwrites
62  * @pwr_events: whether to synthesize power events
63  * @errors: whether to synthesize decoder error events
64  * @dont_decode: whether to skip decoding entirely
65  * @log: write a decoding log
66  * @calls: limit branch samples to calls (can be combined with @returns)
67  * @returns: limit branch samples to returns (can be combined with @calls)
68  * @callchain: add callchain to 'instructions' events
69  * @thread_stack: feed branches to the thread_stack
70  * @last_branch: add branch context to 'instruction' events
71  * @callchain_sz: maximum callchain size
72  * @last_branch_sz: branch context size
73  * @period: 'instructions' events period
74  * @period_type: 'instructions' events period type
75  * @initial_skip: skip N events at the beginning.
76  * @cpu_bitmap: CPUs for which to synthesize events, or NULL for all
77  */
78 struct itrace_synth_opts {
79 	bool			set;
80 	bool			default_no_sample;
81 	bool			inject;
82 	bool			instructions;
83 	bool			branches;
84 	bool			transactions;
85 	bool			ptwrites;
86 	bool			pwr_events;
87 	bool			errors;
88 	bool			dont_decode;
89 	bool			log;
90 	bool			calls;
91 	bool			returns;
92 	bool			callchain;
93 	bool			thread_stack;
94 	bool			last_branch;
95 	unsigned int		callchain_sz;
96 	unsigned int		last_branch_sz;
97 	unsigned long long	period;
98 	enum itrace_period_type	period_type;
99 	unsigned long		initial_skip;
100 	unsigned long		*cpu_bitmap;
101 };
102 
103 /**
104  * struct auxtrace_index_entry - indexes a AUX area tracing event within a
105  *                               perf.data file.
106  * @file_offset: offset within the perf.data file
107  * @sz: size of the event
108  */
109 struct auxtrace_index_entry {
110 	u64			file_offset;
111 	u64			sz;
112 };
113 
114 #define PERF_AUXTRACE_INDEX_ENTRY_COUNT 256
115 
116 /**
117  * struct auxtrace_index - index of AUX area tracing events within a perf.data
118  *                         file.
119  * @list: linking a number of arrays of entries
120  * @nr: number of entries
121  * @entries: array of entries
122  */
123 struct auxtrace_index {
124 	struct list_head	list;
125 	size_t			nr;
126 	struct auxtrace_index_entry entries[PERF_AUXTRACE_INDEX_ENTRY_COUNT];
127 };
128 
129 /**
130  * struct auxtrace - session callbacks to allow AUX area data decoding.
131  * @process_event: lets the decoder see all session events
132  * @process_auxtrace_event: process a PERF_RECORD_AUXTRACE event
133  * @flush_events: process any remaining data
134  * @free_events: free resources associated with event processing
135  * @free: free resources associated with the session
136  */
137 struct auxtrace {
138 	int (*process_event)(struct perf_session *session,
139 			     union perf_event *event,
140 			     struct perf_sample *sample,
141 			     struct perf_tool *tool);
142 	int (*process_auxtrace_event)(struct perf_session *session,
143 				      union perf_event *event,
144 				      struct perf_tool *tool);
145 	int (*flush_events)(struct perf_session *session,
146 			    struct perf_tool *tool);
147 	void (*free_events)(struct perf_session *session);
148 	void (*free)(struct perf_session *session);
149 };
150 
151 /**
152  * struct auxtrace_buffer - a buffer containing AUX area tracing data.
153  * @list: buffers are queued in a list held by struct auxtrace_queue
154  * @size: size of the buffer in bytes
155  * @pid: in per-thread mode, the pid this buffer is associated with
156  * @tid: in per-thread mode, the tid this buffer is associated with
157  * @cpu: in per-cpu mode, the cpu this buffer is associated with
158  * @data: actual buffer data (can be null if the data has not been loaded)
159  * @data_offset: file offset at which the buffer can be read
160  * @mmap_addr: mmap address at which the buffer can be read
161  * @mmap_size: size of the mmap at @mmap_addr
162  * @data_needs_freeing: @data was malloc'd so free it when it is no longer
163  *                      needed
164  * @consecutive: the original data was split up and this buffer is consecutive
165  *               to the previous buffer
166  * @offset: offset as determined by aux_head / aux_tail members of struct
167  *          perf_event_mmap_page
168  * @reference: an implementation-specific reference determined when the data is
169  *             recorded
170  * @buffer_nr: used to number each buffer
171  * @use_size: implementation actually only uses this number of bytes
172  * @use_data: implementation actually only uses data starting at this address
173  */
174 struct auxtrace_buffer {
175 	struct list_head	list;
176 	size_t			size;
177 	pid_t			pid;
178 	pid_t			tid;
179 	int			cpu;
180 	void			*data;
181 	off_t			data_offset;
182 	void			*mmap_addr;
183 	size_t			mmap_size;
184 	bool			data_needs_freeing;
185 	bool			consecutive;
186 	u64			offset;
187 	u64			reference;
188 	u64			buffer_nr;
189 	size_t			use_size;
190 	void			*use_data;
191 };
192 
193 /**
194  * struct auxtrace_queue - a queue of AUX area tracing data buffers.
195  * @head: head of buffer list
196  * @tid: in per-thread mode, the tid this queue is associated with
197  * @cpu: in per-cpu mode, the cpu this queue is associated with
198  * @set: %true once this queue has been dedicated to a specific thread or cpu
199  * @priv: implementation-specific data
200  */
201 struct auxtrace_queue {
202 	struct list_head	head;
203 	pid_t			tid;
204 	int			cpu;
205 	bool			set;
206 	void			*priv;
207 };
208 
209 /**
210  * struct auxtrace_queues - an array of AUX area tracing queues.
211  * @queue_array: array of queues
212  * @nr_queues: number of queues
213  * @new_data: set whenever new data is queued
214  * @populated: queues have been fully populated using the auxtrace_index
215  * @next_buffer_nr: used to number each buffer
216  */
217 struct auxtrace_queues {
218 	struct auxtrace_queue	*queue_array;
219 	unsigned int		nr_queues;
220 	bool			new_data;
221 	bool			populated;
222 	u64			next_buffer_nr;
223 };
224 
225 /**
226  * struct auxtrace_heap_item - element of struct auxtrace_heap.
227  * @queue_nr: queue number
228  * @ordinal: value used for sorting (lowest ordinal is top of the heap) expected
229  *           to be a timestamp
230  */
231 struct auxtrace_heap_item {
232 	unsigned int		queue_nr;
233 	u64			ordinal;
234 };
235 
236 /**
237  * struct auxtrace_heap - a heap suitable for sorting AUX area tracing queues.
238  * @heap_array: the heap
239  * @heap_cnt: the number of elements in the heap
240  * @heap_sz: maximum number of elements (grows as needed)
241  */
242 struct auxtrace_heap {
243 	struct auxtrace_heap_item	*heap_array;
244 	unsigned int		heap_cnt;
245 	unsigned int		heap_sz;
246 };
247 
248 /**
249  * struct auxtrace_mmap - records an mmap of the auxtrace buffer.
250  * @base: address of mapped area
251  * @userpg: pointer to buffer's perf_event_mmap_page
252  * @mask: %0 if @len is not a power of two, otherwise (@len - %1)
253  * @len: size of mapped area
254  * @prev: previous aux_head
255  * @idx: index of this mmap
256  * @tid: tid for a per-thread mmap (also set if there is only 1 tid on a per-cpu
257  *       mmap) otherwise %0
258  * @cpu: cpu number for a per-cpu mmap otherwise %-1
259  */
260 struct auxtrace_mmap {
261 	void		*base;
262 	void		*userpg;
263 	size_t		mask;
264 	size_t		len;
265 	u64		prev;
266 	int		idx;
267 	pid_t		tid;
268 	int		cpu;
269 };
270 
271 /**
272  * struct auxtrace_mmap_params - parameters to set up struct auxtrace_mmap.
273  * @mask: %0 if @len is not a power of two, otherwise (@len - %1)
274  * @offset: file offset of mapped area
275  * @len: size of mapped area
276  * @prot: mmap memory protection
277  * @idx: index of this mmap
278  * @tid: tid for a per-thread mmap (also set if there is only 1 tid on a per-cpu
279  *       mmap) otherwise %0
280  * @cpu: cpu number for a per-cpu mmap otherwise %-1
281  */
282 struct auxtrace_mmap_params {
283 	size_t		mask;
284 	off_t		offset;
285 	size_t		len;
286 	int		prot;
287 	int		idx;
288 	pid_t		tid;
289 	int		cpu;
290 };
291 
292 /**
293  * struct auxtrace_record - callbacks for recording AUX area data.
294  * @recording_options: validate and process recording options
295  * @info_priv_size: return the size of the private data in auxtrace_info_event
296  * @info_fill: fill-in the private data in auxtrace_info_event
297  * @free: free this auxtrace record structure
298  * @snapshot_start: starting a snapshot
299  * @snapshot_finish: finishing a snapshot
300  * @find_snapshot: find data to snapshot within auxtrace mmap
301  * @parse_snapshot_options: parse snapshot options
302  * @reference: provide a 64-bit reference number for auxtrace_event
303  * @read_finish: called after reading from an auxtrace mmap
304  * @alignment: alignment (if any) for AUX area data
305  */
306 struct auxtrace_record {
307 	int (*recording_options)(struct auxtrace_record *itr,
308 				 struct perf_evlist *evlist,
309 				 struct record_opts *opts);
310 	size_t (*info_priv_size)(struct auxtrace_record *itr,
311 				 struct perf_evlist *evlist);
312 	int (*info_fill)(struct auxtrace_record *itr,
313 			 struct perf_session *session,
314 			 struct auxtrace_info_event *auxtrace_info,
315 			 size_t priv_size);
316 	void (*free)(struct auxtrace_record *itr);
317 	int (*snapshot_start)(struct auxtrace_record *itr);
318 	int (*snapshot_finish)(struct auxtrace_record *itr);
319 	int (*find_snapshot)(struct auxtrace_record *itr, int idx,
320 			     struct auxtrace_mmap *mm, unsigned char *data,
321 			     u64 *head, u64 *old);
322 	int (*parse_snapshot_options)(struct auxtrace_record *itr,
323 				      struct record_opts *opts,
324 				      const char *str);
325 	u64 (*reference)(struct auxtrace_record *itr);
326 	int (*read_finish)(struct auxtrace_record *itr, int idx);
327 	unsigned int alignment;
328 };
329 
330 /**
331  * struct addr_filter - address filter.
332  * @list: list node
333  * @range: true if it is a range filter
334  * @start: true if action is 'filter' or 'start'
335  * @action: 'filter', 'start' or 'stop' ('tracestop' is accepted but converted
336  *          to 'stop')
337  * @sym_from: symbol name for the filter address
338  * @sym_to: symbol name that determines the filter size
339  * @sym_from_idx: selects n'th from symbols with the same name (0 means global
340  *                and less than 0 means symbol must be unique)
341  * @sym_to_idx: same as @sym_from_idx but for @sym_to
342  * @addr: filter address
343  * @size: filter region size (for range filters)
344  * @filename: DSO file name or NULL for the kernel
345  * @str: allocated string that contains the other string members
346  */
347 struct addr_filter {
348 	struct list_head	list;
349 	bool			range;
350 	bool			start;
351 	const char		*action;
352 	const char		*sym_from;
353 	const char		*sym_to;
354 	int			sym_from_idx;
355 	int			sym_to_idx;
356 	u64			addr;
357 	u64			size;
358 	const char		*filename;
359 	char			*str;
360 };
361 
362 /**
363  * struct addr_filters - list of address filters.
364  * @head: list of address filters
365  * @cnt: number of address filters
366  */
367 struct addr_filters {
368 	struct list_head	head;
369 	int			cnt;
370 };
371 
372 #ifdef HAVE_AUXTRACE_SUPPORT
373 
374 /*
375  * In snapshot mode the mmapped page is read-only which makes using
376  * __sync_val_compare_and_swap() problematic.  However, snapshot mode expects
377  * the buffer is not updated while the snapshot is made (e.g. Intel PT disables
378  * the event) so there is not a race anyway.
379  */
380 static inline u64 auxtrace_mmap__read_snapshot_head(struct auxtrace_mmap *mm)
381 {
382 	struct perf_event_mmap_page *pc = mm->userpg;
383 	u64 head = READ_ONCE(pc->aux_head);
384 
385 	/* Ensure all reads are done after we read the head */
386 	rmb();
387 	return head;
388 }
389 
390 static inline u64 auxtrace_mmap__read_head(struct auxtrace_mmap *mm)
391 {
392 	struct perf_event_mmap_page *pc = mm->userpg;
393 #if BITS_PER_LONG == 64 || !defined(HAVE_SYNC_COMPARE_AND_SWAP_SUPPORT)
394 	u64 head = READ_ONCE(pc->aux_head);
395 #else
396 	u64 head = __sync_val_compare_and_swap(&pc->aux_head, 0, 0);
397 #endif
398 
399 	/* Ensure all reads are done after we read the head */
400 	rmb();
401 	return head;
402 }
403 
404 static inline void auxtrace_mmap__write_tail(struct auxtrace_mmap *mm, u64 tail)
405 {
406 	struct perf_event_mmap_page *pc = mm->userpg;
407 #if BITS_PER_LONG != 64 && defined(HAVE_SYNC_COMPARE_AND_SWAP_SUPPORT)
408 	u64 old_tail;
409 #endif
410 
411 	/* Ensure all reads are done before we write the tail out */
412 	mb();
413 #if BITS_PER_LONG == 64 || !defined(HAVE_SYNC_COMPARE_AND_SWAP_SUPPORT)
414 	pc->aux_tail = tail;
415 #else
416 	do {
417 		old_tail = __sync_val_compare_and_swap(&pc->aux_tail, 0, 0);
418 	} while (!__sync_bool_compare_and_swap(&pc->aux_tail, old_tail, tail));
419 #endif
420 }
421 
422 int auxtrace_mmap__mmap(struct auxtrace_mmap *mm,
423 			struct auxtrace_mmap_params *mp,
424 			void *userpg, int fd);
425 void auxtrace_mmap__munmap(struct auxtrace_mmap *mm);
426 void auxtrace_mmap_params__init(struct auxtrace_mmap_params *mp,
427 				off_t auxtrace_offset,
428 				unsigned int auxtrace_pages,
429 				bool auxtrace_overwrite);
430 void auxtrace_mmap_params__set_idx(struct auxtrace_mmap_params *mp,
431 				   struct perf_evlist *evlist, int idx,
432 				   bool per_cpu);
433 
434 typedef int (*process_auxtrace_t)(struct perf_tool *tool,
435 				  struct perf_mmap *map,
436 				  union perf_event *event, void *data1,
437 				  size_t len1, void *data2, size_t len2);
438 
439 int auxtrace_mmap__read(struct perf_mmap *map, struct auxtrace_record *itr,
440 			struct perf_tool *tool, process_auxtrace_t fn);
441 
442 int auxtrace_mmap__read_snapshot(struct perf_mmap *map,
443 				 struct auxtrace_record *itr,
444 				 struct perf_tool *tool, process_auxtrace_t fn,
445 				 size_t snapshot_size);
446 
447 int auxtrace_queues__init(struct auxtrace_queues *queues);
448 int auxtrace_queues__add_event(struct auxtrace_queues *queues,
449 			       struct perf_session *session,
450 			       union perf_event *event, off_t data_offset,
451 			       struct auxtrace_buffer **buffer_ptr);
452 void auxtrace_queues__free(struct auxtrace_queues *queues);
453 int auxtrace_queues__process_index(struct auxtrace_queues *queues,
454 				   struct perf_session *session);
455 struct auxtrace_buffer *auxtrace_buffer__next(struct auxtrace_queue *queue,
456 					      struct auxtrace_buffer *buffer);
457 void *auxtrace_buffer__get_data(struct auxtrace_buffer *buffer, int fd);
458 void auxtrace_buffer__put_data(struct auxtrace_buffer *buffer);
459 void auxtrace_buffer__drop_data(struct auxtrace_buffer *buffer);
460 void auxtrace_buffer__free(struct auxtrace_buffer *buffer);
461 
462 int auxtrace_heap__add(struct auxtrace_heap *heap, unsigned int queue_nr,
463 		       u64 ordinal);
464 void auxtrace_heap__pop(struct auxtrace_heap *heap);
465 void auxtrace_heap__free(struct auxtrace_heap *heap);
466 
467 struct auxtrace_cache_entry {
468 	struct hlist_node hash;
469 	u32 key;
470 };
471 
472 struct auxtrace_cache *auxtrace_cache__new(unsigned int bits, size_t entry_size,
473 					   unsigned int limit_percent);
474 void auxtrace_cache__free(struct auxtrace_cache *auxtrace_cache);
475 void *auxtrace_cache__alloc_entry(struct auxtrace_cache *c);
476 void auxtrace_cache__free_entry(struct auxtrace_cache *c, void *entry);
477 int auxtrace_cache__add(struct auxtrace_cache *c, u32 key,
478 			struct auxtrace_cache_entry *entry);
479 void *auxtrace_cache__lookup(struct auxtrace_cache *c, u32 key);
480 
481 struct auxtrace_record *auxtrace_record__init(struct perf_evlist *evlist,
482 					      int *err);
483 
484 int auxtrace_parse_snapshot_options(struct auxtrace_record *itr,
485 				    struct record_opts *opts,
486 				    const char *str);
487 int auxtrace_record__options(struct auxtrace_record *itr,
488 			     struct perf_evlist *evlist,
489 			     struct record_opts *opts);
490 size_t auxtrace_record__info_priv_size(struct auxtrace_record *itr,
491 				       struct perf_evlist *evlist);
492 int auxtrace_record__info_fill(struct auxtrace_record *itr,
493 			       struct perf_session *session,
494 			       struct auxtrace_info_event *auxtrace_info,
495 			       size_t priv_size);
496 void auxtrace_record__free(struct auxtrace_record *itr);
497 int auxtrace_record__snapshot_start(struct auxtrace_record *itr);
498 int auxtrace_record__snapshot_finish(struct auxtrace_record *itr);
499 int auxtrace_record__find_snapshot(struct auxtrace_record *itr, int idx,
500 				   struct auxtrace_mmap *mm,
501 				   unsigned char *data, u64 *head, u64 *old);
502 u64 auxtrace_record__reference(struct auxtrace_record *itr);
503 
504 int auxtrace_index__auxtrace_event(struct list_head *head, union perf_event *event,
505 				   off_t file_offset);
506 int auxtrace_index__write(int fd, struct list_head *head);
507 int auxtrace_index__process(int fd, u64 size, struct perf_session *session,
508 			    bool needs_swap);
509 void auxtrace_index__free(struct list_head *head);
510 
511 void auxtrace_synth_error(struct auxtrace_error_event *auxtrace_error, int type,
512 			  int code, int cpu, pid_t pid, pid_t tid, u64 ip,
513 			  const char *msg, u64 timestamp);
514 
515 int perf_event__synthesize_auxtrace_info(struct auxtrace_record *itr,
516 					 struct perf_tool *tool,
517 					 struct perf_session *session,
518 					 perf_event__handler_t process);
519 int perf_event__process_auxtrace_info(struct perf_session *session,
520 				      union perf_event *event);
521 s64 perf_event__process_auxtrace(struct perf_session *session,
522 				 union perf_event *event);
523 int perf_event__process_auxtrace_error(struct perf_session *session,
524 				       union perf_event *event);
525 int itrace_parse_synth_opts(const struct option *opt, const char *str,
526 			    int unset);
527 void itrace_synth_opts__set_default(struct itrace_synth_opts *synth_opts,
528 				    bool no_sample);
529 
530 size_t perf_event__fprintf_auxtrace_error(union perf_event *event, FILE *fp);
531 void perf_session__auxtrace_error_inc(struct perf_session *session,
532 				      union perf_event *event);
533 void events_stats__auxtrace_error_warn(const struct events_stats *stats);
534 
535 void addr_filters__init(struct addr_filters *filts);
536 void addr_filters__exit(struct addr_filters *filts);
537 int addr_filters__parse_bare_filter(struct addr_filters *filts,
538 				    const char *filter);
539 int auxtrace_parse_filters(struct perf_evlist *evlist);
540 
541 static inline int auxtrace__process_event(struct perf_session *session,
542 					  union perf_event *event,
543 					  struct perf_sample *sample,
544 					  struct perf_tool *tool)
545 {
546 	if (!session->auxtrace)
547 		return 0;
548 
549 	return session->auxtrace->process_event(session, event, sample, tool);
550 }
551 
552 static inline int auxtrace__flush_events(struct perf_session *session,
553 					 struct perf_tool *tool)
554 {
555 	if (!session->auxtrace)
556 		return 0;
557 
558 	return session->auxtrace->flush_events(session, tool);
559 }
560 
561 static inline void auxtrace__free_events(struct perf_session *session)
562 {
563 	if (!session->auxtrace)
564 		return;
565 
566 	return session->auxtrace->free_events(session);
567 }
568 
569 static inline void auxtrace__free(struct perf_session *session)
570 {
571 	if (!session->auxtrace)
572 		return;
573 
574 	return session->auxtrace->free(session);
575 }
576 
577 #define ITRACE_HELP \
578 "				i:	    		synthesize instructions events\n"		\
579 "				b:	    		synthesize branches events\n"		\
580 "				c:	    		synthesize branches events (calls only)\n"	\
581 "				r:	    		synthesize branches events (returns only)\n" \
582 "				x:	    		synthesize transactions events\n"		\
583 "				w:	    		synthesize ptwrite events\n"		\
584 "				p:	    		synthesize power events\n"			\
585 "				e:	    		synthesize error events\n"			\
586 "				d:	    		create a debug log\n"			\
587 "				g[len]:     		synthesize a call chain (use with i or x)\n" \
588 "				l[len]:     		synthesize last branch entries (use with i or x)\n" \
589 "				sNUMBER:    		skip initial number of events\n"		\
590 "				PERIOD[ns|us|ms|i|t]:   specify period to sample stream\n" \
591 "				concatenate multiple options. Default is ibxwpe or cewp\n"
592 
593 
594 #else
595 
596 static inline struct auxtrace_record *
597 auxtrace_record__init(struct perf_evlist *evlist __maybe_unused,
598 		      int *err)
599 {
600 	*err = 0;
601 	return NULL;
602 }
603 
604 static inline
605 void auxtrace_record__free(struct auxtrace_record *itr __maybe_unused)
606 {
607 }
608 
609 static inline int
610 perf_event__synthesize_auxtrace_info(struct auxtrace_record *itr __maybe_unused,
611 				     struct perf_tool *tool __maybe_unused,
612 				     struct perf_session *session __maybe_unused,
613 				     perf_event__handler_t process __maybe_unused)
614 {
615 	return -EINVAL;
616 }
617 
618 static inline
619 int auxtrace_record__options(struct auxtrace_record *itr __maybe_unused,
620 			     struct perf_evlist *evlist __maybe_unused,
621 			     struct record_opts *opts __maybe_unused)
622 {
623 	return 0;
624 }
625 
626 #define perf_event__process_auxtrace_info		0
627 #define perf_event__process_auxtrace			0
628 #define perf_event__process_auxtrace_error		0
629 
630 static inline
631 void perf_session__auxtrace_error_inc(struct perf_session *session
632 				      __maybe_unused,
633 				      union perf_event *event
634 				      __maybe_unused)
635 {
636 }
637 
638 static inline
639 void events_stats__auxtrace_error_warn(const struct events_stats *stats
640 				       __maybe_unused)
641 {
642 }
643 
644 static inline
645 int itrace_parse_synth_opts(const struct option *opt __maybe_unused,
646 			    const char *str __maybe_unused,
647 			    int unset __maybe_unused)
648 {
649 	pr_err("AUX area tracing not supported\n");
650 	return -EINVAL;
651 }
652 
653 static inline
654 int auxtrace_parse_snapshot_options(struct auxtrace_record *itr __maybe_unused,
655 				    struct record_opts *opts __maybe_unused,
656 				    const char *str)
657 {
658 	if (!str)
659 		return 0;
660 	pr_err("AUX area tracing not supported\n");
661 	return -EINVAL;
662 }
663 
664 static inline
665 int auxtrace__process_event(struct perf_session *session __maybe_unused,
666 			    union perf_event *event __maybe_unused,
667 			    struct perf_sample *sample __maybe_unused,
668 			    struct perf_tool *tool __maybe_unused)
669 {
670 	return 0;
671 }
672 
673 static inline
674 int auxtrace__flush_events(struct perf_session *session __maybe_unused,
675 			   struct perf_tool *tool __maybe_unused)
676 {
677 	return 0;
678 }
679 
680 static inline
681 void auxtrace__free_events(struct perf_session *session __maybe_unused)
682 {
683 }
684 
685 static inline
686 void auxtrace_cache__free(struct auxtrace_cache *auxtrace_cache __maybe_unused)
687 {
688 }
689 
690 static inline
691 void auxtrace__free(struct perf_session *session __maybe_unused)
692 {
693 }
694 
695 static inline
696 int auxtrace_index__write(int fd __maybe_unused,
697 			  struct list_head *head __maybe_unused)
698 {
699 	return -EINVAL;
700 }
701 
702 static inline
703 int auxtrace_index__process(int fd __maybe_unused,
704 			    u64 size __maybe_unused,
705 			    struct perf_session *session __maybe_unused,
706 			    bool needs_swap __maybe_unused)
707 {
708 	return -EINVAL;
709 }
710 
711 static inline
712 void auxtrace_index__free(struct list_head *head __maybe_unused)
713 {
714 }
715 
716 static inline
717 int auxtrace_parse_filters(struct perf_evlist *evlist __maybe_unused)
718 {
719 	return 0;
720 }
721 
722 int auxtrace_mmap__mmap(struct auxtrace_mmap *mm,
723 			struct auxtrace_mmap_params *mp,
724 			void *userpg, int fd);
725 void auxtrace_mmap__munmap(struct auxtrace_mmap *mm);
726 void auxtrace_mmap_params__init(struct auxtrace_mmap_params *mp,
727 				off_t auxtrace_offset,
728 				unsigned int auxtrace_pages,
729 				bool auxtrace_overwrite);
730 void auxtrace_mmap_params__set_idx(struct auxtrace_mmap_params *mp,
731 				   struct perf_evlist *evlist, int idx,
732 				   bool per_cpu);
733 
734 #define ITRACE_HELP ""
735 
736 #endif
737 
738 #endif
739