[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <555A350B.1030107@plumgrid.com>
Date: Mon, 18 May 2015 11:52:59 -0700
From: Alexei Starovoitov <ast@...mgrid.com>
To: Wang Nan <wangnan0@...wei.com>, paulus@...ba.org,
a.p.zijlstra@...llo.nl, mingo@...hat.com, acme@...nel.org,
namhyung@...nel.org, jolsa@...nel.org, dsahern@...il.com,
daniel@...earbox.net, brendan.d.gregg@...il.com,
masami.hiramatsu.pt@...achi.com
CC: lizefan@...wei.com, linux-kernel@...r.kernel.org, pi3orama@....com
Subject: Re: [RFC PATCH v3 23/37] bpf tools: Introduce bpf_load_program()
to bpf.c
On 5/17/15 3:56 AM, Wang Nan wrote:
> bpf_load_program() can be used to load bpf program into kernel. To make
> loading faster, first try to load without logbuf. Try again with logbuf
> if the first try failed.
>
> Signed-off-by: Wang Nan <wangnan0@...wei.com>
...
> + attr.insn_cnt = (__u32)insns_cnt;
> + attr.insns = ptr_to_u64((void *) insns);
> + attr.license = ptr_to_u64((void *) license);
unnecessary casts?
> + attr.log_buf = ptr_to_u64(NULL);
> + attr.log_size = 0;
> + attr.log_level = 0;
> + attr.kern_version = kern_version;
> +
> + fd = sys_bpf(BPF_PROG_LOAD, &attr, sizeof(attr));
> + if ((fd >= 0) || !log_buf || !log_buf_sz)
unnecessary ()
> + return fd;
> +
> + /* Try again with log */
> + attr.log_buf = ptr_to_u64(log_buf);
> + attr.log_size = log_buf_sz;
> + attr.log_level = 1;
> + log_buf[0] = 0;
> + return sys_bpf(BPF_PROG_LOAD, &attr, sizeof(attr));
this part looks good. thank you for addressing the feedback from v1.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists