mbox series

[bpf-next,v3,0/3] tools: bpftool: add an option for debug output from libbpf and verifier

Message ID 20190524103648.15669-1-quentin.monnet@netronome.com
Headers show
Series tools: bpftool: add an option for debug output from libbpf and verifier | expand

Message

Quentin Monnet May 24, 2019, 10:36 a.m. UTC
Hi,
This series adds an option to bpftool to make it print additional
information via libbpf and the kernel verifier when attempting to load
programs.

A new API function is added to libbpf in order to pass the log_level from
bpftool with the bpf_object__* part of the API.

Options for a finer control over the log levels to use for libbpf and the
verifier could be added in the future, if desired.

v3:
- Fix and clarify commit logs.

v2:
- Do not add distinct options for libbpf and verifier logs, just keep the
  one that sets all log levels to their maximum. Rename the option.
- Do not offer a way to pick desired log levels. The choice is "use the
  option to print all logs" or "stick with the defaults".
- Do not export BPF_LOG_* flags to user header.
- Update all man pages (most bpftool operations use libbpf and may print
  libbpf logs). Verifier logs are only used when attempting to load
  programs for now, so bpftool-prog.rst and bpftool.rst remain the only
  pages updated in that regard.

Previous discussion available at:
https://lore.kernel.org/bpf/20190523105426.3938-1-quentin.monnet@netronome.com/
https://lore.kernel.org/bpf/20190429095227.9745-1-quentin.monnet@netronome.com/

Quentin Monnet (3):
  tools: bpftool: add -d option to get debug output from libbpf
  libbpf: add bpf_object__load_xattr() API function to pass log_level
  tools: bpftool: make -d option print debug output from verifier

 .../bpf/bpftool/Documentation/bpftool-btf.rst |  4 +++
 .../bpftool/Documentation/bpftool-cgroup.rst  |  4 +++
 .../bpftool/Documentation/bpftool-feature.rst |  4 +++
 .../bpf/bpftool/Documentation/bpftool-map.rst |  4 +++
 .../bpf/bpftool/Documentation/bpftool-net.rst |  4 +++
 .../bpftool/Documentation/bpftool-perf.rst    |  4 +++
 .../bpftool/Documentation/bpftool-prog.rst    |  5 ++++
 tools/bpf/bpftool/Documentation/bpftool.rst   |  4 +++
 tools/bpf/bpftool/bash-completion/bpftool     |  2 +-
 tools/bpf/bpftool/main.c                      | 16 ++++++++++-
 tools/bpf/bpftool/main.h                      |  1 +
 tools/bpf/bpftool/prog.c                      | 27 ++++++++++++-------
 tools/lib/bpf/Makefile                        |  2 +-
 tools/lib/bpf/libbpf.c                        | 20 +++++++++++---
 tools/lib/bpf/libbpf.h                        |  6 +++++
 tools/lib/bpf/libbpf.map                      |  5 ++++
 16 files changed, 96 insertions(+), 16 deletions(-)

Comments

Yonghong Song May 24, 2019, 3:48 p.m. UTC | #1
On 5/24/19 3:36 AM, Quentin Monnet wrote:
> Hi,
> This series adds an option to bpftool to make it print additional
> information via libbpf and the kernel verifier when attempting to load
> programs.
> 
> A new API function is added to libbpf in order to pass the log_level from
> bpftool with the bpf_object__* part of the API.
> 
> Options for a finer control over the log levels to use for libbpf and the
> verifier could be added in the future, if desired.
> 
> v3:
> - Fix and clarify commit logs.
> 
> v2:
> - Do not add distinct options for libbpf and verifier logs, just keep the
>    one that sets all log levels to their maximum. Rename the option.
> - Do not offer a way to pick desired log levels. The choice is "use the
>    option to print all logs" or "stick with the defaults".
> - Do not export BPF_LOG_* flags to user header.
> - Update all man pages (most bpftool operations use libbpf and may print
>    libbpf logs). Verifier logs are only used when attempting to load
>    programs for now, so bpftool-prog.rst and bpftool.rst remain the only
>    pages updated in that regard.
> 
> Previous discussion available at:
> https://lore.kernel.org/bpf/20190523105426.3938-1-quentin.monnet@netronome.com/
> https://lore.kernel.org/bpf/20190429095227.9745-1-quentin.monnet@netronome.com/

The series looks good to me.
Acked-by: Yonghong Song <yhs@fb.com>

