netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH bpf-next v2 0/9] tools: bpftool: add probes for system and device
@ 2018-12-20 12:24 Quentin Monnet
  2018-12-20 12:24 ` [RFC PATCH bpf-next v2 1/9] tools: bpftool: add basic probe capability, probe syscall and kversion Quentin Monnet
                   ` (8 more replies)
  0 siblings, 9 replies; 29+ messages in thread
From: Quentin Monnet @ 2018-12-20 12:24 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann
  Cc: netdev, oss-drivers, Quentin Monnet, Arnaldo Carvalho de Melo,
	Jesper Dangaard Brouer, Stanislav Fomichev

Hi,
This set adds a new command to bpftool in order to dump a list of
eBPF-related parameters for the system (or for a specific network
device) to the console. Once again, this is based on a suggestion from
Daniel.

At this time, output includes:

    - Availability of bpf() system call
    - Availability of bpf() system call for unprivileged users
    - JIT status (enabled or not, with or without debugging traces)
    - JIT hardening status
    - JIT kallsyms exports status
    - Status of kernel compilation options related to BPF features
    - Release number of the running kernel
    - Availability of known eBPF program types
    - Availability of known eBPF map types
    - Availability of known eBPF helper functions

There are three different ways to dump this information at this time:

    - Plain output dumps probe results in plain text. It is the most
      flexible options for providing descriptive output to the user, but
      should not be relied upon for parsing the output.
    - JSON output is supported.
    - A third mode, available through the "macros" keyword appended to the
      command line, dumps some of those parameters (not all) as a series of
      "#define" directives, that can be included into a C header file for
      example.

Probes for supported program and map types, and supported helpers, are
directly added to libbpf, so that other applications (or selftests) can
reuse them as necessary.

If the user does not have root privileges (or more precisely, the
CAP_SYS_ADMIN capability) detection will be erroneous for most
parameters. Therefore, forbid non-root users to run the command.

v2 (please also refer to individual patches' history):
- Move probes for prog/map types, helpers, from bpftool to libbpf.
- Move C-style output as a separate patch, and restrict it to a subset of
  collected information (bpf() availability, prog/map types, helpers).
- Now probe helpers with all supported program types, and display a list of
  compatible program types (as supported on the system) for each helper.
- NOT addressed: grouping compilation options for kernel into subsections
  (patch 3) (I don't see an easy way of grouping them at the moment, please
  see also the discussion on v1 thread).

Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Jesper Dangaard Brouer <brouer@redhat.com>
Cc: Stanislav Fomichev <sdf@google.com>
---
I'm sending this v2 as a RFC for feedback, mostly about the relocation of
the probes into libbpf and for the changes in helper probing. As mentioned
in v2 history, the grouping of kernel config options (suggested by Daniel)
is not addressed in this series.

I still expect some discussions on this set, so I do not mind at all being
delayed after the merge window.

Quentin Monnet (9):
  tools: bpftool: add basic probe capability, probe syscall and kversion
  tools: bpftool: add probes for /proc/ eBPF parameters
  tools: bpftool: add probes for kernel configuration options
  tools: bpftool: add probes for eBPF program types
  tools: bpftool: add probes for eBPF map types
  tools: bpftool: add probes for eBPF helper functions
  tools: bpftool: add C-style "#define" output for probes
  tools: bpftool: add probes for a network device
  tools: bpftool: add bash completion for bpftool probes

 .../bpftool/Documentation/bpftool-cgroup.rst  |   1 +
 .../bpftool/Documentation/bpftool-feature.rst |  85 +++
 .../bpf/bpftool/Documentation/bpftool-map.rst |   1 +
 .../bpf/bpftool/Documentation/bpftool-net.rst |   1 +
 .../bpftool/Documentation/bpftool-perf.rst    |   1 +
 .../bpftool/Documentation/bpftool-prog.rst    |   1 +
 tools/bpf/bpftool/Documentation/bpftool.rst   |   1 +
 tools/bpf/bpftool/bash-completion/bpftool     |  19 +
 tools/bpf/bpftool/common.c                    |   2 +-
 tools/bpf/bpftool/feature.c                   | 702 ++++++++++++++++++
 tools/bpf/bpftool/main.c                      |   3 +-
 tools/bpf/bpftool/main.h                      |   5 +
 tools/bpf/bpftool/map.c                       |   4 +-
 tools/lib/bpf/Build                           |   2 +-
 tools/lib/bpf/libbpf.h                        |   9 +
 tools/lib/bpf/libbpf.map                      |   3 +
 tools/lib/bpf/libbpf_probes.c                 | 178 +++++
 17 files changed, 1014 insertions(+), 4 deletions(-)
 create mode 100644 tools/bpf/bpftool/Documentation/bpftool-feature.rst
 create mode 100644 tools/bpf/bpftool/feature.c
 create mode 100644 tools/lib/bpf/libbpf_probes.c

-- 
2.17.1

^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2018-12-20 22:29 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-20 12:24 [RFC PATCH bpf-next v2 0/9] tools: bpftool: add probes for system and device Quentin Monnet
2018-12-20 12:24 ` [RFC PATCH bpf-next v2 1/9] tools: bpftool: add basic probe capability, probe syscall and kversion Quentin Monnet
2018-12-20 12:24 ` [RFC PATCH bpf-next v2 2/9] tools: bpftool: add probes for /proc/ eBPF parameters Quentin Monnet
2018-12-20 12:24 ` [RFC PATCH bpf-next v2 3/9] tools: bpftool: add probes for kernel configuration options Quentin Monnet
2018-12-20 17:40   ` Stanislav Fomichev
2018-12-20 18:02     ` Quentin Monnet
2018-12-20 18:14       ` Stanislav Fomichev
2018-12-20 12:24 ` [RFC PATCH bpf-next v2 4/9] tools: bpftool: add probes for eBPF program types Quentin Monnet
2018-12-20 17:45   ` Stanislav Fomichev
2018-12-20 18:06     ` [oss-drivers] " Quentin Monnet
2018-12-20 18:17       ` Stanislav Fomichev
2018-12-20 18:21         ` Quentin Monnet
2018-12-20 18:29           ` Stanislav Fomichev
2018-12-20 12:24 ` [RFC PATCH bpf-next v2 5/9] tools: bpftool: add probes for eBPF map types Quentin Monnet
2018-12-20 17:47   ` Stanislav Fomichev
2018-12-20 18:10     ` Quentin Monnet
2018-12-20 18:18       ` Stanislav Fomichev
2018-12-20 18:27         ` Quentin Monnet
2018-12-20 18:42           ` Stanislav Fomichev
2018-12-20 18:45             ` Quentin Monnet
2018-12-20 12:24 ` [RFC PATCH bpf-next v2 6/9] tools: bpftool: add probes for eBPF helper functions Quentin Monnet
2018-12-20 17:53   ` Stanislav Fomichev
2018-12-20 18:14     ` Quentin Monnet
2018-12-20 12:24 ` [RFC PATCH bpf-next v2 7/9] tools: bpftool: add C-style "#define" output for probes Quentin Monnet
2018-12-20 17:25   ` Daniel Borkmann
2018-12-20 20:05     ` Quentin Monnet
2018-12-20 22:29       ` Daniel Borkmann
2018-12-20 12:24 ` [RFC PATCH bpf-next v2 8/9] tools: bpftool: add probes for a network device Quentin Monnet
2018-12-20 12:24 ` [RFC PATCH bpf-next v2 9/9] tools: bpftool: add bash completion for bpftool probes Quentin Monnet

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).