On Tue, Jan 22, 2019 at 06:38:56PM +0000, Song Liu wrote:

SNIP

> >> in perf_session__process_event, this happens right when processing
> >> buildids in 'perf record', and also in 'perf report', so that is
> >> something badly synthesized that hits perf.data for PERF_RECORD_KSYMBOL.
> > 
> > it's reproducible with simple:
> >  perf record -e cycles,instructions ls
> > 
> > as you said on irc, it's the machine->id_hdr_size size missing
> > there's one more glitch, attached patch fixes that for me
> > you can't use sizeof(struct ksymbol_event), because it includes
> > the name as well.. which screws the size
> > 
> > but I don't know that code that much.. might be still something
> > missing
> > 
> > jirka
> 
> Hi Arnaldo and Jiri,
> 
> Thanks for catching and fixing the bug. 
> 
> I guess the following is OK?
> 
>         *bpf_event = (struct bpf_event){
>                 .header = {
>                         .type = PERF_RECORD_BPF_EVENT,
>                         .size = sizeof(struct bpf_event),
>                 },
>                 .type = PERF_BPF_EVENT_PROG_LOAD,
>                 .flags = 0,
>                 .id = info.id,
>         };
> 
> as struct bpf_event doesn't have variable length name:
> 
>         struct bpf_event {
>                 struct perf_event_header header;
>                 u16 type;
>                 u16 flags;
>                 u32 id;
> 
>                 /* for bpf_prog types */
>                 u8 tag[BPF_TAG_SIZE];  // prog tag
>         };
> 
> Or we need similar fix? 

yep, looks good.. also don't forget to add the 'machine->id_hdr_size'

jirka

Reply via email to