All of lore.kernel.org
 help / color / mirror / Atom feed
* [ANNOUNCEMENT] Automated multi-kernel libbpf testing
@ 2020-03-19 23:24 Andrii Nakryiko
  2020-03-20 13:55 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 3+ messages in thread
From: Andrii Nakryiko @ 2020-03-19 23:24 UTC (permalink / raw)
  To: bpf, Alexei Starovoitov, Daniel Borkmann
  Cc: Julia Kartseva, osandov, Kernel Team, Andrii Nakryiko

Libbpf is the important part of the BPF ecosystem and it defines
modern ways to build and run BPF applications. As such, it’s crucial
that it is well-tested, reliable, and seamlessly works across multiple
kernels. Until recently, the only testing that was performed were BPF
selftests, run manually by BPF maintainers against the bleeding edge
versions of kernel. As diligent as maintainers are, this setup is not
perfect, requiring a lot of manual work, and could still miss
regressions and bugs due to kernel and environment differences.
Catching regressions on old kernels was especially ominous leading to
real problems in production at Facebook.

This seemed like a problem that needed automation. We took the idea of
our internal VMTEST framework, which allows to run application
integration tests against a range of kernels to catch problems, and
applied it to open-source Github mirror [0] of libbpf. We built upon
Omar Sandoval’s <osandov@fb.com> initial implementation for his drgn
tool [1] and adapted it to libbpf needs. It saved many hours of
tinkering with generic qemu/Linux image setup! Julia Kartseva <hex@fb.com>
spent lots of time and efforts on bringing this workflow to libbpf
and making process robust and maintainable.

Now, with each change to libbpf, we’ll pull and compile the latest
kernel and the latest BPF selftests using libbpf with patches to be
tested. Next, a VM with that kernel will start and will run a battery
of tests (test_progs, test_verifier, and test_maps), verifying that
both libbpf and the kernel are still working as expected. Further, to
verify libbpf didn’t regress on older kernels, we’ll download a set of
older kernels and will perform a supported subset of tests against
each of those kernels. This gives us confidence that no matter how
bleeding-edge libbpf library you use, it will still work fine across
all kernels. Check out a typical Travis CI test run [2] to get a
better idea. You can also see an annotated list [3] of blacklisted
tests for older kernel.

# Why does this matter?

- It’s all about confidence when making BPF changes and about
maintaining user trust. Automated, repeatable testing on **every**
change to libbpf is crucial for allowing BPF developers to move fast
and iterate quickly, while ensuring there is no inadvertent breakage
of BPF applications. The more libbpf is integrated into critical
applications (systemd, iproute2, bpftool, BCC tools, as well as
multitude of internal apps across private companies), the more
important this becomes.

- Well-tested and maintained libbpf Github mirror (as opposed to
building from kernel sources) as a single source of truth is important
for package maintainers to ensure consistent libbpf versioning across
different Linux distributions. This results in better user experience
overall and everyone wins from this consistency.

- This is also a good base for a more general kernel testing, given
that this test setup exercises not just libbpf, but the kernel itself
as well. With a bit more automation, it is possible to proactively
apply upstream patches and test kernel changes, saving tons of BPF
maintainers time and speeding up the patch review process.

In a short time we’ve had this running, this setup already caught
kernel, libbpf, and selftests bugs (and undoubtedly will catch more):
- BPF trampoline assembly bug [4];
- Kprobe tests triggering bug [5];
- Test cleanup crashes [6];
- Tests flakiness [7];
- Quite a few libbpf-specific problems we’ve never got to track explicitly...

  [0] https://github.com/libbpf/libbpf
  [1] https://github.com/osandov/drgn
  [2] https://travis-ci.org/github/libbpf/libbpf/builds/663674948
  [3] https://github.com/libbpf/libbpf/blob/master/travis-ci/vmtest/configs/blacklist/BLACKLIST-5.5.0
  [4] https://lore.kernel.org/netdev/20200311003906.3643037-1-ast@kernel.org/
  [5] https://patchwork.ozlabs.org/patch/1254743/
  [6] https://lore.kernel.org/netdev/20200220230546.769250-1-andriin@fb.com/
  [7] https://lore.kernel.org/bpf/20200314024855.ugbvrmqkfq7kao75@ast-mbp.dhcp.thefacebook.com/T/#ma733d8e9840d9f91ce20d1143a429aa0d6650959

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

