[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190304135217.GC19809@krava>
Date: Mon, 4 Mar 2019 14:52:17 +0100
From: Jiri Olsa <jolsa@...hat.com>
To: Song Liu <songliubraving@...com>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
ast@...nel.org, daniel@...earbox.net, kernel-team@...com,
peterz@...radead.org, acme@...hat.com, jolsa@...nel.org,
namhyung@...nel.org
Subject: Re: [PATCH v5 perf,bpf 09/15] perf, bpf: save btf information as
headers to perf.data
On Wed, Feb 27, 2019 at 09:06:37PM -0800, Song Liu wrote:
SNIP
>
> +static int process_bpf_btf(struct feat_fd *ff, void *data __maybe_unused)
> +{
> + struct perf_env *env = &ff->ph->env;
> + u32 count, i;
> +
> + if (do_read_u32(ff, &count))
> + return -1;
> +
> + down_write(&env->bpf_progs.lock);
> +
> + for (i = 0; i < count; ++i) {
> + struct btf_node *node;
> + u32 id, data_size;
> +
> + if (do_read_u32(ff, &id))
> + return -1;
> + if (do_read_u32(ff, &data_size))
> + return -1;
> +
> + node = malloc(sizeof(struct btf_node) + data_size);
> + if (!node)
> + return -1;
> +
> + node->id = id;
> + node->data_size = data_size;
> +
> + if (__do_read(ff, node->data, data_size)) {
> + free(node);
> + return -1;
> + }
> +
> + /* endian mismatch, drop the btf, continue */
> + if (ff->ph->needs_swap) {
> + free(node);
> + continue;
> + }
again, we can check for needs_swap in the begining,
display warning and skip the loop in here
perhaps we should warn just once for all the bpf data
missed when needs_swap is set
jirka
Powered by blists - more mailing lists