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