Hi,

Currently bpftool could disassemble host jited image, for example x86_64,
using libbfd. However it couldn't disassemble offload jited image.

There are two reasons:

  1. bpf_obj_get_info_by_fd/struct bpf_prog_info couldn't get the address
     of jited image and image's length.

  2. Even after issue 1 resolved, bpftool couldn't figure out what is the
     offload arch from bpf_prog_info, therefore can't drive libbfd
     disassembler correctly.

  This patch set resolve issue 1 by introducing two new fields "jited_len"
and "jited_image" in bpf_dev_offload. These two fields serve as the generic
interface to communicate the jited image address and length for all offload
targets to higher level caller. For example, bpf_obj_get_info_by_fd could
use them to fill the userspace visible fields jited_prog_len and
jited_prog_insns.

  This patch set resolve issue 2 by getting bfd backend name through
"ifindex", i.e network interface index.

v1:
 - Deduct bfd arch name through ifindex, i.e network interface index.
   First, map ifindex to devname through ifindex_to_name_ns, then get
   pci id through /sys/class/dev/DEVNAME/device/vendor. (Daniel, Alexei)
 
Jiong Wang (3):
  bpf: add new jited info fields in bpf_dev_offload and bpf_prog_info
  nfp: bpf: set new jit info fields
  tools: bpftool: improve architecture detection by using ifindex

 drivers/net/ethernet/netronome/nfp/bpf/offload.c | 10 +++-
 include/linux/bpf.h                              |  2 +
 kernel/bpf/offload.c                             | 23 ++++++++
 kernel/bpf/syscall.c                             | 31 +++++-----
 tools/bpf/bpftool/common.c                       | 72 ++++++++++++++++++++++++
 tools/bpf/bpftool/jit_disasm.c                   | 16 +++++-
 tools/bpf/bpftool/main.h                         |  5 +-
 tools/bpf/bpftool/prog.c                         | 12 +++-
 8 files changed, 154 insertions(+), 17 deletions(-)

-- 
2.15.1

Reply via email to