From: Yonghong Song <yhs@fb.com>
To: <ast@fb.com>, <daniel@iogearbox.net>, <netdev@vger.kernel.org>
Cc: <kernel-team@fb.com>
Subject: [PATCH bpf-next 0/2] bpf: support proper non-jit func info
Date: Sat, 24 Nov 2018 23:20:43 -0800 [thread overview]
Message-ID: <20181125072045.1389189-1-yhs@fb.com> (raw)
Commit 838e96904ff3 ("bpf: Introduce bpf_func_info")
added bpf func info support. The userspace is able
to get better ksym's for bpf programs with jit, and
is able to print out func prototypes.
For a program containing func-to-func calls, the existing
implementation returns user specified number of function
calls and BTF types if jit is enabled. If the jit is not
enabled, it only returns the type for the main function.
This is undesirable. Interpreter may still be used
and we should keep feature identical regardless of
whether jit is enabled or not.
This patch fixed this discrepancy.
The following example shows bpftool output for
the bpf program in selftests test_btf_haskv.o when jit
is disabled:
$ bpftool prog dump xlated id 1490
int _dummy_tracepoint(struct dummy_tracepoint_args * arg):
0: (85) call pc+2#__bpf_prog_run_args32
1: (b7) r0 = 0
2: (95) exit
int test_long_fname_1(struct dummy_tracepoint_args * arg):
3: (85) call pc+1#__bpf_prog_run_args32
4: (95) exit
int test_long_fname_2(struct dummy_tracepoint_args * arg):
5: (b7) r2 = 0
6: (63) *(u32 *)(r10 -4) = r2
7: (79) r1 = *(u64 *)(r1 +8)
8: (15) if r1 == 0x0 goto pc+9
9: (bf) r2 = r10
10: (07) r2 += -4
11: (18) r1 = map[id:1173]
13: (85) call bpf_map_lookup_elem#77088
14: (15) if r0 == 0x0 goto pc+3
15: (61) r1 = *(u32 *)(r0 +4)
16: (07) r1 += 1
17: (63) *(u32 *)(r0 +4) = r1
18: (95) exit
$ bpftool prog dump jited id 1490
no instructions returned
Yonghong Song (2):
bpf: btf: support proper non-jit func info
tools/bpf: change selftest test_btf for both jit and non-jit
include/linux/bpf.h | 6 ++-
include/linux/bpf_verifier.h | 1 -
kernel/bpf/core.c | 3 +-
kernel/bpf/syscall.c | 33 ++++------------
kernel/bpf/verifier.c | 55 ++++++++++++++++++--------
tools/testing/selftests/bpf/test_btf.c | 33 ++--------------
6 files changed, 55 insertions(+), 76 deletions(-)
--
2.17.1
next reply other threads:[~2018-11-25 18:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-25 7:20 Yonghong Song [this message]
2018-11-25 7:20 ` [PATCH bpf-next 1/2] bpf: btf: support proper non-jit func info Yonghong Song
2018-11-26 17:21 ` Martin Lau
2018-11-25 7:20 ` [PATCH bpf-next 2/2] tools/bpf: change selftest test_btf for both jit and non-jit Yonghong Song
2018-11-26 17:21 ` Martin Lau
2018-11-27 2:04 ` [PATCH bpf-next 0/2] bpf: support proper non-jit func info Alexei Starovoitov
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=20181125072045.1389189-1-yhs@fb.com \
--to=yhs@fb.com \
--cc=ast@fb.com \
--cc=daniel@iogearbox.net \
--cc=kernel-team@fb.com \
--cc=netdev@vger.kernel.org \
/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