> 
> Quentin Monnet (3):
>    tools: bpftool: add -d option to get debug output from libbpf
>    libbpf: add bpf_object__load_xattr() API function to pass log_level
>    tools: bpftool: make -d option print debug output from verifier
> 
>   .../bpf/bpftool/Documentation/bpftool-btf.rst |  4 +++
>   .../bpftool/Documentation/bpftool-cgroup.rst  |  4 +++
>   .../bpftool/Documentation/bpftool-feature.rst |  4 +++
>   .../bpf/bpftool/Documentation/bpftool-map.rst |  4 +++
>   .../bpf/bpftool/Documentation/bpftool-net.rst |  4 +++
>   .../bpftool/Documentation/bpftool-perf.rst    |  4 +++
>   .../bpftool/Documentation/bpftool-prog.rst    |  5 ++++
>   tools/bpf/bpftool/Documentation/bpftool.rst   |  4 +++
>   tools/bpf/bpftool/bash-completion/bpftool     |  2 +-
>   tools/bpf/bpftool/main.c                      | 16 ++++++++++-
>   tools/bpf/bpftool/main.h                      |  1 +
>   tools/bpf/bpftool/prog.c                      | 27 ++++++++++++-------
>   tools/lib/bpf/Makefile                        |  2 +-
>   tools/lib/bpf/libbpf.c                        | 20 +++++++++++---
>   tools/lib/bpf/libbpf.h                        |  6 +++++
>   tools/lib/bpf/libbpf.map                      |  5 ++++
>   16 files changed, 96 insertions(+), 16 deletions(-)
>
Daniel Borkmann May 28, 2019, 9:27 a.m. UTC | #2
On 05/24/2019 12:36 PM, Quentin Monnet wrote:
> Hi,
> This series adds an option to bpftool to make it print additional
> information via libbpf and the kernel verifier when attempting to load
> programs.
> 
> A new API function is added to libbpf in order to pass the log_level from
> bpftool with the bpf_object__* part of the API.
> 
> Options for a finer control over the log levels to use for libbpf and the
> verifier could be added in the future, if desired.
> 
> v3:
> - Fix and clarify commit logs.
> 
> v2:
> - Do not add distinct options for libbpf and verifier logs, just keep the
>   one that sets all log levels to their maximum. Rename the option.
> - Do not offer a way to pick desired log levels. The choice is "use the
>   option to print all logs" or "stick with the defaults".
> - Do not export BPF_LOG_* flags to user header.
> - Update all man pages (most bpftool operations use libbpf and may print
>   libbpf logs). Verifier logs are only used when attempting to load
>   programs for now, so bpftool-prog.rst and bpftool.rst remain the only
>   pages updated in that regard.
> 
> Previous discussion available at:
> https://lore.kernel.org/bpf/20190523105426.3938-1-quentin.monnet@netronome.com/
> https://lore.kernel.org/bpf/20190429095227.9745-1-quentin.monnet@netronome.com/
> 
> Quentin Monnet (3):
>   tools: bpftool: add -d option to get debug output from libbpf
>   libbpf: add bpf_object__load_xattr() API function to pass log_level
>   tools: bpftool: make -d option print debug output from verifier
> 
>  .../bpf/bpftool/Documentation/bpftool-btf.rst |  4 +++
>  .../bpftool/Documentation/bpftool-cgroup.rst  |  4 +++
>  .../bpftool/Documentation/bpftool-feature.rst |  4 +++
>  .../bpf/bpftool/Documentation/bpftool-map.rst |  4 +++
>  .../bpf/bpftool/Documentation/bpftool-net.rst |  4 +++
>  .../bpftool/Documentation/bpftool-perf.rst    |  4 +++
>  .../bpftool/Documentation/bpftool-prog.rst    |  5 ++++
>  tools/bpf/bpftool/Documentation/bpftool.rst   |  4 +++
>  tools/bpf/bpftool/bash-completion/bpftool     |  2 +-
>  tools/bpf/bpftool/main.c                      | 16 ++++++++++-
>  tools/bpf/bpftool/main.h                      |  1 +
>  tools/bpf/bpftool/prog.c                      | 27 ++++++++++++-------
>  tools/lib/bpf/Makefile                        |  2 +-
>  tools/lib/bpf/libbpf.c                        | 20 +++++++++++---
>  tools/lib/bpf/libbpf.h                        |  6 +++++
>  tools/lib/bpf/libbpf.map                      |  5 ++++
>  16 files changed, 96 insertions(+), 16 deletions(-)
> 

Applied, thanks!