* Re: [ANNOUNCEMENT] Automated multi-kernel libbpf testing
  2020-03-19 23:24 [ANNOUNCEMENT] Automated multi-kernel libbpf testing Andrii Nakryiko
@ 2020-03-20 13:55 ` Arnaldo Carvalho de Melo
  2020-03-20 18:15   ` Andrii Nakryiko
  0 siblings, 1 reply; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2020-03-20 13:55 UTC (permalink / raw)
  To: Andrii Nakryiko
  Cc: bpf, Alexei Starovoitov, Daniel Borkmann, Julia Kartseva,
	osandov, Kernel Team, Andrii Nakryiko

Em Thu, Mar 19, 2020 at 04:24:55PM -0700, Andrii Nakryiko escreveu:
> # Why does this matter?
> 
> - It’s all about confidence when making BPF changes and about
> maintaining user trust. Automated, repeatable testing on **every**
> change to libbpf is crucial for allowing BPF developers to move fast
> and iterate quickly, while ensuring there is no inadvertent breakage
> of BPF applications. The more libbpf is integrated into critical
> applications (systemd, iproute2, bpftool, BCC tools, as well as
> multitude of internal apps across private companies), the more
> important this becomes.

Great news, just adding that at each perf pull request libbpf has been
continually compile tested in most of these containers, for a few years
already, with gcc and clang:

  # export PERF_TARBALL=http://192.168.122.1/perf/perf-5.6.0-rc4.tar.xz
  # dm 
   1 alpine:3.4                    : Ok   gcc (Alpine 5.3.0) 5.3.0, clang version 3.8.0 (tags/RELEASE_380/final)
   2 alpine:3.5                    : Ok   gcc (Alpine 6.2.1) 6.2.1 20160822, clang version 3.8.1 (tags/RELEASE_381/final)
   3 alpine:3.6                    : Ok   gcc (Alpine 6.3.0) 6.3.0, clang version 4.0.0 (tags/RELEASE_400/final)
   4 alpine:3.7                    : Ok   gcc (Alpine 6.4.0) 6.4.0, Alpine clang version 5.0.0 (tags/RELEASE_500/final) (based on LLVM 5.0.0)
   5 alpine:3.8                    : Ok   gcc (Alpine 6.4.0) 6.4.0, Alpine clang version 5.0.1 (tags/RELEASE_501/final) (based on LLVM 5.0.1)
   6 alpine:3.9                    : Ok   gcc (Alpine 8.3.0) 8.3.0, Alpine clang version 5.0.1 (tags/RELEASE_502/final) (based on LLVM 5.0.1)
   7 alpine:3.10                   : Ok   gcc (Alpine 8.3.0) 8.3.0, Alpine clang version 8.0.0 (tags/RELEASE_800/final) (based on LLVM 8.0.0)
   8 alpine:3.11                   : Ok   gcc (Alpine 9.2.0) 9.2.0, Alpine clang version 9.0.0 (https://git.alpinelinux.org/aports f7f0d2c2b8bcd6a5843401a9a702029556492689) (based on LLVM 9.0.0)
   9 alpine:edge                   : Ok   gcc (Alpine 9.2.0) 9.2.0, Alpine clang version 9.0.1 (git://git.alpinelinux.org/aports 7c78441134e54efbb34618f457d88c783c913361) (based on LLVM 9.0.1)
  10 alt:p8                        : Ok   x86_64-alt-linux-gcc (GCC) 5.3.1 20151207 (ALT p8 5.3.1-alt3.M80P.1), clang version 3.8.0 (tags/RELEASE_380/final)
  11 alt:p9                        : Ok   x86_64-alt-linux-gcc (GCC) 8.3.1 20190507 (ALT p9 8.3.1-alt5), clang version 7.0.1 
  12 alt:sisyphus                  : Ok   x86_64-alt-linux-gcc (GCC) 9.2.1 20200123 (ALT Sisyphus 9.2.1-alt3), clang version 9.0.1 
  13 amazonlinux:1                 : Ok   gcc (GCC) 7.2.1 20170915 (Red Hat 7.2.1-2), clang version 3.6.2 (tags/RELEASE_362/final)
  14 amazonlinux:2                 : Ok   gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-6), clang version 7.0.1 (Amazon Linux 2 7.0.1-1.amzn2.0.2)
  15 android-ndk:r12b-arm          : Ok   arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease)
  16 android-ndk:r15c-arm          : Ok   arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease)
  17 centos:5                      : Ok   gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-55)
  18 centos:6                      : Ok   gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23)
  19 centos:7                      : Ok   gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39)
  20 centos:8                      : Ok   gcc (GCC) 8.3.1 20190507 (Red Hat 8.3.1-4), clang version 8.0.1 (Red Hat 8.0.1-1.module_el8.1.0+215+a01033fb)
  21 clearlinux:latest             : Ok   gcc (Clear Linux OS for Intel Architecture) 9.2.1 20200305 gcc_9_2_0_release-738-ge50627ff8c, clang version 9.0.1 
  22 debian:8                      : Ok   gcc (Debian 4.9.2-10+deb8u2) 4.9.2, Debian clang version 3.5.0-10 (tags/RELEASE_350/final) (based on LLVM 3.5.0)
  23 debian:9                      : Ok   gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516, clang version 3.8.1-24 (tags/RELEASE_381/final)
  24 debian:10                     : Ok   gcc (Debian 8.3.0-6) 8.3.0, clang version 7.0.1-8 (tags/RELEASE_701/final)
  25 debian:experimental           : Ok   gcc (Debian 9.2.1-31) 9.2.1 20200306, clang version 9.0.1-9 
  26 debian:experimental-x-arm64   : Ok   aarch64-linux-gnu-gcc (Debian 9.2.1-28) 9.2.1 20200203
  27 debian:experimental-x-mips    : Ok   mips-linux-gnu-gcc (Debian 9.2.1-24) 9.2.1 20200117
  28 debian:experimental-x-mips64  : Ok   mips64-linux-gnuabi64-gcc (Debian 9.2.1-24) 9.2.1 20200117
  29 fedora:20                     : Ok   gcc (GCC) 4.8.3 20140911 (Red Hat 4.8.3-7)
  30 fedora:22                     : Ok   gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6), clang version 3.5.0 (tags/RELEASE_350/final)
  31 fedora:23                     : Ok   gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6), clang version 3.7.0 (tags/RELEASE_370/final)
  32 fedora:24                     : Ok   gcc (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1), clang version 3.8.1 (tags/RELEASE_381/final)
  33 fedora:24-x-ARC-uClibc        : Ok   arc-linux-gcc (ARCompact ISA Linux uClibc toolchain 2017.09-rc2) 7.1.1 20170710
  34 fedora:25                     : Ok   gcc (GCC) 6.4.1 20170727 (Red Hat 6.4.1-1), clang version 3.9.1 (tags/RELEASE_391/final)
  35 fedora:26                     : Ok   gcc (GCC) 7.3.1 20180130 (Red Hat 7.3.1-2), clang version 4.0.1 (tags/RELEASE_401/final)
  36 fedora:27                     : Ok   gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-6), clang version 5.0.2 (tags/RELEASE_502/final)
  37 fedora:28                     : Ok   gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2), clang version 6.0.1 (tags/RELEASE_601/final)
  38 fedora:29                     : Ok   gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2), clang version 7.0.1 (Fedora 7.0.1-6.fc29)
  39 fedora:30                     : Ok   gcc (GCC) 9.2.1 20190827 (Red Hat 9.2.1-1), clang version 8.0.0 (Fedora 8.0.0-3.fc30)
  40 fedora:30-x-ARC-glibc         : Ok   arc-linux-gcc (ARC HS GNU/Linux glibc toolchain 2019.03-rc1) 8.3.1 20190225
  41 fedora:30-x-ARC-uClibc        : Ok   arc-linux-gcc (ARCv2 ISA Linux uClibc toolchain 2019.03-rc1) 8.3.1 20190225
  42 fedora:31                     : Ok   gcc (GCC) 9.2.1 20190827 (Red Hat 9.2.1-1), clang version 9.0.1 (Fedora 9.0.1-2.fc31)
  43 fedora:32                     : Ok   gcc (GCC) 10.0.1 20200216 (Red Hat 10.0.1-0.8), clang version 10.0.0 (Fedora 10.0.0-0.1.rc2.fc32)
  44 fedora:rawhide                : Ok   gcc (GCC) 10.0.1 20200216 (Red Hat 10.0.1-0.8), clang version 10.0.0 (Fedora 10.0.0-0.5.rc3.fc33)
  45 gentoo-stage3-amd64:latest    : Ok   gcc (Gentoo 9.2.0-r2 p3) 9.2.0
  46 mageia:5                      : Ok   gcc (GCC) 4.9.2, clang version 3.5.2 (tags/RELEASE_352/final)
  47 mageia:6                      : Ok   gcc (Mageia 5.5.0-1.mga6) 5.5.0, clang version 3.9.1 (tags/RELEASE_391/final)
  48 mageia:7                      : Ok   gcc (Mageia 8.4.0-1.mga7) 8.4.0, clang version 8.0.0 (Mageia 8.0.0-1.mga7)
  49 manjaro:latest                : Ok   gcc (Arch Linux 9.2.1+20200130-2) 9.2.1 20200130, clang version 9.0.1 
  50 openmandriva:cooker           : Ok   gcc (GCC) 10.0.0 20200301 (OpenMandriva), clang version 10.0.0 
  51 opensuse:15.0                 : Ok   gcc (SUSE Linux) 7.4.1 20190905 [gcc-7-branch revision 275407], clang version 5.0.1 (tags/RELEASE_501/final 312548)
  52 opensuse:42.3                 : Ok   gcc (SUSE Linux) 4.8.5, clang version 3.8.0 (tags/RELEASE_380/final 262553)
  53 opensuse:tumbleweed           : Ok   gcc (SUSE Linux) 9.2.1 20200128 [revision 83f65674e78d97d27537361de1a9d74067ff228d], clang version 9.0.1 
  54 oraclelinux:6                 : Ok   gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23.0.1)
  55 oraclelinux:7                 : Ok   gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39.0.3)
  56 oraclelinux:8                 : Ok   gcc (GCC) 8.3.1 20190507 (Red Hat 8.3.1-4.5.0.5), clang version 8.0.1 (Red Hat 8.0.1-1.0.1.module+el8.1.0+5428+345cee14)
  57 ubuntu:12.04                  : Ok   gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3, Ubuntu clang version 3.0-6ubuntu3 (tags/RELEASE_30/final) (based on LLVM 3.0)
  58 ubuntu:14.04                  : Ok   gcc (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4
  59 ubuntu:16.04                  : Ok   gcc (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609, clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)
  60 ubuntu:16.04-x-arm            : Ok   arm-linux-gnueabihf-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
  61 ubuntu:16.04-x-arm64          : Ok   aarch64-linux-gnu-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
  62 ubuntu:16.04-x-powerpc        : Ok   powerpc-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
  63 ubuntu:16.04-x-powerpc64      : Ok   powerpc64-linux-gnu-gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
  64 ubuntu:16.04-x-powerpc64el    : Ok   powerpc64le-linux-gnu-gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
  65 ubuntu:16.04-x-s390           : Ok   s390x-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
  66 ubuntu:18.04                  : Ok   gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0, clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
  67 ubuntu:18.04-x-arm            : Ok   arm-linux-gnueabihf-gcc (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0
  68 ubuntu:18.04-x-arm64          : Ok   aarch64-linux-gnu-gcc (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0
  69 ubuntu:18.04-x-m68k           : Ok   m68k-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
  70 ubuntu:18.04-x-powerpc        : Ok   powerpc-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
  71 ubuntu:18.04-x-powerpc64      : Ok   powerpc64-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
  72 ubuntu:18.04-x-powerpc64el    : Ok   powerpc64le-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
  73 ubuntu:18.04-x-riscv64        : Ok   riscv64-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
  74 ubuntu:18.04-x-s390           : Ok   s390x-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
  75 ubuntu:18.04-x-sh4            : Ok   sh4-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
  76 ubuntu:18.04-x-sparc64        : Ok   sparc64-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
  77 ubuntu:19.04                  : Ok   gcc (Ubuntu 8.3.0-6ubuntu1) 8.3.0, clang version 8.0.0-3 (tags/RELEASE_800/final)
  78 ubuntu:19.04-x-alpha          : Ok   alpha-linux-gnu-gcc (Ubuntu 8.3.0-6ubuntu1) 8.3.0
  79 ubuntu:19.04-x-arm64          : Ok   aarch64-linux-gnu-gcc (Ubuntu/Linaro 8.3.0-6ubuntu1) 8.3.0
  80 ubuntu:19.04-x-hppa           : Ok   hppa-linux-gnu-gcc (Ubuntu 8.3.0-6ubuntu1) 8.3.0
  81 ubuntu:19.10                  : Ok   gcc (Ubuntu 9.2.1-9ubuntu2) 9.2.1 20191008, clang version 9.0.0-2 (tags/RELEASE_900/final)
  $

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

* Re: [ANNOUNCEMENT] Automated multi-kernel libbpf testing
  2020-03-20 13:55 ` Arnaldo Carvalho de Melo
@ 2020-03-20 18:15   ` Andrii Nakryiko
  0 siblings, 0 replies; 3+ messages in thread
From: Andrii Nakryiko @ 2020-03-20 18:15 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: bpf, Alexei Starovoitov, Daniel Borkmann, Julia Kartseva,
	osandov, Kernel Team, Andrii Nakryiko

On Fri, Mar 20, 2020 at 6:55 AM Arnaldo Carvalho de Melo
<arnaldo.melo@gmail.com> wrote:
>
> Em Thu, Mar 19, 2020 at 04:24:55PM -0700, Andrii Nakryiko escreveu:
> > # Why does this matter?
> >
> > - It’s all about confidence when making BPF changes and about
> > maintaining user trust. Automated, repeatable testing on **every**
> > change to libbpf is crucial for allowing BPF developers to move fast
> > and iterate quickly, while ensuring there is no inadvertent breakage
> > of BPF applications. The more libbpf is integrated into critical
> > applications (systemd, iproute2, bpftool, BCC tools, as well as
> > multitude of internal apps across private companies), the more
> > important this becomes.
>
> Great news, just adding that at each perf pull request libbpf has been
> continually compile tested in most of these containers, for a few years
> already, with gcc and clang:
>

Yep, that variety is great! We've been compile-testing for a while in
Github across few architectures (amd64, arm64, s390x, ppc64le),
running selftests was necessary to capture issues beyond compilation
errors and warnings. Plus a lot of old kernel regressions could be
detected only in runtime, which is what motivated this work.

[...]

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

end of thread, other threads:[~2020-03-20 18:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-19 23:24 [ANNOUNCEMENT] Automated multi-kernel libbpf testing Andrii Nakryiko
2020-03-20 13:55 ` Arnaldo Carvalho de Melo
2020-03-20 18:15   ` Andrii Nakryiko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.