Re: [PATCH 1/4] perf: add ability to sample machine state on interrupt

From: Arnaldo Carvalho de Melo
Date: Wed Jul 09 2014 - 11:03:42 EST


Em Wed, Jul 09, 2014 at 12:15:56AM +0200, Stephane Eranian escreveu:
> Enable capture of interrupted machine state in 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.

I would have broken this into smaller pieces, with the first patch doing
the prep of renaming perf_regs_user to perf_regs, for instance.

> Signed-off-by: Stephane Eranian <eranian@xxxxxxxxxx>
> ---
> include/linux/perf_event.h | 7 +++++--
> include/uapi/linux/perf_event.h | 14 ++++++++++++-
> kernel/events/core.c | 44 +++++++++++++++++++++++++++++++++++++++--
> 3 files changed, 60 insertions(+), 5 deletions(-)
>
> diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
> index 707617a..4970c1d 100644
> --- a/include/linux/perf_event.h
> +++ b/include/linux/perf_event.h
> @@ -78,7 +78,7 @@ struct perf_branch_stack {
> struct perf_branch_entry entries[0];
> };
>
> -struct perf_regs_user {
> +struct perf_regs {
> __u64 abi;
> struct pt_regs *regs;
> };
> @@ -595,7 +595,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;
> /*
> @@ -618,6 +619,8 @@ static inline void perf_sample_data_init(struct perf_sample_data *data,
> data->weight = 0;
> data->data_src.val = 0;
> data->txn = 0;
> + data->regs_intr.abi = PERF_SAMPLE_REGS_ABI_NONE;
> + data->regs_intr.regs = NULL;

Nit:

This would be better right after the equivalent ones for regs_user, I
had to go to perf_sample_data_init() to check if that was done, yes, it
is right before data->weight = 0 :-)

Reading on...
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/