Re: [PATCH 03/24] perf: Add build id data in mmap2 event

From: Arnaldo Carvalho de Melo
Date: Tue Nov 10 2020 - 13:55:13 EST


Em Tue, Nov 10, 2020 at 07:23:34PM +0100, Jiri Olsa escreveu:
> On Tue, Nov 10, 2020 at 11:10:46AM +0100, Jiri Olsa wrote:
> > On Tue, Nov 10, 2020 at 09:28:51AM +0100, Peter Zijlstra wrote:
> > > On Mon, Nov 09, 2020 at 10:53:54PM +0100, Jiri Olsa wrote:
> > > > There's new misc bit for mmap2 to signal there's build
> > > > id data in it:
> > > >
> > > > #define PERF_RECORD_MISC_BUILD_ID (1 << 14)
> > >
> > > PERF_RECORD_MISC_MMAP_BUILD_ID would be consistent with the existing
> > > PERF_RECORD_MISC_MMAP_DATA naming.

Agreed.

> > ok

> > >
> > > Also, AFAICT there's still a bunch of unused bits in misc.
> > >
> > > 012 CDEF
> > > |||---------||||
> > >
> > > Where:
> > > 0-2 CPUMODE_MASK
> > >
> > > C PROC_MAP_PARSE_TIMEOUT
> > > D MMAP_DATA / COMM_EXEC / FORK_EXEC / SWITCH_OUT
> > > E EXACT_IP / SCHED_OUT_PREEMPT
> > > F (reserved)
> > >
> > > Maybe we should put in a comment to keep track of the hole ?
> >
> > ook
>
> how about the change below.. I also switch the build_id with the size,
> but I kept the build_id size 20, because I think there's bigger chance
> we will use those reserved bytes for something, than that we will need
> those extra 3 bytes in build_id array
>
> struct {
> u8 build_id_size;
> u8 __reserved_1;
> u16 __reserved_2;
> u8 build_id[20];
> };

For "maybe we'll use it for something else" doesn't require that it gets
before build_id, i.e. to use it for something else it can be as above or

struct {
u8 build_id_size;
u8 build_id[20];
u8 __reserved_1;
u16 __reserved_2;
};

that groups build_id size with it, but nah, this is getting funny by
now.

My suggestion was not about increasing build_id to 23, just to leave the
unused (reserved) bytes after it.

- Arnaldo