From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752610AbbETFYx (ORCPT ); Wed, 20 May 2015 01:24:53 -0400 Received: from mail-ig0-f182.google.com ([209.85.213.182]:38382 "EHLO mail-ig0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752517AbbETFYn (ORCPT ); Wed, 20 May 2015 01:24:43 -0400 Message-ID: <555C1A97.3060805@plumgrid.com> Date: Tue, 19 May 2015 22:24:39 -0700 From: Alexei Starovoitov User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: "Wangnan (F)" , paulus@samba.org, a.p.zijlstra@chello.nl, mingo@redhat.com, acme@kernel.org, namhyung@kernel.org, jolsa@kernel.org, dsahern@gmail.com, daniel@iogearbox.net, brendan.d.gregg@gmail.com, masami.hiramatsu.pt@hitachi.com CC: lizefan@huawei.com, linux-kernel@vger.kernel.org, pi3orama@163.com Subject: Re: [RFC PATCH v3 06/37] bpf tools: Introduce 'bpf' library to tools References: <1431860222-61636-1-git-send-email-wangnan0@huawei.com> <1431860222-61636-7-git-send-email-wangnan0@huawei.com> <555A22DB.5040200@plumgrid.com> <555C03F7.4040206@huawei.com> In-Reply-To: <555C03F7.4040206@huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/19/15 8:48 PM, Wangnan (F) wrote: > >>> + >>> +# Version of eBPF elf file >>> +FILE_VERSION = 1 >> >> what that comment suppose to mean? > > The format of eBPF objects can be improved in futher. A version number > here is the precaution of backward compatibility. However this patch > doesn't > utilize it. > > I'd like to append a 'format' section into eBPF object format to let > libbpf know > the version of the object. What do you think? I don't think it will help. Version number is quite inconvenient. perf_event_attr and bpf_attr are using 'size' instead, since the only way keep to backward compatibility is to force new additions to preserve old fields. The notion that 'new version number can start fresh' doesn't really work, because it means duplicated code. In this case, in libbpf. I don't think we want 'if (elf_version == X) parse sections this way' type of code. iproute2 already reserved 'classifier' and 'action' names and I think 'kprobe' and 'socket' are good enough prefixes for BPF_PROG_TYPE_KPROBE and BPF_PROG_TYPE_SOCKET_FILTER programs as well. So the prefix to indicate the program type is already settled. What comes after the prefix is tbd. I proposed 'kprobe/perform_write(void*, void*, long long)' style for vmlinux without debug info and 'kprobe/perform_write+122(file->f_mapping->a_ops, bytes, offset)' with debug. It looks flexible enough and can be extended with new features later. I don't think 'config', 'format' sections are needed.