From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: Edward Cree <ecree@solarflare.com>
Cc: Martin Lau <kafai@fb.com>, Yonghong Song <yhs@fb.com>,
Alexei Starovoitov <ast@fb.com>,
"daniel@iogearbox.net" <daniel@iogearbox.net>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
Kernel Team <Kernel-team@fb.com>
Subject: Re: [PATCH bpf-next v2 02/13] bpf: btf: Add BTF_KIND_FUNC and BTF_KIND_FUNC_PROTO
Date: Tue, 6 Nov 2018 16:59:57 -0800 [thread overview]
Message-ID: <20181107005955.qwgbytqtziaggdve@ast-mbp> (raw)
In-Reply-To: <a84d7f90-f93f-d2f3-f403-d506d37b5152@solarflare.com>
On Tue, Nov 06, 2018 at 10:58:42PM +0000, Edward Cree wrote:
> share its type record with 'foo'. And partly just because the
> name of the function itself is no more part of its type than the
> name of an integer variable is part of the integer's type.
correct. function name is not part of its type.
function name is part of BTF that provide debug info about the function.
Function name and function argument names are part of the same debug info.
Splitting them makes no sense.
> (Whereas names of parameters are like names of struct members:
> while they are not part of the 'pure type' from a language
> perspective, they are part of the type from the perspective of
> debugging, which is why they belong in the BTF type record.)
struct name and struct field names live in the same BTF record.
Similarly function name and function argument names should be
in the same BTF record, so we can reuse most of the BTF validation
and BTF parsing logic by doing so.
The minor difference between KIND_STRUCT and KIND_FUNC is
an addition of return type_id.
Everything else is common.
imo that speaks for itself that it's a correct path forward.
> > There are C, bpftrace, p4 and python frontends. These languages
> > should be free to put into BTF KIND_FUNC name that makes sense
> > from the language point of view.
> I'm paying attention to BTF because I'm adding support for it into
> my ebpf_asm. Don't you think I *know* that frontends for BPF are
> more than just C?
assembler is not a high level language.
I believe it's a proper trade-off to make C easier to use
in expense of some ugliness in your ebpf_asm.
> > The global variables for given .c file will look like single KIND_STRUCT
> That's exactly the kind of superficially-clever but nasty hack
> that results from the continued insistence on conflating types
> and instances (objects). In the long run it will make
> maintenance harder, and frustrate new features owing to the need
> to find new hacks to shoehorn them into the same model.
Let's keep 'nasty hack' claims out of this discussion.
I find the current BTF design and KIND_FUNC addition to be elegant
and appropriate.
> Instead there should be entries for the globals in something like
> the variables table I mentioned,
> 2 "fred" type=1 where=global func=0 offset=8
> in which 'func' is unused and 'offset' gives offset in .bss.
> 'where' might also include indication of whether it's static.
'static' like boolean flag? That won't help introspection.
To properly describe 'static' functions more information is necessary.
I don't like to invent new formats. BTF is extensible description
of any debug info. I prefer to keep all debug info in one place
and in one common format.
> I'm saying that the *function* is entirely different to its
> *type*. It's a category error to conflate them:
> f: x -> x + 1
> is a function.
BTF does not describe function. BTF describes debug info about function.
BPF program is the function.
BTF is not *type* only format. It's debug info format.
Trying to make BTF into type only is not going to work.
It's already more than type only as I showed earlier.
next prev parent reply other threads:[~2018-11-07 10:28 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-17 7:23 [PATCH bpf-next v2 00/13] bpf: add btf func info support Yonghong Song
2018-10-17 7:23 ` [PATCH bpf-next v2 01/13] bpf: btf: Break up btf_type_is_void() Yonghong Song
2018-10-17 7:23 ` [PATCH bpf-next v2 02/13] bpf: btf: Add BTF_KIND_FUNC and BTF_KIND_FUNC_PROTO Yonghong Song
2018-10-17 16:13 ` Edward Cree
2018-10-17 17:25 ` Yonghong Song
2018-10-17 17:50 ` Martin Lau
2018-10-18 16:47 ` Edward Cree
2018-10-18 18:12 ` Martin Lau
2018-10-18 19:41 ` Edward Cree
2018-10-18 21:19 ` Martin Lau
2018-10-19 17:04 ` Edward Cree
2018-10-19 19:36 ` Martin Lau
2018-10-19 20:35 ` Martin Lau
2018-10-19 21:26 ` Edward Cree
2018-10-19 23:27 ` Martin Lau
2018-11-01 21:08 ` Edward Cree
2018-11-06 6:29 ` Alexei Starovoitov
2018-11-06 18:52 ` Edward Cree
2018-11-06 21:56 ` Alexei Starovoitov
2018-11-06 22:58 ` Edward Cree
2018-11-07 0:59 ` Alexei Starovoitov [this message]
2018-11-07 19:29 ` Edward Cree
2018-11-07 21:49 ` Alexei Starovoitov
2018-11-08 17:58 ` Edward Cree
2018-11-08 18:21 ` Alexei Starovoitov
2018-11-08 19:42 ` Alexei Starovoitov
2018-11-08 22:56 ` Edward Cree
2018-11-09 1:26 ` Yonghong Song
2018-11-09 4:35 ` Alexei Starovoitov
2018-11-09 20:00 ` Edward Cree
2018-11-09 21:14 ` Alexei Starovoitov
2018-11-09 21:28 ` Edward Cree
2018-11-09 21:48 ` Alexei Starovoitov
2018-10-17 7:23 ` [PATCH bpf-next v2 03/13] tools/bpf: sync kernel btf.h header Yonghong Song
2018-10-17 7:23 ` [PATCH bpf-next v2 04/13] tools/bpf: add btf func/func_proto unit tests in selftest test_btf Yonghong Song
2018-10-17 11:02 ` [PATCH bpf-next v2 00/13] bpf: add btf func info support Edward Cree
2018-10-17 16:13 ` Yonghong Song
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181107005955.qwgbytqtziaggdve@ast-mbp \
--to=alexei.starovoitov@gmail.com \
--cc=Kernel-team@fb.com \
--cc=ast@fb.com \
--cc=daniel@iogearbox.net \
--cc=ecree@solarflare.com \
--cc=kafai@fb.com \
--cc=netdev@vger.kernel.org \
--cc=yhs@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).