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