Re: [RFC] perf record: missing buildid for callstack modules

From: Ingo Molnar
Date: Thu Jan 14 2016 - 06:27:55 EST



* Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:

> The current problem with that is that we use the 'remaining' size as
> the length field for a string (with the PERF_RECORD_MMAP* records).
>
> We could of course fix that no problem.
>
>
> ---
> include/uapi/linux/perf_event.h | 27 ++++++++++++++++++++++++++-
> kernel/events/core.c | 35 ++++++++++++++++++++++++-----------
> 2 files changed, 50 insertions(+), 12 deletions(-)
>
> diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h
> index 1afe9623c1a7..b7b673387581 100644
> --- a/include/uapi/linux/perf_event.h
> +++ b/include/uapi/linux/perf_event.h
> @@ -340,7 +340,8 @@ struct perf_event_attr {
> comm_exec : 1, /* flag comm events that are due to an exec */
> use_clockid : 1, /* use @clockid for time fields */
> context_switch : 1, /* context switch data */
> - __reserved_1 : 37;
> + mmap3 : 1, /* include mmap with mtime */
> + __reserved_1 : 36;
>
> union {
> __u32 wakeup_events; /* wakeup every n events */
> @@ -856,6 +857,30 @@ enum perf_event_type {
> */
> PERF_RECORD_SWITCH_CPU_WIDE = 15,
>
> + /*
> + * The MMAP3 records are an augmented version of MMAP2, they add
> + * mtime and filename_len, allowing for size based extensions.
> + *
> + * struct {
> + * struct perf_event_header header;
> + *
> + * u32 pid, tid;
> + * u64 addr;
> + * u64 len;
> + * u64 pgoff;
> + * u32 maj;
> + * u32 min;
> + * u64 ino;
> + * u64 ino_generation;
> + * u32 prot, flags;
> + * u64 mtime;
> + * u32 filename_len;
> + * char filename[2+];
> + * struct sample_id sample_id;
> + * }
> + */
> + PERF_RECORD_MMAP3 = 16,
> +
> PERF_RECORD_MAX, /* non-ABI */
> };

Yeah, very nice!

And this means v3 should be the last ever version - all future extensions can
happen via the length field.

Acked-by: Ingo Molnar <mingo@xxxxxxxxxx>

Thanks,

Ingo