lkml.org 
[lkml]   [2019]   [Feb]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v4 perf,bpf 07/15] perf, bpf: save bpf_prog_info information as headers to perf.data
Date


> On Feb 27, 2019, at 5:21 AM, Jiri Olsa <jolsa@redhat.com> wrote:
>
> On Mon, Feb 25, 2019 at 04:20:11PM -0800, Song Liu wrote:
>
> SNIP
>
>> + if (info_len > sizeof(struct bpf_prog_info)) {
>> + pr_warning("detected invalid bpf_prog_info\n");
>> + goto out;
>> + }
>> +
>> + info_linear = malloc(sizeof(struct bpf_prog_info_linear) +
>> + data_len);
>> + if (!info_linear)
>> + goto out;
>> + info_linear->info_len = sizeof(struct bpf_prog_info);
>> + info_linear->data_len = data_len;
>> + if (do_read_u64(ff, (u64 *)(&info_linear->arrays)))
>> + goto out;
>> + if (__do_read(ff, &info_linear->info, info_len))
>> + goto out;
>> + if (info_len < sizeof(struct bpf_prog_info))
>> + memset(((void *)(&info_linear->info)) + info_len, 0,
>> + sizeof(struct bpf_prog_info) - info_len);
>> +
>> + if (__do_read(ff, info_linear->data, data_len))
>> + goto out;
>> +
>> + /* endian mismatch, drop the info, continue */
>
> so there's no way we can swap the data? why?
>
> jirka

Yes, we can swap the data. OTOH, the set is big enough. How about we
implement the swap later? Running perf-report on a system of with
different endianness is a relatively rare case.

Thanks,
Song



>> + if (ff->ph->needs_swap) {
>> + free(info_linear);
>> + continue;
>> + }
>
> SNIP

\
 
 \ /
  Last update: 2019-02-27 18:29    [W:0.143 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site