Messages in this thread | | | Date | Thu, 26 Nov 2020 14:30:42 -0300 | From | Arnaldo Carvalho de Melo <> | Subject | Re: [PATCH 06/25] perf tools: Do not swap mmap2 fields in case it contains build id |
| |
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?
- 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
| |