2015-04-09 23:53:42 +08:00
|
|
|
/*
|
|
|
|
* auxtrace.h: AUX area trace support
|
|
|
|
* Copyright (c) 2013-2015, Intel Corporation.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms and conditions of the GNU General Public License,
|
|
|
|
* version 2, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
* more details.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __PERF_AUXTRACE_H
|
|
|
|
#define __PERF_AUXTRACE_H
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
2017-04-18 21:46:11 +08:00
|
|
|
#include <errno.h>
|
2015-04-09 23:53:42 +08:00
|
|
|
#include <stdbool.h>
|
2015-04-09 23:53:44 +08:00
|
|
|
#include <stddef.h>
|
2015-04-21 17:21:51 +08:00
|
|
|
#include <linux/list.h>
|
2015-04-09 23:53:42 +08:00
|
|
|
#include <linux/perf_event.h>
|
|
|
|
#include <linux/types.h>
|
2018-09-25 22:52:10 +08:00
|
|
|
#include <asm/bitsperlong.h>
|
2015-04-09 23:53:42 +08:00
|
|
|
|
|
|
|
#include "../perf.h"
|
2015-04-09 23:53:50 +08:00
|
|
|
#include "event.h"
|
2015-04-09 23:53:48 +08:00
|
|
|
#include "session.h"
|
2015-04-30 22:37:27 +08:00
|
|
|
#include "debug.h"
|
2015-04-09 23:53:42 +08:00
|
|
|
|
2015-04-09 23:53:44 +08:00
|
|
|
union perf_event;
|
|
|
|
struct perf_session;
|
2015-04-09 23:53:42 +08:00
|
|
|
struct perf_evlist;
|
2015-04-09 23:53:44 +08:00
|
|
|
struct perf_tool;
|
2018-09-13 20:54:05 +08:00
|
|
|
struct perf_mmap;
|
2015-04-09 23:53:49 +08:00
|
|
|
struct option;
|
2015-04-09 23:53:44 +08:00
|
|
|
struct record_opts;
|
|
|
|
struct auxtrace_info_event;
|
2015-04-09 23:53:50 +08:00
|
|
|
struct events_stats;
|
2015-04-09 23:53:42 +08:00
|
|
|
|
2019-02-06 18:39:43 +08:00
|
|
|
/* Auxtrace records must have the same alignment as perf event records */
|
|
|
|
#define PERF_AUXTRACE_RECORD_ALIGNMENT 8
|
|
|
|
|
2015-04-09 23:53:53 +08:00
|
|
|
enum auxtrace_type {
|
|
|
|
PERF_AUXTRACE_UNKNOWN,
|
2015-07-18 00:33:36 +08:00
|
|
|
PERF_AUXTRACE_INTEL_PT,
|
perf tools: Add Intel BTS support
Intel BTS support fits within the new auxtrace infrastructure. Recording is
supporting by identifying the Intel BTS PMU, parsing options and setting up
events.
Decoding is supported by queuing up trace data by thread and then decoding
synchronously delivering synthesized event samples into the session processing
for tools to consume.
Committer note:
E.g:
[root@felicio ~]# perf record --per-thread -e intel_bts// ls
anaconda-ks.cfg apctest.output bin kernel-rt-3.10.0-298.rt56.171.el7.x86_64.rpm libexec lock_page.bpf.c perf.data perf.data.old
[ perf record: Woken up 3 times to write data ]
[ perf record: Captured and wrote 4.367 MB perf.data ]
[root@felicio ~]# perf evlist -v
intel_bts//: type: 6, size: 112, { sample_period, sample_freq }: 1, sample_type: IP|TID|IDENTIFIER, read_format: ID, disabled: 1, enable_on_exec: 1, sample_id_all: 1, exclude_guest: 1
dummy:u: type: 1, size: 112, config: 0x9, { sample_period, sample_freq }: 1, sample_type: IP|TID|IDENTIFIER, read_format: ID, disabled: 1, exclude_kernel: 1, exclude_hv: 1, mmap: 1, comm: 1, enable_on_exec: 1, task: 1, sample_id_all: 1, mmap2: 1, comm_exec: 1
[root@felicio ~]# perf script # the navigate in the pager to some interesting place:
ls 1843 1 branches: ffffffff810a60cb flush_signal_handlers ([kernel.kallsyms]) => ffffffff8121a522 setup_new_exec ([kernel.kallsyms])
ls 1843 1 branches: ffffffff8121a529 setup_new_exec ([kernel.kallsyms]) => ffffffff8122fa30 do_close_on_exec ([kernel.kallsyms])
ls 1843 1 branches: ffffffff8122fa5d do_close_on_exec ([kernel.kallsyms]) => ffffffff81767ae0 _raw_spin_lock ([kernel.kallsyms])
ls 1843 1 branches: ffffffff81767af4 _raw_spin_lock ([kernel.kallsyms]) => ffffffff8122fa62 do_close_on_exec ([kernel.kallsyms])
ls 1843 1 branches: ffffffff8122fa8e do_close_on_exec ([kernel.kallsyms]) => ffffffff8122faf0 do_close_on_exec ([kernel.kallsyms])
ls 1843 1 branches: ffffffff8122faf7 do_close_on_exec ([kernel.kallsyms]) => ffffffff8122fa8b do_close_on_exec ([kernel.kallsyms])
ls 1843 1 branches: ffffffff8122fa8e do_close_on_exec ([kernel.kallsyms]) => ffffffff8122faf0 do_close_on_exec ([kernel.kallsyms])
ls 1843 1 branches: ffffffff8122faf7 do_close_on_exec ([kernel.kallsyms]) => ffffffff8122fa8b do_close_on_exec ([kernel.kallsyms])
ls 1843 1 branches: ffffffff8122fa8e do_close_on_exec ([kernel.kallsyms]) => ffffffff8122faf0 do_close_on_exec ([kernel.kallsyms])
ls 1843 1 branches: ffffffff8122faf7 do_close_on_exec ([kernel.kallsyms]) => ffffffff8122fa8b do_close_on_exec ([kernel.kallsyms])
ls 1843 1 branches: ffffffff8122fa8e do_close_on_exec ([kernel.kallsyms]) => ffffffff8122faf0 do_close_on_exec ([kernel.kallsyms])
ls 1843 1 branches: ffffffff8122faf7 do_close_on_exec ([kernel.kallsyms]) => ffffffff8122fa8b do_close_on_exec ([kernel.kallsyms])
ls 1843 1 branches: ffffffff8122fa8e do_close_on_exec ([kernel.kallsyms]) => ffffffff8122faf0 do_close_on_exec ([kernel.kallsyms])
ls 1843 1 branches: ffffffff8122faf7 do_close_on_exec ([kernel.kallsyms]) => ffffffff8122fa8b do_close_on_exec ([kernel.kallsyms])
ls 1843 1 branches: ffffffff8122fa8e do_close_on_exec ([kernel.kallsyms]) => ffffffff8122faf0 do_close_on_exec ([kernel.kallsyms])
ls 1843 1 branches: ffffffff8122faf7 do_close_on_exec ([kernel.kallsyms]) => ffffffff8122fa8b do_close_on_exec ([kernel.kallsyms])
ls 1843 1 branches: ffffffff8122fac9 do_close_on_exec ([kernel.kallsyms]) => ffffffff8122fad2 do_close_on_exec ([kernel.kallsyms])
ls 1843 1 branches: ffffffff8122fadd do_close_on_exec ([kernel.kallsyms]) => ffffffff8120fc80 filp_close ([kernel.kallsyms])
ls 1843 1 branches: ffffffff8120fcaf filp_close ([kernel.kallsyms]) => ffffffff8120fcb6 filp_close ([kernel.kallsyms])
ls 1843 1 branches: ffffffff8120fcc2 filp_close ([kernel.kallsyms]) => ffffffff812547f0 dnotify_flush ([kernel.kallsyms])
ls 1843 1 branches: ffffffff81254823 dnotify_flush ([kernel.kallsyms]) => ffffffff8120fcc7 filp_close ([kernel.kallsyms])
ls 1843 1 branches: ffffffff8120fccd filp_close ([kernel.kallsyms]) => ffffffff81261790 locks_remove_posix ([kernel.kallsyms])
ls 1843 1 branches: ffffffff812617a3 locks_remove_posix ([kernel.kallsyms]) => ffffffff812617b9 locks_remove_posix ([kernel.kallsyms])
ls 1843 1 branches: ffffffff812617b9 locks_remove_posix ([kernel.kallsyms]) => ffffffff8120fcd2 filp_close ([kernel.kallsyms])
ls 1843 1 branches: ffffffff8120fcd5 filp_close ([kernel.kallsyms]) => ffffffff812142c0 fput ([kernel.kallsyms])
ls 1843 1 branches: ffffffff812142d6 fput ([kernel.kallsyms]) => ffffffff812142df fput ([kernel.kallsyms])
ls 1843 1 branches: ffffffff8121430c fput ([kernel.kallsyms]) => ffffffff810b6580 task_work_add ([kernel.kallsyms])
ls 1843 1 branches: ffffffff810b65ad task_work_add ([kernel.kallsyms]) => ffffffff810b65b1 task_work_add ([kernel.kallsyms])
ls 1843 1 branches: ffffffff810b65c1 task_work_add ([kernel.kallsyms]) => ffffffff810bc710 kick_process ([kernel.kallsyms])
ls 1843 1 branches: ffffffff810bc725 kick_process ([kernel.kallsyms]) => ffffffff810bc742 kick_process ([kernel.kallsyms])
ls 1843 1 branches: ffffffff810bc742 kick_process ([kernel.kallsyms]) => ffffffff810b65c6 task_work_add ([kernel.kallsyms])
ls 1843 1 branches: ffffffff810b65c9 task_work_add ([kernel.kallsyms]) => ffffffff81214311 fput ([kernel.kallsyms])
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/1437150840-31811-9-git-send-email-adrian.hunter@intel.com
[ Merged sample->time fix for bug found after first round of testing on slightly older kernel ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2015-07-18 00:33:43 +08:00
|
|
|
PERF_AUXTRACE_INTEL_BTS,
|
2016-09-16 23:50:00 +08:00
|
|
|
PERF_AUXTRACE_CS_ETM,
|
2018-01-15 03:28:50 +08:00
|
|
|
PERF_AUXTRACE_ARM_SPE,
|
perf auxtrace: Support for perf report -D for s390
Add initial support for s390 auxiliary traces using the CPU-Measurement
Sampling Facility.
Support and ignore PERF_REPORT_AUXTRACE_INFO records in the perf data
file. Later patches will show the contents of the auxiliary traces.
Setup the auxtrace queues and data structures for s390. A raw dump of
the perf.data file now does not show an error when an auxtrace event is
encountered.
Output before:
[root@s35lp76 perf]# ./perf report -D -i perf.data.auxtrace
0x128 [0x10]: failed to process type: 70
Error:
failed to process sample
0x128 [0x10]: event: 70
.
. ... raw event: size 16 bytes
. 0000: 00 00 00 46 00 00 00 10 00 00 00 00 00 00 00 00 ...F............
0x128 [0x10]: PERF_RECORD_AUXTRACE_INFO type: 0
[root@s35lp76 perf]#
Output after:
# ./perf report -D -i perf.data.auxtrace |fgrep PERF_RECORD_AUXTRACE
0 0 0x128 [0x10]: PERF_RECORD_AUXTRACE_INFO type: 5
0 0 0x25a66 [0x30]: PERF_RECORD_AUXTRACE size: 0x40000
offset: 0 ref: 0 idx: 4 tid: -1 cpu: 4
....
Additional notes about the underlying hardware and software
implementation, provided by Hendrik Brueckner (see Link: below).
=============================================================================
The CPU-Measurement Facility (CPU-MF) provides a set of functions to obtain
performance information on the mainframe. Basically, it was introduced
with System z10 years ago for the z/Architecture, that means, 64-bit.
For Linux, there are two facilities of interest, counter facility and sampling
facility. The counter facility provides hardware counters for instructions,
cycles, crypto-activities, and many more.
The sampling facility is a hardware sampler that when started will write
samples at a particular interval into a sampling buffer. At some point,
for example, if a sample block is full, it generates an interrupt to collect
samples (while the sampler continues to run).
Few years ago, I started to provide the a perf PMU to use the counter
and sampling facilities. Recently, the device driver was updated to also
"export" the sampling buffer into the AUX area. Thomas now completed the
related perf work to interpret and process these AUX data.
If people are more interested in the sampling facility, they can have a
look into:
- The Load-Program-Parameter and the CPU-Measurement Facilities, SA23-2260-05
http://www-01.ibm.com/support/docview.wss?uid=isg26fcd1cc32246f4c8852574ce0044734a
and to learn how-to use it for Linux on Z, have look at chapter 54,
"Using the CPU-measurement facilities" in the:
- Device Drivers, Features, and Commands, SC33-8411-34
http://public.dhe.ibm.com/software/dw/linux390/docu/l416dd34.pdf
=============================================================================
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Link: http://lkml.kernel.org/r/20180803100758.GA28475@linux.ibm.com
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Link: http://lkml.kernel.org/r/20180802074622.13641-2-tmricht@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2018-08-02 15:46:20 +08:00
|
|
|
PERF_AUXTRACE_S390_CPUMSF,
|
2015-04-09 23:53:53 +08:00
|
|
|
};
|
|
|
|
|
2015-04-09 23:53:49 +08:00
|
|
|
enum itrace_period_type {
|
|
|
|
PERF_ITRACE_PERIOD_INSTRUCTIONS,
|
|
|
|
PERF_ITRACE_PERIOD_TICKS,
|
|
|
|
PERF_ITRACE_PERIOD_NANOSECS,
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct itrace_synth_opts - AUX area tracing synthesis options.
|
|
|
|
* @set: indicates whether or not options have been set
|
2018-09-21 02:05:37 +08:00
|
|
|
* @default_no_sample: Default to no sampling.
|
2015-04-09 23:53:49 +08:00
|
|
|
* @inject: indicates the event (not just the sample) must be fully synthesized
|
|
|
|
* because 'perf inject' will write it out
|
|
|
|
* @instructions: whether to synthesize 'instructions' events
|
|
|
|
* @branches: whether to synthesize 'branches' events
|
2015-04-30 22:37:28 +08:00
|
|
|
* @transactions: whether to synthesize events for transactions
|
2017-05-26 16:17:24 +08:00
|
|
|
* @ptwrites: whether to synthesize events for ptwrites
|
2017-05-26 16:17:25 +08:00
|
|
|
* @pwr_events: whether to synthesize power events
|
2015-04-09 23:53:49 +08:00
|
|
|
* @errors: whether to synthesize decoder error events
|
|
|
|
* @dont_decode: whether to skip decoding entirely
|
|
|
|
* @log: write a decoding log
|
|
|
|
* @calls: limit branch samples to calls (can be combined with @returns)
|
|
|
|
* @returns: limit branch samples to returns (can be combined with @calls)
|
|
|
|
* @callchain: add callchain to 'instructions' events
|
2016-06-23 21:40:57 +08:00
|
|
|
* @thread_stack: feed branches to the thread_stack
|
2015-09-25 21:15:39 +08:00
|
|
|
* @last_branch: add branch context to 'instruction' events
|
2015-04-09 23:53:49 +08:00
|
|
|
* @callchain_sz: maximum callchain size
|
2015-09-25 21:15:39 +08:00
|
|
|
* @last_branch_sz: branch context size
|
2015-04-09 23:53:49 +08:00
|
|
|
* @period: 'instructions' events period
|
|
|
|
* @period_type: 'instructions' events period type
|
2016-03-29 01:45:38 +08:00
|
|
|
* @initial_skip: skip N events at the beginning.
|
2017-05-26 16:17:38 +08:00
|
|
|
* @cpu_bitmap: CPUs for which to synthesize events, or NULL for all
|
2015-04-09 23:53:49 +08:00
|
|
|
*/
|
|
|
|
struct itrace_synth_opts {
|
|
|
|
bool set;
|
2018-09-21 02:05:37 +08:00
|
|
|
bool default_no_sample;
|
2015-04-09 23:53:49 +08:00
|
|
|
bool inject;
|
|
|
|
bool instructions;
|
|
|
|
bool branches;
|
2015-04-30 22:37:28 +08:00
|
|
|
bool transactions;
|
2017-05-26 16:17:24 +08:00
|
|
|
bool ptwrites;
|
2017-05-26 16:17:25 +08:00
|
|
|
bool pwr_events;
|
2015-04-09 23:53:49 +08:00
|
|
|
bool errors;
|
|
|
|
bool dont_decode;
|
|
|
|
bool log;
|
|
|
|
bool calls;
|
|
|
|
bool returns;
|
|
|
|
bool callchain;
|
2016-06-23 21:40:57 +08:00
|
|
|
bool thread_stack;
|
2015-09-25 21:15:39 +08:00
|
|
|
bool last_branch;
|
2015-04-09 23:53:49 +08:00
|
|
|
unsigned int callchain_sz;
|
2015-09-25 21:15:39 +08:00
|
|
|
unsigned int last_branch_sz;
|
2015-04-09 23:53:49 +08:00
|
|
|
unsigned long long period;
|
|
|
|
enum itrace_period_type period_type;
|
2016-03-29 01:45:38 +08:00
|
|
|
unsigned long initial_skip;
|
2017-05-26 16:17:38 +08:00
|
|
|
unsigned long *cpu_bitmap;
|
2015-04-09 23:53:49 +08:00
|
|
|
};
|
|
|
|
|
2015-04-30 22:37:25 +08:00
|
|
|
/**
|
|
|
|
* struct auxtrace_index_entry - indexes a AUX area tracing event within a
|
|
|
|
* perf.data file.
|
|
|
|
* @file_offset: offset within the perf.data file
|
|
|
|
* @sz: size of the event
|
|
|
|
*/
|
|
|
|
struct auxtrace_index_entry {
|
|
|
|
u64 file_offset;
|
|
|
|
u64 sz;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define PERF_AUXTRACE_INDEX_ENTRY_COUNT 256
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct auxtrace_index - index of AUX area tracing events within a perf.data
|
|
|
|
* file.
|
|
|
|
* @list: linking a number of arrays of entries
|
|
|
|
* @nr: number of entries
|
|
|
|
* @entries: array of entries
|
|
|
|
*/
|
|
|
|
struct auxtrace_index {
|
|
|
|
struct list_head list;
|
|
|
|
size_t nr;
|
|
|
|
struct auxtrace_index_entry entries[PERF_AUXTRACE_INDEX_ENTRY_COUNT];
|
|
|
|
};
|
|
|
|
|
2015-04-09 23:53:48 +08:00
|
|
|
/**
|
|
|
|
* struct auxtrace - session callbacks to allow AUX area data decoding.
|
|
|
|
* @process_event: lets the decoder see all session events
|
2018-03-06 17:13:14 +08:00
|
|
|
* @process_auxtrace_event: process a PERF_RECORD_AUXTRACE event
|
2015-04-09 23:53:48 +08:00
|
|
|
* @flush_events: process any remaining data
|
|
|
|
* @free_events: free resources associated with event processing
|
|
|
|
* @free: free resources associated with the session
|
|
|
|
*/
|
|
|
|
struct auxtrace {
|
|
|
|
int (*process_event)(struct perf_session *session,
|
|
|
|
union perf_event *event,
|
|
|
|
struct perf_sample *sample,
|
|
|
|
struct perf_tool *tool);
|
2015-04-09 23:53:53 +08:00
|
|
|
int (*process_auxtrace_event)(struct perf_session *session,
|
|
|
|
union perf_event *event,
|
|
|
|
struct perf_tool *tool);
|
2015-04-09 23:53:48 +08:00
|
|
|
int (*flush_events)(struct perf_session *session,
|
|
|
|
struct perf_tool *tool);
|
|
|
|
void (*free_events)(struct perf_session *session);
|
|
|
|
void (*free)(struct perf_session *session);
|
|
|
|
};
|
|
|
|
|
2015-04-21 17:21:51 +08:00
|
|
|
/**
|
|
|
|
* struct auxtrace_buffer - a buffer containing AUX area tracing data.
|
|
|
|
* @list: buffers are queued in a list held by struct auxtrace_queue
|
|
|
|
* @size: size of the buffer in bytes
|
|
|
|
* @pid: in per-thread mode, the pid this buffer is associated with
|
|
|
|
* @tid: in per-thread mode, the tid this buffer is associated with
|
|
|
|
* @cpu: in per-cpu mode, the cpu this buffer is associated with
|
|
|
|
* @data: actual buffer data (can be null if the data has not been loaded)
|
|
|
|
* @data_offset: file offset at which the buffer can be read
|
|
|
|
* @mmap_addr: mmap address at which the buffer can be read
|
|
|
|
* @mmap_size: size of the mmap at @mmap_addr
|
|
|
|
* @data_needs_freeing: @data was malloc'd so free it when it is no longer
|
|
|
|
* needed
|
|
|
|
* @consecutive: the original data was split up and this buffer is consecutive
|
|
|
|
* to the previous buffer
|
|
|
|
* @offset: offset as determined by aux_head / aux_tail members of struct
|
|
|
|
* perf_event_mmap_page
|
|
|
|
* @reference: an implementation-specific reference determined when the data is
|
|
|
|
* recorded
|
|
|
|
* @buffer_nr: used to number each buffer
|
|
|
|
* @use_size: implementation actually only uses this number of bytes
|
|
|
|
* @use_data: implementation actually only uses data starting at this address
|
|
|
|
*/
|
|
|
|
struct auxtrace_buffer {
|
|
|
|
struct list_head list;
|
|
|
|
size_t size;
|
|
|
|
pid_t pid;
|
|
|
|
pid_t tid;
|
|
|
|
int cpu;
|
|
|
|
void *data;
|
|
|
|
off_t data_offset;
|
|
|
|
void *mmap_addr;
|
|
|
|
size_t mmap_size;
|
|
|
|
bool data_needs_freeing;
|
|
|
|
bool consecutive;
|
|
|
|
u64 offset;
|
|
|
|
u64 reference;
|
|
|
|
u64 buffer_nr;
|
|
|
|
size_t use_size;
|
|
|
|
void *use_data;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct auxtrace_queue - a queue of AUX area tracing data buffers.
|
|
|
|
* @head: head of buffer list
|
|
|
|
* @tid: in per-thread mode, the tid this queue is associated with
|
|
|
|
* @cpu: in per-cpu mode, the cpu this queue is associated with
|
|
|
|
* @set: %true once this queue has been dedicated to a specific thread or cpu
|
|
|
|
* @priv: implementation-specific data
|
|
|
|
*/
|
|
|
|
struct auxtrace_queue {
|
|
|
|
struct list_head head;
|
|
|
|
pid_t tid;
|
|
|
|
int cpu;
|
|
|
|
bool set;
|
|
|
|
void *priv;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct auxtrace_queues - an array of AUX area tracing queues.
|
|
|
|
* @queue_array: array of queues
|
|
|
|
* @nr_queues: number of queues
|
|
|
|
* @new_data: set whenever new data is queued
|
|
|
|
* @populated: queues have been fully populated using the auxtrace_index
|
|
|
|
* @next_buffer_nr: used to number each buffer
|
|
|
|
*/
|
|
|
|
struct auxtrace_queues {
|
|
|
|
struct auxtrace_queue *queue_array;
|
|
|
|
unsigned int nr_queues;
|
|
|
|
bool new_data;
|
|
|
|
bool populated;
|
|
|
|
u64 next_buffer_nr;
|
|
|
|
};
|
|
|
|
|
2015-04-09 23:53:52 +08:00
|
|
|
/**
|
|
|
|
* struct auxtrace_heap_item - element of struct auxtrace_heap.
|
|
|
|
* @queue_nr: queue number
|
|
|
|
* @ordinal: value used for sorting (lowest ordinal is top of the heap) expected
|
|
|
|
* to be a timestamp
|
|
|
|
*/
|
|
|
|
struct auxtrace_heap_item {
|
|
|
|
unsigned int queue_nr;
|
|
|
|
u64 ordinal;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct auxtrace_heap - a heap suitable for sorting AUX area tracing queues.
|
|
|
|
* @heap_array: the heap
|
|
|
|
* @heap_cnt: the number of elements in the heap
|
|
|
|
* @heap_sz: maximum number of elements (grows as needed)
|
|
|
|
*/
|
|
|
|
struct auxtrace_heap {
|
|
|
|
struct auxtrace_heap_item *heap_array;
|
|
|
|
unsigned int heap_cnt;
|
|
|
|
unsigned int heap_sz;
|
|
|
|
};
|
|
|
|
|
2015-04-09 23:53:42 +08:00
|
|
|
/**
|
|
|
|
* struct auxtrace_mmap - records an mmap of the auxtrace buffer.
|
|
|
|
* @base: address of mapped area
|
|
|
|
* @userpg: pointer to buffer's perf_event_mmap_page
|
|
|
|
* @mask: %0 if @len is not a power of two, otherwise (@len - %1)
|
|
|
|
* @len: size of mapped area
|
|
|
|
* @prev: previous aux_head
|
|
|
|
* @idx: index of this mmap
|
|
|
|
* @tid: tid for a per-thread mmap (also set if there is only 1 tid on a per-cpu
|
|
|
|
* mmap) otherwise %0
|
|
|
|
* @cpu: cpu number for a per-cpu mmap otherwise %-1
|
|
|
|
*/
|
|
|
|
struct auxtrace_mmap {
|
|
|
|
void *base;
|
|
|
|
void *userpg;
|
|
|
|
size_t mask;
|
|
|
|
size_t len;
|
|
|
|
u64 prev;
|
|
|
|
int idx;
|
|
|
|
pid_t tid;
|
|
|
|
int cpu;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct auxtrace_mmap_params - parameters to set up struct auxtrace_mmap.
|
|
|
|
* @mask: %0 if @len is not a power of two, otherwise (@len - %1)
|
|
|
|
* @offset: file offset of mapped area
|
|
|
|
* @len: size of mapped area
|
|
|
|
* @prot: mmap memory protection
|
|
|
|
* @idx: index of this mmap
|
|
|
|
* @tid: tid for a per-thread mmap (also set if there is only 1 tid on a per-cpu
|
|
|
|
* mmap) otherwise %0
|
|
|
|
* @cpu: cpu number for a per-cpu mmap otherwise %-1
|
|
|
|
*/
|
|
|
|
struct auxtrace_mmap_params {
|
|
|
|
size_t mask;
|
|
|
|
off_t offset;
|
|
|
|
size_t len;
|
|
|
|
int prot;
|
|
|
|
int idx;
|
|
|
|
pid_t tid;
|
|
|
|
int cpu;
|
|
|
|
};
|
|
|
|
|
2015-04-09 23:53:44 +08:00
|
|
|
/**
|
|
|
|
* struct auxtrace_record - callbacks for recording AUX area data.
|
|
|
|
* @recording_options: validate and process recording options
|
|
|
|
* @info_priv_size: return the size of the private data in auxtrace_info_event
|
|
|
|
* @info_fill: fill-in the private data in auxtrace_info_event
|
|
|
|
* @free: free this auxtrace record structure
|
2015-04-30 22:37:31 +08:00
|
|
|
* @snapshot_start: starting a snapshot
|
|
|
|
* @snapshot_finish: finishing a snapshot
|
|
|
|
* @find_snapshot: find data to snapshot within auxtrace mmap
|
|
|
|
* @parse_snapshot_options: parse snapshot options
|
2015-04-09 23:53:44 +08:00
|
|
|
* @reference: provide a 64-bit reference number for auxtrace_event
|
|
|
|
* @read_finish: called after reading from an auxtrace mmap
|
2018-03-06 17:13:14 +08:00
|
|
|
* @alignment: alignment (if any) for AUX area data
|
2015-04-09 23:53:44 +08:00
|
|
|
*/
|
|
|
|
struct auxtrace_record {
|
|
|
|
int (*recording_options)(struct auxtrace_record *itr,
|
|
|
|
struct perf_evlist *evlist,
|
|
|
|
struct record_opts *opts);
|
2016-01-15 05:46:15 +08:00
|
|
|
size_t (*info_priv_size)(struct auxtrace_record *itr,
|
|
|
|
struct perf_evlist *evlist);
|
2015-04-09 23:53:44 +08:00
|
|
|
int (*info_fill)(struct auxtrace_record *itr,
|
|
|
|
struct perf_session *session,
|
|
|
|
struct auxtrace_info_event *auxtrace_info,
|
|
|
|
size_t priv_size);
|
|
|
|
void (*free)(struct auxtrace_record *itr);
|
2015-04-30 22:37:31 +08:00
|
|
|
int (*snapshot_start)(struct auxtrace_record *itr);
|
|
|
|
int (*snapshot_finish)(struct auxtrace_record *itr);
|
|
|
|
int (*find_snapshot)(struct auxtrace_record *itr, int idx,
|
|
|
|
struct auxtrace_mmap *mm, unsigned char *data,
|
|
|
|
u64 *head, u64 *old);
|
|
|
|
int (*parse_snapshot_options)(struct auxtrace_record *itr,
|
|
|
|
struct record_opts *opts,
|
|
|
|
const char *str);
|
2015-04-09 23:53:44 +08:00
|
|
|
u64 (*reference)(struct auxtrace_record *itr);
|
|
|
|
int (*read_finish)(struct auxtrace_record *itr, int idx);
|
2015-05-29 21:33:38 +08:00
|
|
|
unsigned int alignment;
|
2015-04-09 23:53:44 +08:00
|
|
|
};
|
|
|
|
|
2016-09-23 22:38:39 +08:00
|
|
|
/**
|
|
|
|
* struct addr_filter - address filter.
|
|
|
|
* @list: list node
|
|
|
|
* @range: true if it is a range filter
|
|
|
|
* @start: true if action is 'filter' or 'start'
|
|
|
|
* @action: 'filter', 'start' or 'stop' ('tracestop' is accepted but converted
|
|
|
|
* to 'stop')
|
|
|
|
* @sym_from: symbol name for the filter address
|
|
|
|
* @sym_to: symbol name that determines the filter size
|
|
|
|
* @sym_from_idx: selects n'th from symbols with the same name (0 means global
|
|
|
|
* and less than 0 means symbol must be unique)
|
|
|
|
* @sym_to_idx: same as @sym_from_idx but for @sym_to
|
|
|
|
* @addr: filter address
|
|
|
|
* @size: filter region size (for range filters)
|
|
|
|
* @filename: DSO file name or NULL for the kernel
|
|
|
|
* @str: allocated string that contains the other string members
|
|
|
|
*/
|
|
|
|
struct addr_filter {
|
|
|
|
struct list_head list;
|
|
|
|
bool range;
|
|
|
|
bool start;
|
|
|
|
const char *action;
|
|
|
|
const char *sym_from;
|
|
|
|
const char *sym_to;
|
|
|
|
int sym_from_idx;
|
|
|
|
int sym_to_idx;
|
|
|
|
u64 addr;
|
|
|
|
u64 size;
|
|
|
|
const char *filename;
|
|
|
|
char *str;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct addr_filters - list of address filters.
|
|
|
|
* @head: list of address filters
|
|
|
|
* @cnt: number of address filters
|
|
|
|
*/
|
|
|
|
struct addr_filters {
|
|
|
|
struct list_head head;
|
|
|
|
int cnt;
|
|
|
|
};
|
|
|
|
|
2015-04-30 22:37:27 +08:00
|
|
|
#ifdef HAVE_AUXTRACE_SUPPORT
|
|
|
|
|
2015-04-30 22:37:31 +08:00
|
|
|
/*
|
|
|
|
* In snapshot mode the mmapped page is read-only which makes using
|
|
|
|
* __sync_val_compare_and_swap() problematic. However, snapshot mode expects
|
|
|
|
* the buffer is not updated while the snapshot is made (e.g. Intel PT disables
|
|
|
|
* the event) so there is not a race anyway.
|
|
|
|
*/
|
|
|
|
static inline u64 auxtrace_mmap__read_snapshot_head(struct auxtrace_mmap *mm)
|
|
|
|
{
|
|
|
|
struct perf_event_mmap_page *pc = mm->userpg;
|
locking/atomics: COCCINELLE/treewide: Convert trivial ACCESS_ONCE() patterns to READ_ONCE()/WRITE_ONCE()
Please do not apply this to mainline directly, instead please re-run the
coccinelle script shown below and apply its output.
For several reasons, it is desirable to use {READ,WRITE}_ONCE() in
preference to ACCESS_ONCE(), and new code is expected to use one of the
former. So far, there's been no reason to change most existing uses of
ACCESS_ONCE(), as these aren't harmful, and changing them results in
churn.
However, for some features, the read/write distinction is critical to
correct operation. To distinguish these cases, separate read/write
accessors must be used. This patch migrates (most) remaining
ACCESS_ONCE() instances to {READ,WRITE}_ONCE(), using the following
coccinelle script:
----
// Convert trivial ACCESS_ONCE() uses to equivalent READ_ONCE() and
// WRITE_ONCE()
// $ make coccicheck COCCI=/home/mark/once.cocci SPFLAGS="--include-headers" MODE=patch
virtual patch
@ depends on patch @
expression E1, E2;
@@
- ACCESS_ONCE(E1) = E2
+ WRITE_ONCE(E1, E2)
@ depends on patch @
expression E;
@@
- ACCESS_ONCE(E)
+ READ_ONCE(E)
----
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: davem@davemloft.net
Cc: linux-arch@vger.kernel.org
Cc: mpe@ellerman.id.au
Cc: shuah@kernel.org
Cc: snitzer@redhat.com
Cc: thor.thayer@linux.intel.com
Cc: tj@kernel.org
Cc: viro@zeniv.linux.org.uk
Cc: will.deacon@arm.com
Link: http://lkml.kernel.org/r/1508792849-3115-19-git-send-email-paulmck@linux.vnet.ibm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2017-10-24 05:07:29 +08:00
|
|
|
u64 head = READ_ONCE(pc->aux_head);
|
2015-04-30 22:37:31 +08:00
|
|
|
|
|
|
|
/* Ensure all reads are done after we read the head */
|
|
|
|
rmb();
|
|
|
|
return head;
|
|
|
|
}
|
|
|
|
|
2015-04-09 23:53:42 +08:00
|
|
|
static inline u64 auxtrace_mmap__read_head(struct auxtrace_mmap *mm)
|
|
|
|
{
|
|
|
|
struct perf_event_mmap_page *pc = mm->userpg;
|
|
|
|
#if BITS_PER_LONG == 64 || !defined(HAVE_SYNC_COMPARE_AND_SWAP_SUPPORT)
|
locking/atomics: COCCINELLE/treewide: Convert trivial ACCESS_ONCE() patterns to READ_ONCE()/WRITE_ONCE()
Please do not apply this to mainline directly, instead please re-run the
coccinelle script shown below and apply its output.
For several reasons, it is desirable to use {READ,WRITE}_ONCE() in
preference to ACCESS_ONCE(), and new code is expected to use one of the
former. So far, there's been no reason to change most existing uses of
ACCESS_ONCE(), as these aren't harmful, and changing them results in
churn.
However, for some features, the read/write distinction is critical to
correct operation. To distinguish these cases, separate read/write
accessors must be used. This patch migrates (most) remaining
ACCESS_ONCE() instances to {READ,WRITE}_ONCE(), using the following
coccinelle script:
----
// Convert trivial ACCESS_ONCE() uses to equivalent READ_ONCE() and
// WRITE_ONCE()
// $ make coccicheck COCCI=/home/mark/once.cocci SPFLAGS="--include-headers" MODE=patch
virtual patch
@ depends on patch @
expression E1, E2;
@@
- ACCESS_ONCE(E1) = E2
+ WRITE_ONCE(E1, E2)
@ depends on patch @
expression E;
@@
- ACCESS_ONCE(E)
+ READ_ONCE(E)
----
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: davem@davemloft.net
Cc: linux-arch@vger.kernel.org
Cc: mpe@ellerman.id.au
Cc: shuah@kernel.org
Cc: snitzer@redhat.com
Cc: thor.thayer@linux.intel.com
Cc: tj@kernel.org
Cc: viro@zeniv.linux.org.uk
Cc: will.deacon@arm.com
Link: http://lkml.kernel.org/r/1508792849-3115-19-git-send-email-paulmck@linux.vnet.ibm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2017-10-24 05:07:29 +08:00
|
|
|
u64 head = READ_ONCE(pc->aux_head);
|
2015-04-09 23:53:42 +08:00
|
|
|
#else
|
|
|
|
u64 head = __sync_val_compare_and_swap(&pc->aux_head, 0, 0);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Ensure all reads are done after we read the head */
|
|
|
|
rmb();
|
|
|
|
return head;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void auxtrace_mmap__write_tail(struct auxtrace_mmap *mm, u64 tail)
|
|
|
|
{
|
|
|
|
struct perf_event_mmap_page *pc = mm->userpg;
|
|
|
|
#if BITS_PER_LONG != 64 && defined(HAVE_SYNC_COMPARE_AND_SWAP_SUPPORT)
|
|
|
|
u64 old_tail;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Ensure all reads are done before we write the tail out */
|
|
|
|
mb();
|
|
|
|
#if BITS_PER_LONG == 64 || !defined(HAVE_SYNC_COMPARE_AND_SWAP_SUPPORT)
|
|
|
|
pc->aux_tail = tail;
|
|
|
|
#else
|
|
|
|
do {
|
|
|
|
old_tail = __sync_val_compare_and_swap(&pc->aux_tail, 0, 0);
|
|
|
|
} while (!__sync_bool_compare_and_swap(&pc->aux_tail, old_tail, tail));
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
int auxtrace_mmap__mmap(struct auxtrace_mmap *mm,
|
|
|
|
struct auxtrace_mmap_params *mp,
|
|
|
|
void *userpg, int fd);
|
|
|
|
void auxtrace_mmap__munmap(struct auxtrace_mmap *mm);
|
|
|
|
void auxtrace_mmap_params__init(struct auxtrace_mmap_params *mp,
|
|
|
|
off_t auxtrace_offset,
|
|
|
|
unsigned int auxtrace_pages,
|
|
|
|
bool auxtrace_overwrite);
|
|
|
|
void auxtrace_mmap_params__set_idx(struct auxtrace_mmap_params *mp,
|
|
|
|
struct perf_evlist *evlist, int idx,
|
|
|
|
bool per_cpu);
|
|
|
|
|
2015-04-09 23:53:44 +08:00
|
|
|
typedef int (*process_auxtrace_t)(struct perf_tool *tool,
|
2018-09-13 20:54:06 +08:00
|
|
|
struct perf_mmap *map,
|
2015-04-09 23:53:44 +08:00
|
|
|
union perf_event *event, void *data1,
|
|
|
|
size_t len1, void *data2, size_t len2);
|
|
|
|
|
2018-09-13 20:54:05 +08:00
|
|
|
int auxtrace_mmap__read(struct perf_mmap *map, struct auxtrace_record *itr,
|
2015-04-09 23:53:44 +08:00
|
|
|
struct perf_tool *tool, process_auxtrace_t fn);
|
|
|
|
|
2018-09-13 20:54:05 +08:00
|
|
|
int auxtrace_mmap__read_snapshot(struct perf_mmap *map,
|
2015-04-30 22:37:31 +08:00
|
|
|
struct auxtrace_record *itr,
|
|
|
|
struct perf_tool *tool, process_auxtrace_t fn,
|
|
|
|
size_t snapshot_size);
|
|
|
|
|
2015-04-21 17:21:51 +08:00
|
|
|
int auxtrace_queues__init(struct auxtrace_queues *queues);
|
|
|
|
int auxtrace_queues__add_event(struct auxtrace_queues *queues,
|
|
|
|
struct perf_session *session,
|
|
|
|
union perf_event *event, off_t data_offset,
|
|
|
|
struct auxtrace_buffer **buffer_ptr);
|
|
|
|
void auxtrace_queues__free(struct auxtrace_queues *queues);
|
2015-04-30 22:37:25 +08:00
|
|
|
int auxtrace_queues__process_index(struct auxtrace_queues *queues,
|
|
|
|
struct perf_session *session);
|
2015-04-21 17:21:51 +08:00
|
|
|
struct auxtrace_buffer *auxtrace_buffer__next(struct auxtrace_queue *queue,
|
|
|
|
struct auxtrace_buffer *buffer);
|
|
|
|
void *auxtrace_buffer__get_data(struct auxtrace_buffer *buffer, int fd);
|
|
|
|
void auxtrace_buffer__put_data(struct auxtrace_buffer *buffer);
|
|
|
|
void auxtrace_buffer__drop_data(struct auxtrace_buffer *buffer);
|
|
|
|
void auxtrace_buffer__free(struct auxtrace_buffer *buffer);
|
2015-04-09 23:53:52 +08:00
|
|
|
|
|
|
|
int auxtrace_heap__add(struct auxtrace_heap *heap, unsigned int queue_nr,
|
|
|
|
u64 ordinal);
|
|
|
|
void auxtrace_heap__pop(struct auxtrace_heap *heap);
|
|
|
|
void auxtrace_heap__free(struct auxtrace_heap *heap);
|
|
|
|
|
2015-04-09 23:53:54 +08:00
|
|
|
struct auxtrace_cache_entry {
|
|
|
|
struct hlist_node hash;
|
|
|
|
u32 key;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct auxtrace_cache *auxtrace_cache__new(unsigned int bits, size_t entry_size,
|
|
|
|
unsigned int limit_percent);
|
|
|
|
void auxtrace_cache__free(struct auxtrace_cache *auxtrace_cache);
|
|
|
|
void *auxtrace_cache__alloc_entry(struct auxtrace_cache *c);
|
|
|
|
void auxtrace_cache__free_entry(struct auxtrace_cache *c, void *entry);
|
|
|
|
int auxtrace_cache__add(struct auxtrace_cache *c, u32 key,
|
|
|
|
struct auxtrace_cache_entry *entry);
|
|
|
|
void *auxtrace_cache__lookup(struct auxtrace_cache *c, u32 key);
|
|
|
|
|
2015-04-09 23:53:44 +08:00
|
|
|
struct auxtrace_record *auxtrace_record__init(struct perf_evlist *evlist,
|
|
|
|
int *err);
|
|
|
|
|
2015-04-30 22:37:31 +08:00
|
|
|
int auxtrace_parse_snapshot_options(struct auxtrace_record *itr,
|
|
|
|
struct record_opts *opts,
|
|
|
|
const char *str);
|
2015-04-09 23:53:44 +08:00
|
|
|
int auxtrace_record__options(struct auxtrace_record *itr,
|
|
|
|
struct perf_evlist *evlist,
|
|
|
|
struct record_opts *opts);
|
2016-01-15 05:46:15 +08:00
|
|
|
size_t auxtrace_record__info_priv_size(struct auxtrace_record *itr,
|
|
|
|
struct perf_evlist *evlist);
|
2015-04-09 23:53:44 +08:00
|
|
|
int auxtrace_record__info_fill(struct auxtrace_record *itr,
|
|
|
|
struct perf_session *session,
|
|
|
|
struct auxtrace_info_event *auxtrace_info,
|
|
|
|
size_t priv_size);
|
|
|
|
void auxtrace_record__free(struct auxtrace_record *itr);
|
2015-04-30 22:37:31 +08:00
|
|
|
int auxtrace_record__snapshot_start(struct auxtrace_record *itr);
|
|
|
|
int auxtrace_record__snapshot_finish(struct auxtrace_record *itr);
|
|
|
|
int auxtrace_record__find_snapshot(struct auxtrace_record *itr, int idx,
|
|
|
|
struct auxtrace_mmap *mm,
|
|
|
|
unsigned char *data, u64 *head, u64 *old);
|
2015-04-09 23:53:44 +08:00
|
|
|
u64 auxtrace_record__reference(struct auxtrace_record *itr);
|
|
|
|
|
2015-04-30 22:37:25 +08:00
|
|
|
int auxtrace_index__auxtrace_event(struct list_head *head, union perf_event *event,
|
|
|
|
off_t file_offset);
|
|
|
|
int auxtrace_index__write(int fd, struct list_head *head);
|
|
|
|
int auxtrace_index__process(int fd, u64 size, struct perf_session *session,
|
|
|
|
bool needs_swap);
|
|
|
|
void auxtrace_index__free(struct list_head *head);
|
|
|
|
|
2015-04-09 23:53:50 +08:00
|
|
|
void auxtrace_synth_error(struct auxtrace_error_event *auxtrace_error, int type,
|
|
|
|
int code, int cpu, pid_t pid, pid_t tid, u64 ip,
|
2019-02-06 18:39:47 +08:00
|
|
|
const char *msg, u64 timestamp);
|
2015-04-09 23:53:50 +08:00
|
|
|
|
2015-04-09 23:53:44 +08:00
|
|
|
int perf_event__synthesize_auxtrace_info(struct auxtrace_record *itr,
|
|
|
|
struct perf_tool *tool,
|
|
|
|
struct perf_session *session,
|
|
|
|
perf_event__handler_t process);
|
2018-09-13 20:54:03 +08:00
|
|
|
int perf_event__process_auxtrace_info(struct perf_session *session,
|
|
|
|
union perf_event *event);
|
2018-09-13 20:54:04 +08:00
|
|
|
s64 perf_event__process_auxtrace(struct perf_session *session,
|
|
|
|
union perf_event *event);
|
2018-09-13 20:54:03 +08:00
|
|
|
int perf_event__process_auxtrace_error(struct perf_session *session,
|
|
|
|
union perf_event *event);
|
2015-04-09 23:53:49 +08:00
|
|
|
int itrace_parse_synth_opts(const struct option *opt, const char *str,
|
|
|
|
int unset);
|
2018-09-21 02:05:37 +08:00
|
|
|
void itrace_synth_opts__set_default(struct itrace_synth_opts *synth_opts,
|
|
|
|
bool no_sample);
|
2015-04-09 23:53:44 +08:00
|
|
|
|
2015-04-09 23:53:50 +08:00
|
|
|
size_t perf_event__fprintf_auxtrace_error(union perf_event *event, FILE *fp);
|
|
|
|
void perf_session__auxtrace_error_inc(struct perf_session *session,
|
|
|
|
union perf_event *event);
|
|
|
|
void events_stats__auxtrace_error_warn(const struct events_stats *stats);
|
|
|
|
|
2016-09-23 22:38:39 +08:00
|
|
|
void addr_filters__init(struct addr_filters *filts);
|
|
|
|
void addr_filters__exit(struct addr_filters *filts);
|
|
|
|
int addr_filters__parse_bare_filter(struct addr_filters *filts,
|
|
|
|
const char *filter);
|
|
|
|
int auxtrace_parse_filters(struct perf_evlist *evlist);
|
|
|
|
|
2015-04-09 23:53:48 +08:00
|
|
|
static inline int auxtrace__process_event(struct perf_session *session,
|
|
|
|
union perf_event *event,
|
|
|
|
struct perf_sample *sample,
|
|
|
|
struct perf_tool *tool)
|
|
|
|
{
|
|
|
|
if (!session->auxtrace)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return session->auxtrace->process_event(session, event, sample, tool);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int auxtrace__flush_events(struct perf_session *session,
|
|
|
|
struct perf_tool *tool)
|
|
|
|
{
|
|
|
|
if (!session->auxtrace)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return session->auxtrace->flush_events(session, tool);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void auxtrace__free_events(struct perf_session *session)
|
|
|
|
{
|
|
|
|
if (!session->auxtrace)
|
|
|
|
return;
|
|
|
|
|
|
|
|
return session->auxtrace->free_events(session);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void auxtrace__free(struct perf_session *session)
|
|
|
|
{
|
|
|
|
if (!session->auxtrace)
|
|
|
|
return;
|
|
|
|
|
|
|
|
return session->auxtrace->free(session);
|
|
|
|
}
|
|
|
|
|
2018-09-14 11:10:31 +08:00
|
|
|
#define ITRACE_HELP \
|
|
|
|
" i: synthesize instructions events\n" \
|
|
|
|
" b: synthesize branches events\n" \
|
|
|
|
" c: synthesize branches events (calls only)\n" \
|
|
|
|
" r: synthesize branches events (returns only)\n" \
|
|
|
|
" x: synthesize transactions events\n" \
|
|
|
|
" w: synthesize ptwrite events\n" \
|
|
|
|
" p: synthesize power events\n" \
|
|
|
|
" e: synthesize error events\n" \
|
|
|
|
" d: create a debug log\n" \
|
|
|
|
" g[len]: synthesize a call chain (use with i or x)\n" \
|
|
|
|
" l[len]: synthesize last branch entries (use with i or x)\n" \
|
|
|
|
" sNUMBER: skip initial number of events\n" \
|
|
|
|
" PERIOD[ns|us|ms|i|t]: specify period to sample stream\n" \
|
|
|
|
" concatenate multiple options. Default is ibxwpe or cewp\n"
|
|
|
|
|
|
|
|
|
2015-04-30 22:37:27 +08:00
|
|
|
#else
|
|
|
|
|
|
|
|
static inline struct auxtrace_record *
|
|
|
|
auxtrace_record__init(struct perf_evlist *evlist __maybe_unused,
|
2016-03-23 00:09:37 +08:00
|
|
|
int *err)
|
2015-04-30 22:37:27 +08:00
|
|
|
{
|
|
|
|
*err = 0;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline
|
|
|
|
void auxtrace_record__free(struct auxtrace_record *itr __maybe_unused)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
perf_event__synthesize_auxtrace_info(struct auxtrace_record *itr __maybe_unused,
|
|
|
|
struct perf_tool *tool __maybe_unused,
|
|
|
|
struct perf_session *session __maybe_unused,
|
|
|
|
perf_event__handler_t process __maybe_unused)
|
|
|
|
{
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline
|
|
|
|
int auxtrace_record__options(struct auxtrace_record *itr __maybe_unused,
|
|
|
|
struct perf_evlist *evlist __maybe_unused,
|
|
|
|
struct record_opts *opts __maybe_unused)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define perf_event__process_auxtrace_info 0
|
|
|
|
#define perf_event__process_auxtrace 0
|
|
|
|
#define perf_event__process_auxtrace_error 0
|
|
|
|
|
|
|
|
static inline
|
|
|
|
void perf_session__auxtrace_error_inc(struct perf_session *session
|
|
|
|
__maybe_unused,
|
|
|
|
union perf_event *event
|
|
|
|
__maybe_unused)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline
|
|
|
|
void events_stats__auxtrace_error_warn(const struct events_stats *stats
|
|
|
|
__maybe_unused)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline
|
|
|
|
int itrace_parse_synth_opts(const struct option *opt __maybe_unused,
|
|
|
|
const char *str __maybe_unused,
|
|
|
|
int unset __maybe_unused)
|
|
|
|
{
|
|
|
|
pr_err("AUX area tracing not supported\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2015-04-30 22:37:32 +08:00
|
|
|
static inline
|
|
|
|
int auxtrace_parse_snapshot_options(struct auxtrace_record *itr __maybe_unused,
|
|
|
|
struct record_opts *opts __maybe_unused,
|
|
|
|
const char *str)
|
|
|
|
{
|
|
|
|
if (!str)
|
|
|
|
return 0;
|
|
|
|
pr_err("AUX area tracing not supported\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2015-04-30 22:37:27 +08:00
|
|
|
static inline
|
|
|
|
int auxtrace__process_event(struct perf_session *session __maybe_unused,
|
|
|
|
union perf_event *event __maybe_unused,
|
|
|
|
struct perf_sample *sample __maybe_unused,
|
|
|
|
struct perf_tool *tool __maybe_unused)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline
|
|
|
|
int auxtrace__flush_events(struct perf_session *session __maybe_unused,
|
|
|
|
struct perf_tool *tool __maybe_unused)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline
|
|
|
|
void auxtrace__free_events(struct perf_session *session __maybe_unused)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline
|
|
|
|
void auxtrace_cache__free(struct auxtrace_cache *auxtrace_cache __maybe_unused)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline
|
|
|
|
void auxtrace__free(struct perf_session *session __maybe_unused)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline
|
|
|
|
int auxtrace_index__write(int fd __maybe_unused,
|
|
|
|
struct list_head *head __maybe_unused)
|
|
|
|
{
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline
|
|
|
|
int auxtrace_index__process(int fd __maybe_unused,
|
|
|
|
u64 size __maybe_unused,
|
|
|
|
struct perf_session *session __maybe_unused,
|
|
|
|
bool needs_swap __maybe_unused)
|
|
|
|
{
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline
|
|
|
|
void auxtrace_index__free(struct list_head *head __maybe_unused)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-09-23 22:38:39 +08:00
|
|
|
static inline
|
|
|
|
int auxtrace_parse_filters(struct perf_evlist *evlist __maybe_unused)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-04-30 22:37:27 +08:00
|
|
|
int auxtrace_mmap__mmap(struct auxtrace_mmap *mm,
|
|
|
|
struct auxtrace_mmap_params *mp,
|
|
|
|
void *userpg, int fd);
|
|
|
|
void auxtrace_mmap__munmap(struct auxtrace_mmap *mm);
|
|
|
|
void auxtrace_mmap_params__init(struct auxtrace_mmap_params *mp,
|
|
|
|
off_t auxtrace_offset,
|
|
|
|
unsigned int auxtrace_pages,
|
|
|
|
bool auxtrace_overwrite);
|
|
|
|
void auxtrace_mmap_params__set_idx(struct auxtrace_mmap_params *mp,
|
|
|
|
struct perf_evlist *evlist, int idx,
|
|
|
|
bool per_cpu);
|
|
|
|
|
2018-09-14 11:10:31 +08:00
|
|
|
#define ITRACE_HELP ""
|
|
|
|
|
2015-04-30 22:37:27 +08:00
|
|
|
#endif
|
|
|
|
|
2015-04-09 23:53:42 +08:00
|
|
|
#endif
|