Messages in this thread |  | | Date | Fri, 27 Nov 2020 20:46:51 +0100 | From | Jiri Olsa <> | Subject | Re: [PATCH 06/25] perf tools: Do not swap mmap2 fields in case it contains build id |
| |
On Thu, Nov 26, 2020 at 02:30:42PM -0300, Arnaldo Carvalho de Melo wrote: > Em Thu, Nov 26, 2020 at 06:00:07PM +0100, Jiri Olsa escreveu: > > If PERF_RECORD_MISC_MMAP_BUILD_ID misc bit is set, > > mmap2 event carries build id, placed in following union: > > > > union { > > struct { > > u32 maj; > > u32 min; > > u64 ino; > > u64 ino_generation; > > }; > > struct { > > u8 build_id[20]; > > u8 build_id_size; > > u8 __reserved_1; > > u16 __reserved_2; > > }; > > }; > > Did you forgot to update just this cset comment?
ah yes, will fix
thanks, jirka
> > - Arnaldo > > > In this case we can't swap above fields. > > > > Signed-off-by: Jiri Olsa <jolsa@kernel.org> > > --- > > tools/perf/util/session.c | 11 +++++++---- > > 1 file changed, 7 insertions(+), 4 deletions(-) > > > > diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c > > index 5cc722b6fe7c..cc1c11ca94fd 100644 > > --- a/tools/perf/util/session.c > > +++ b/tools/perf/util/session.c > > @@ -592,10 +592,13 @@ static void perf_event__mmap2_swap(union perf_event *event, > > event->mmap2.start = bswap_64(event->mmap2.start); > > event->mmap2.len = bswap_64(event->mmap2.len); > > event->mmap2.pgoff = bswap_64(event->mmap2.pgoff); > > - event->mmap2.maj = bswap_32(event->mmap2.maj); > > - event->mmap2.min = bswap_32(event->mmap2.min); > > - event->mmap2.ino = bswap_64(event->mmap2.ino); > > - event->mmap2.ino_generation = bswap_64(event->mmap2.ino_generation); > > + > > + if (!(event->header.misc & PERF_RECORD_MISC_MMAP_BUILD_ID)) { > > + event->mmap2.maj = bswap_32(event->mmap2.maj); > > + event->mmap2.min = bswap_32(event->mmap2.min); > > + event->mmap2.ino = bswap_64(event->mmap2.ino); > > + event->mmap2.ino_generation = bswap_64(event->mmap2.ino_generation); > > + } > > > > if (sample_id_all) { > > void *data = &event->mmap2.filename; > > -- > > 2.26.2 > > > > -- > > - Arnaldo >
|  |