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

From: Arnaldo Carvalho de Melo
Date: Tue Nov 10 2020 - 06:54:31 EST


Em Tue, Nov 10, 2020 at 09:07:16AM +0100, Peter Zijlstra escreveu:
> On Mon, Nov 09, 2020 at 10:53:54PM +0100, Jiri Olsa wrote:
> > Adding support to carry build id data in mmap2 event.
> >
> > The build id data replaces maj/min/ino/ino_generation
> > fields, whichc are also used to identify map's binary,
> > so it's ok to replace them with build id data:
> >
> > union {
> > struct {
> > u32 maj;
> > u32 min;
> > u64 ino;
> > u64 ino_generation;
> > };
> > struct {
> > u8 build_id[20];
> > u8 build_id_size;
>
> What's the purpose of a size field for a fixed size array? Also, I'd
> flip the order of these fields, first have the size and then the array.

There can be different types of build-ids, with different sizes,
flipping the order of the fields is indeed sensible, as we could then
support even larger build_ids if the need arises :)

- Arnaldo

> > u8 __reserved_1;
> > u16 __reserved_2;
> > };
> > };
> >
> > Replaced maj/min/ino/ino_generation fields give us size
> > of 24 bytes. We use 20 bytes for build id data, 1 byte
> > for size and rest is unused.

--

- Arnaldo