[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200916140744.GR720847@kernel.org>
Date: Wed, 16 Sep 2020 11:07:44 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Jiri Olsa <jolsa@...hat.com>
Cc: Ian Rogers <irogers@...gle.com>, Jiri Olsa <jolsa@...nel.org>,
lkml <linux-kernel@...r.kernel.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Ingo Molnar <mingo@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Namhyung Kim <namhyung@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Michael Petlan <mpetlan@...hat.com>,
Song Liu <songliubraving@...com>,
"Frank Ch. Eigler" <fche@...hat.com>,
Stephane Eranian <eranian@...gle.com>,
Alexey Budankov <alexey.budankov@...ux.intel.com>,
Andi Kleen <ak@...ux.intel.com>,
Adrian Hunter <adrian.hunter@...el.com>
Subject: Re: [PATCH 16/26] perf tools: Synthesize modules with mmap3
Em Wed, Sep 16, 2020 at 10:20:18AM +0200, Jiri Olsa escreveu:
> On Tue, Sep 15, 2020 at 01:17:44PM -0700, Ian Rogers wrote:
>
> SNIP
>
> > > > /*
> > > > * kernel uses 0 for user space maps, see kernel/perf_event.c
> > > > * __perf_event_mmap
> > > > @@ -631,17 +629,30 @@ int perf_event__synthesize_modules(struct perf_tool *tool, perf_event__handler_t
> > > > continue;
> > > >
> > > > size = PERF_ALIGN(pos->dso->long_name_len + 1, sizeof(u64));
> > > > - event->mmap.header.type = PERF_RECORD_MMAP;
> > > > - event->mmap.header.size = (sizeof(event->mmap) -
> > > > - (sizeof(event->mmap.filename) - size));
> > > > - memset(event->mmap.filename + size, 0, machine->id_hdr_size);
> > > > - event->mmap.header.size += machine->id_hdr_size;
> > > > - event->mmap.start = pos->start;
> > > > - event->mmap.len = pos->end - pos->start;
> > > > - event->mmap.pid = machine->pid;
> > > > -
> > > > - memcpy(event->mmap.filename, pos->dso->long_name,
> > > > + event->mmap3.header.type = PERF_RECORD_MMAP3;
> > > > + event->mmap3.header.size = (sizeof(event->mmap3) -
> > > > + (sizeof(event->mmap3.filename) - size));
> > > > + memset(event->mmap3.filename + size, 0, machine->id_hdr_size);
> > > > + event->mmap3.header.size += machine->id_hdr_size;
> > > > + event->mmap3.start = pos->start;
> > > > + event->mmap3.len = pos->end - pos->start;
> > > > + event->mmap3.pid = machine->pid;
> > > > +
> > > > + memcpy(event->mmap3.filename, pos->dso->long_name,
> > > > pos->dso->long_name_len + 1);
> > > > +
> > > > + rc = filename__read_build_id(event->mmap3.filename, event->mmap3.buildid,
> > > > + BUILD_ID_SIZE);
> > > > + if (rc != BUILD_ID_SIZE) {
> >
> > IIRC BUILD_ID_SIZE is 20 bytes which is the correct size for SHA-1. A
> > build ID may be 128-bits (16 bytes) if md5 or uuid hashes are used.
> > Should this test just be "> 0" ?
>
> ah right, will check on that
And how do you deal with this in the kernel? I.e. to inform userspace,
via the PERF_RECORD_MMAP3 (or MMAP2 with that misc bit trick) the size
of the build-id?
- Arnaldo
Powered by blists - more mailing lists