On Fri, Nov 13, 2020 at 01:29:35PM +0900, Namhyung Kim wrote:

SNIP

> >  
> >     struct {
> >             struct perf_event_header        header;
> > @@ -7997,13 +8003,23 @@ static void perf_event_mmap_output(struct 
> > perf_event *event,
> >     mmap_event->event_id.pid = perf_event_pid(event, current);
> >     mmap_event->event_id.tid = perf_event_tid(event, current);
> >  
> > +   if (event->attr.mmap2 && event->attr.build_id)
> > +           mmap_event->event_id.header.misc |= PERF_RECORD_MISC_BUILD_ID;
> > +
> >     perf_output_put(&handle, mmap_event->event_id);
> >  
> >     if (event->attr.mmap2) {
> > -           perf_output_put(&handle, mmap_event->maj);
> > -           perf_output_put(&handle, mmap_event->min);
> > -           perf_output_put(&handle, mmap_event->ino);
> > -           perf_output_put(&handle, mmap_event->ino_generation);
> > +           if (event->attr.build_id) {
> > +                   u8 size[4] = { (u8) mmap_event->build_id_size, 0, 0, 0 
> > };
> > +
> > +                   __output_copy(&handle, mmap_event->build_id, 
> > BUILD_ID_SIZE);
> > +                   __output_copy(&handle, size, 4);
> > +           } else {
> > +                   perf_output_put(&handle, mmap_event->maj);
> > +                   perf_output_put(&handle, mmap_event->min);
> > +                   perf_output_put(&handle, mmap_event->ino);
> > +                   perf_output_put(&handle, mmap_event->ino_generation);
> > +           }
> >             perf_output_put(&handle, mmap_event->prot);
> >             perf_output_put(&handle, mmap_event->flags);
> >     }
> > @@ -8132,6 +8148,11 @@ static void perf_event_mmap_event(struct 
> > perf_mmap_event *mmap_event)
> >  
> >     mmap_event->event_id.header.size = sizeof(mmap_event->event_id) + size;
> >  
> > +   if (atomic_read(&nr_build_id_events)) {
> > +           build_id_parse_size(vma, mmap_event->build_id,
> > +                               &mmap_event->build_id_size);
> 
> This can fail, right?  Then we need to fallback to use dev/ino..

right, I did not implemented fallback in here, but I think
you are right.. we should try to do the best in fail, I'll add it

thanks,
jirka

Reply via email to