Re: Plans for libbpf packaging for distros?


Jesper Dangaard Brouer
 

On Thu, 8 Nov 2018 12:37:06 -0200
Arnaldo Carvalho de Melo <acme@...> wrote:

Em Thu, Nov 08, 2018 at 02:37:54PM +0100, Jesper Dangaard Brouer escreveu:
Hi Jakub, Laura and Jiri Olsa (Cc others),

Subj: iovisor-dev] minutes: IO Visor TSC/Dev Meeting
(To: iovisor-dev <iovisor-dev@...>)
On Wed, 31 Oct 2018 14:30:25 -0700 "Brenden Blanco" <bblanco@...> wrote:
Jakub:
* working on getting libbpf packaged separately and released by distros
* FB has external mirror github.com/libbpf/libbpf
I noticed from the iovisor-dev minutes that you have plans for
packaging libbpf from the kernel tree. And via that I noticed the
github repo https://github.com/libbpf/libbpf, created by Yonghong Song.

I'm uncertain if it makes sense to maintain this library outside the
kernel git tree?!?
To ease access to the latest perf sources, we'll be making available
detached tarballs:

[acme@jouet linux]$ make help | grep perf
perf-tar-src-pkg - Build perf-4.20.0-rc1.tar source tarball
perf-targz-src-pkg - Build perf-4.20.0-rc1.tar.gz source tarball
perf-tarbz2-src-pkg - Build perf-4.20.0-rc1.tar.bz2 source tarball
perf-tarxz-src-pkg - Build perf-4.20.0-rc1.tar.xz source tarball
[acme@jouet linux]$

After each kernel release, we started with 4.19:

https://www.kernel.org/pub/linux/kernel/tools/perf/
And you basically also ship a version of libbpf in this tarball:

$ tar tvf ~/download/perf-4.19.0.tar.xz | grep lib/bpf
drwxrwxr-x root/root 0 2018-10-22 16:39 perf-4.19.0/tools/lib/bpf/
-rw-rw-r-- root/root 37 2018-10-22 16:39 perf-4.19.0/tools/lib/bpf/.gitignore
-rw-rw-r-- root/root 69 2018-10-22 16:39 perf-4.19.0/tools/lib/bpf/Build
-rw-rw-r-- root/root 6457 2018-10-22 16:39 perf-4.19.0/tools/lib/bpf/Makefile
-rw-rw-r-- root/root 16456 2018-10-22 16:39 perf-4.19.0/tools/lib/bpf/bpf.c
-rw-rw-r-- root/root 4440 2018-10-22 16:39 perf-4.19.0/tools/lib/bpf/bpf.h
-rw-rw-r-- root/root 7897 2018-10-22 16:39 perf-4.19.0/tools/lib/bpf/btf.c
-rw-rw-r-- root/root 775 2018-10-22 16:39 perf-4.19.0/tools/lib/bpf/btf.h
-rw-rw-r-- root/root 56905 2018-10-22 16:39 perf-4.19.0/tools/lib/bpf/libbpf.c
-rw-rw-r-- root/root 10683 2018-10-22 16:39 perf-4.19.0/tools/lib/bpf/libbpf.h
-rw-rw-r-- root/root 2380 2018-10-22 16:39 perf-4.19.0/tools/lib/bpf/libbpf_errno.c
-rw-rw-r-- root/root 4483 2018-10-22 16:39 perf-4.19.0/tools/lib/bpf/nlattr.c
-rw-rw-r-- root/root 1825 2018-10-22 16:39 perf-4.19.0/tools/lib/bpf/nlattr.h
-rw-rw-r-- root/root 479 2018-10-22 16:39 perf-4.19.0/tools/lib/bpf/str_error.c
-rw-rw-r-- root/root 152 2018-10-22 16:39 perf-4.19.0/tools/lib/bpf/str_error.h

Which gets compiled to libbpf.a and statically linked with perf.

Development continues in the kernel git tree, of course, and there
you'll be able to, using those top level kernel perf-tar-* targets to
get the bleeding edge, while those tarballs on
https://www.kernel.org/pub/linux/kernel/tools/perf/
help people wanting to try the latest released with older kernels, or to
test one previous release with a more recent kernel, to rule out
problems with some specific perf version.

Konstantin, the kernel.org admin accepted my suggestion for such a
directory name so that we could, in the future, perhaps have the other
tools/ living libraries and tools to follow this model, i.e. we would
have:

https://www.kernel.org/pub/linux/kernel/tools/lib/bpf/

etc.

- Arnaldo

To be honest, I have very little knowledge about building RPMs and
other packages formats. I just wanted to point out that RHEL and
Fedora is now shipping bpftool, which also part of kernel git tree.

(Now I need input from Jiri Olsa and Laura to correct below statements:)

AFAIK bpftool RPM-package[1] is part of the "Source Package"
kernel-tools, which AFAIK gets build directly from the distro kernel
git tree via kernel.spec file. This also happens for perf
RPM-package[2] see section "Source Package" also point to kernel-tools.

So, my question is, can we ship/package libbpf in the same way?


Notice, that an increasing number of tools are linking/using libbpf,
e.g. perf, bpftool, Suricata, (selftests and samples/bpf).


[1] https://fedora.pkgs.org/28/fedora-x86_64/bpftool-4.16.0-1.fc28.x86_64.rpm.html
[2] https://fedora.pkgs.org/29/fedora-x86_64/perf-4.18.10-300.fc29.x86_64.rpm.html
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer

Join iovisor-dev@lists.iovisor.org to automatically receive all group messages.