[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5567E416.2080206@huawei.com>
Date: Fri, 29 May 2015 11:59:18 +0800
From: "Wangnan (F)" <wangnan0@...wei.com>
To: Alexei Starovoitov <alexei.starovoitov@...il.com>
CC: <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>,
<lizefan@...wei.com>, <linux-kernel@...r.kernel.org>,
<pi3orama@....com>, xiakaixu 00238161 <xiakaixu@...wei.com>
Subject: Re: [RFC PATCH v4 10/29] bpf tools: Collect map definitions from
'maps' section
On 2015/5/29 11:35, Alexei Starovoitov wrote:
> On Thu, May 28, 2015 at 03:14:44PM +0800, Wangnan (F) wrote:
>>
>> On 2015/5/28 14:09, Alexei Starovoitov wrote:
>>> On Thu, May 28, 2015 at 11:09:50AM +0800, Wangnan (F) wrote:
>>>> However this breaks a law in current design that opening phase doesn't
>>>> talk to kernel with sys_bpf() at all. All related staff is done in loading
>>>> phase. This principle ensures that in every systems, no matter it support
>>>> sys_bpf() or not, can read eBPF object without failure.
>>> I see, so you want 'parse elf' and 'create maps + load programs'
>>> to be separate phases?
>>> Fair enough. Then please add a call to release the information
>>> collected from elf after program loading is done.
>>> relocations and other things are not needed at that point.
>> What about appending a flag into bpf_object__load() to let it know
>> whether to cleanup resource it taken or not? for example:
>>
>> int bpf_object__load(struct bpf_object *obj, bool clean);
>>
>> then we can further wrap it by a macro:
>>
>> #define bpf_object__load_clean(o) bpf_object__load(o, true)
>>
>> If 'clear' is true, after loading resources will be freed, and the same
>> object will be unable to reload again after unload. B doing this we can
>> avoid adding a new function.
> imo that would be an ugly API. You only want to do that to have
> one less library API function? I think it's cleaner to let user of
> the library call it when necessary.
> Or do cleaning unconditionally. I don't see a use case when the
> same set of maps and programs would need to be loaded twice into the kernel.
OK. Let bpf_object__load() clean resources unconditionally.
Thank you.
--
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