mbox series

[v2,bpf-next,0/4] veristat: CSV output, comparison mode, filtering

Message ID 20220921164254.3630690-1-andrii@kernel.org (mailing list archive)
Headers show
Series veristat: CSV output, comparison mode, filtering | expand

Message

Andrii Nakryiko Sept. 21, 2022, 4:42 p.m. UTC
Add three more critical features to veristat tool, which make it sufficient
for a practical work on BPF verifier:

  - CSV output, which allows easier programmatic post-processing of stats;

  - building upon CSV output, veristat now supports comparison mode, in which
    two previously captured CSV outputs from veristat are compared with each
    other in a convenient form;

  - flexible allow/deny filtering using globs for BPF object files and
    programs, allowing to narrow down target BPF programs to be verified.

See individual patches for more details and examples.

v1->v2:
- split out double-free fix into patch #1 (Yonghong);
- fixed typo in verbose flag (Quentin);
- baseline and comparison stats were reversed in output table, fixed that.

Andrii Nakryiko (4):
  selftests/bpf: fix double bpf_object__close() in veristate
  selftests/bpf: add CSV output mode for veristat
  selftests/bpf: add comparison mode to veristat
  selftests/bpf: add ability to filter programs in veristat

 tools/testing/selftests/bpf/veristat.c   | 853 ++++++++++++++++++++---
 tools/testing/selftests/bpf/veristat.cfg |  17 +
 2 files changed, 787 insertions(+), 83 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/veristat.cfg

Comments

patchwork-bot+netdevbpf@kernel.org Sept. 22, 2022, 2:50 a.m. UTC | #1
Hello:

This series was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:

On Wed, 21 Sep 2022 09:42:50 -0700 you wrote:
> Add three more critical features to veristat tool, which make it sufficient
> for a practical work on BPF verifier:
> 
>   - CSV output, which allows easier programmatic post-processing of stats;
> 
>   - building upon CSV output, veristat now supports comparison mode, in which
>     two previously captured CSV outputs from veristat are compared with each
>     other in a convenient form;
> 
> [...]

Here is the summary with links:
  - [v2,bpf-next,1/4] selftests/bpf: fix double bpf_object__close() in veristate
    https://git.kernel.org/bpf/bpf-next/c/f338ac910567
  - [v2,bpf-next,2/4] selftests/bpf: add CSV output mode for veristat
    https://git.kernel.org/bpf/bpf-next/c/e5eb08d8fe46
  - [v2,bpf-next,3/4] selftests/bpf: add comparison mode to veristat
    https://git.kernel.org/bpf/bpf-next/c/394169b079b5
  - [v2,bpf-next,4/4] selftests/bpf: add ability to filter programs in veristat
    https://git.kernel.org/bpf/bpf-next/c/bde4a96cdcad

You are awesome, thank you!
Alexei Starovoitov Sept. 22, 2022, 2:52 a.m. UTC | #2
On Wed, Sep 21, 2022 at 9:43 AM Andrii Nakryiko <andrii@kernel.org> wrote:
>
> Add three more critical features to veristat tool, which make it sufficient
> for a practical work on BPF verifier:

Nice tool!
Few requests:

1.
Please fix -v mode, since
veristat -v loop1.bpf.linked3.o
hangs forever. Maybe not forever, but I didn't have that much
time to find out whether it will finish eventually.

2.
Please add some sort of progress indicator to
veristat *.linked3.o
otherwise it's not clear when it will be done and
-v cannot be used to find out because of bug 1.

3.
could you make it ignore non bpf elf files?
So it can be used just with veristat *.o ?
Andrii Nakryiko Sept. 22, 2022, 4:21 p.m. UTC | #3
On Wed, Sep 21, 2022 at 7:52 PM Alexei Starovoitov
<alexei.starovoitov@gmail.com> wrote:
>
> On Wed, Sep 21, 2022 at 9:43 AM Andrii Nakryiko <andrii@kernel.org> wrote:
> >
> > Add three more critical features to veristat tool, which make it sufficient
> > for a practical work on BPF verifier:
>
> Nice tool!

Thanks!

> Few requests:
>
> 1.
> Please fix -v mode, since
> veristat -v loop1.bpf.linked3.o
> hangs forever. Maybe not forever, but I didn't have that much
> time to find out whether it will finish eventually.
>

[vmuser@archvm bpf]$ sudo ./veristat -v loop1.bpf.linked3.o
libbpf: prog 'nested_loops': BPF program load failed: No space left on device
libbpf: prog 'nested_loops': failed to load: -28
libbpf: failed to load object 'loop1.bpf.linked3.o'
...<hangs>...

Yep, some bug if the program fails to validate due to -ENOSPC. I'll fix it.

BTW, I also want to extend this verbose capability to allow specifying
log_level = 2 for BPF verifier, because for successfully validated BPF
programs log_level = 1 is empty (except for stats).

> 2.
> Please add some sort of progress indicator to
> veristat *.linked3.o
> otherwise it's not clear when it will be done and
> -v cannot be used to find out because of bug 1.

just dumping every entry to console would be too verbose, so I was
thinking to overwrite single line with updated progress, if output is
a console. I'll look up how to do it.

>
> 3.
> could you make it ignore non bpf elf files?
> So it can be used just with veristat *.o ?

Yep, I can, will add that as a convenience.

Note that for now you probably want to do '*.bpf.linked3.o'. Daniel
added .bpf.o suffix which helped greatly, but I think we might want to
tweak this a bit more to make sure that what we have as .bpf.linked3.o
is just .bpf.o, and initial .bpf.o (which might require further static
linking to be complete) will be called something else.