]> git.baikalelectronics.ru Git - kernel.git/commit
Merge branch 'non-jit-btf-func_info'
authorAlexei Starovoitov <ast@kernel.org>
Tue, 27 Nov 2018 01:57:11 +0000 (17:57 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 27 Nov 2018 01:57:11 +0000 (17:57 -0800)
commit6ad7280eb72943f551fbc6cd2be5a426979fd00d
tree7cd26f6f2f345411b5c5ce34b17d1c4efb19303d
parent4ac61150fd2b869c67457c9d1d48415c8fda19ea
parent3c7789a2040388ea96f992e5af1f63c2c6d8d19a
Merge branch 'non-jit-btf-func_info'

Yonghong Song says:

====================
Commit 42b7bb2cb848 ("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
====================

Signed-off-by: Alexei Starovoitov <ast@kernel.org>