perf: Add ability to sample machine state on interrupt

Enable capture of interrupted machine state for each sample.

Registers to sample are passed per event in the sample_regs_intr bitmask.

To sample interrupt machine state, the PERF_SAMPLE_INTR_REGS must be passed in
sample_type.

The list of available registers is arch dependent and provided by asm/perf_regs.h

Registers are laid out as u64 in the order of the bit order of sample_intr_regs.

This patch also adds a new ABI version PERF_ATTR_SIZE_VER4 because we extend
the perf_event_attr struct with a new u64 field.

Reviewed-by: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Stephane Eranian <eranian@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: cebbert.lkml@gmail.com
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-api@vger.kernel.org
Link: http://lkml.kernel.org/r/1411559322-16548-2-git-send-email-eranian@google.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
Stephane Eranian 2014-09-24 13:48:37 +02:00 committed by Ingo Molnar
parent af4bdcf675
commit 60e2364e60
3 changed files with 63 additions and 5 deletions

View file

@ -79,7 +79,7 @@ struct perf_branch_stack {
struct perf_branch_entry entries[0];
};
struct perf_regs_user {
struct perf_regs {
__u64 abi;
struct pt_regs *regs;
};
@ -600,7 +600,8 @@ struct perf_sample_data {
struct perf_callchain_entry *callchain;
struct perf_raw_record *raw;
struct perf_branch_stack *br_stack;
struct perf_regs_user regs_user;
struct perf_regs regs_user;
struct perf_regs regs_intr;
u64 stack_user_size;
u64 weight;
/*
@ -630,6 +631,8 @@ static inline void perf_sample_data_init(struct perf_sample_data *data,
data->weight = 0;
data->data_src.val = PERF_MEM_NA;
data->txn = 0;
data->regs_intr.abi = PERF_SAMPLE_REGS_ABI_NONE;
data->regs_intr.regs = NULL;
}
extern void perf_output_sample(struct perf_output_handle *handle,