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