From: Justin M. Forbes on gitlab.com Merge Request: https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2907
When kernel-tools was split out to a separate package in Fedora, it was due to several factors. Most of those issues have been mitigated in other ways, and there are advantages to building tools with the kernel build. Let's turn on tools for Fedora. To do so, we need to add the libperf packages, but this enables them for Fedora only. It is worth noting that the Fedora package for bpftool will retain the upstream kernel versioning. This is because the bpftool versioning scheme is incompatible with the stable Fedora process.
--- redhat/kernel.spec.template | 78 ++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 74 insertions(+), 4 deletions(-)
From: Thorsten Leemhuis fedora@leemhuis.info
add libperf packages and enable perf, libperf, tools and bpftool packages
Signed-off-by: Thorsten Leemhuis fedora@leemhuis.info
diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template index blahblah..blahblah 100644 --- a/redhat/kernel.spec.template +++ b/redhat/kernel.spec.template @@ -224,6 +224,8 @@ Summary: The Linux kernel %define with_cross_headers %{?_without_cross_headers: 0} %{?!_without_cross_headers: 1} # perf %define with_perf %{?_without_perf: 0} %{?!_without_perf: 1} +# libperf +%define with_libperf %{?_without_libperf: 0} %{?!_without_libperf: 1} # tools %define with_tools %{?_without_tools: 0} %{?!_without_tools: 1} # bpf tool @@ -300,9 +302,10 @@ Summary: The Linux kernel # no stablelist %define with_kernel_abi_stablelists 0 # Fedora builds these separately -%define with_perf 0 -%define with_tools 0 -%define with_bpftool 0 +%define with_perf 1 +%define with_libperf 1 +%define with_tools 1 +%define with_bpftool 1 # No realtime fedora variants %define with_realtime 0 %define with_arm64_64k 0 @@ -388,6 +391,7 @@ Summary: The Linux kernel %define with_realtime 0 %define with_vdso_install 0 %define with_perf 0 +%define with_libperf 0 %define with_tools 0 %define with_bpftool 0 %define with_kernel_abi_stablelists 0 @@ -402,6 +406,7 @@ Summary: The Linux kernel %define with_base 0 %define with_vdso_install 0 %define with_perf 0 +%define with_libperf 0 %define with_tools 0 %define with_bpftool 0 %define with_kernel_abi_stablelists 0 @@ -417,6 +422,7 @@ Summary: The Linux kernel %define with_debuginfo 0 %define with_vdso_install 0 %define with_perf 0 +%define with_libperf 0 %define with_tools 0 %define with_bpftool 0 %define with_kernel_abi_stablelists 0 @@ -480,6 +486,7 @@ Summary: The Linux kernel %define with_cross_headers 0 %define with_tools 0 %define with_perf 0 +%define with_libperf 0 %define with_bpftool 0 %define with_selftests 0 %define with_debug 0 @@ -572,6 +579,7 @@ Summary: The Linux kernel
%define with_debuginfo 0 %define with_perf 0 +%define with_libperf 0 %define with_tools 0 %define with_bpftool 0 %define with_selftests 0 @@ -1124,6 +1132,23 @@ This package provides debug information for the perf python bindings. # with_perf %endif
+%if %{with_libperf} +%package -n libperf +Summary: The perf library from kernel source +License: GPL-2.0-only AND (LGPL-2.1-only OR BSD-2-Clause) +%description -n libperf +This package contains the kernel source perf library. + +%package -n libperf-devel +Summary: Developement files for the perf library from kernel source +License: GPL-2.0-only AND (LGPL-2.1-only OR BSD-2-Clause) +%description -n libperf-devel +This package includes libraries and header files needed for development +of applications which use perf library from kernel source. + +# with_libperf +%endif + %if %{with_tools} %package -n %{package_name}-tools Summary: Assortment of tools for the Linux kernel @@ -2728,6 +2753,12 @@ chmod +x tools/perf/check-headers.sh %{perf_make} DESTDIR=$RPM_BUILD_ROOT all %endif
+%if %{with_libperf} +%global libperf_make \ + %{__make} %{?make_opts} EXTRA_CFLAGS="${RPM_OPT_FLAGS}" LDFLAGS="%{__global_ldflags}" %{?cross_opts} -C tools/lib/perf V=1 +%{libperf_make} DESTDIR=$RPM_BUILD_ROOT +%endif + %global tools_make \ CFLAGS="${RPM_OPT_FLAGS}" LDFLAGS="%{__global_ldflags}" %{make} %{?make_opts}
@@ -3009,6 +3040,10 @@ mkdir -p %{buildroot}/%{_mandir}/man1 rm -rf %{buildroot}%{_libdir}/traceevent %endif
+%if %{with_libperf} +%{libperf_make} DESTDIR=%{buildroot} prefix=%{_prefix} libdir=%{_libdir} install install_headers +%endif + %if %{with_tools} %ifarch %{cpupowerarchs} %{make} -C tools/power/cpupower DESTDIR=$RPM_BUILD_ROOT libdir=%{_libdir} mandir=%{_mandir} CPUFREQ_BENCH=false install @@ -3494,6 +3529,37 @@ fi\ # with_perf %endif
+%if %{with_libperf} +%files -n libperf +%{_libdir}/libperf.so.0 +%{_libdir}/libperf.so.0.0.1 + +%files -n libperf-devel +%{_libdir}/libperf.so +%{_libdir}/pkgconfig/libperf.pc +%{_includedir}/internal/*.h +%{_includedir}/perf/bpf_perf.h +%{_includedir}/perf/core.h +%{_includedir}/perf/cpumap.h +%{_includedir}/perf/perf_dlfilter.h +%{_includedir}/perf/event.h +%{_includedir}/perf/evlist.h +%{_includedir}/perf/evsel.h +%{_includedir}/perf/mmap.h +%{_includedir}/perf/threadmap.h +%{_mandir}/man3/libperf.3.gz +%{_mandir}/man7/libperf-counting.7.gz +%{_mandir}/man7/libperf-sampling.7.gz +%{_docdir}/libperf/examples/sampling.c +%{_docdir}/libperf/examples/counting.c +%{_docdir}/libperf/html/libperf.html +%{_docdir}/libperf/html/libperf-counting.html +%{_docdir}/libperf/html/libperf-sampling.html + +# with_libperf +%endif + + %if %{with_tools} %ifnarch %{cpupowerarchs} %files -n %{package_name}-tools @@ -3543,6 +3609,8 @@ fi\ %files -n %{package_name}-tools-libs-devel %{_libdir}/libcpupower.so %{_includedir}/cpufreq.h +%{_includedir}/cpuidle.h +%{_includedir}/powercap.h %endif
%files -n rtla
-- https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2907
From: Justin M. Forbes jforbes@fedoraproject.org
Don't ship libperf.a in libperf-devel
Signed-off-by: Justin M. Forbes jforbes@fedoraproject.org
diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template index blahblah..blahblah 100644 --- a/redhat/kernel.spec.template +++ b/redhat/kernel.spec.template @@ -3042,6 +3042,8 @@ rm -rf %{buildroot}%{_libdir}/traceevent
%if %{with_libperf} %{libperf_make} DESTDIR=%{buildroot} prefix=%{_prefix} libdir=%{_libdir} install install_headers +# This is installed on some arches and we don't want to ship it +rm -rf %{buildroot}%{_libdir}/libperf.a %endif
%if %{with_tools}
-- https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2907
From: Justin M. Forbes jforbes@fedoraproject.org
Don't use upstream bpftool version for Fedora package
Upstream bpftool went with their own versioning. While this works in rawhide and RHEL where release is bumped wth every build, it does not work with Fedora. Because bpftool sublevel is not bumped with stable updates, and we don't update the release in Fedora when the version has changed, we ended up with a failure because the bpftool subpackage version already exists. For Fedora, we will stick with the kernel versioning for the package. bpftool -V still displays the upstream bpftool version number.
Signed-off-by: Justin M. Forbes jforbes@fedoraproject.org
diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template index blahblah..blahblah 100644 --- a/redhat/kernel.spec.template +++ b/redhat/kernel.spec.template @@ -1227,7 +1227,14 @@ analysing the logical and timing behavior of Linux.
%if %{with_bpftool}
+%if 0%{?fedora} +# bpftoolverion doesn't bump with stable updates so let's stick with +# upstream kernel version for the package name. We still get correct +# output with bpftool -V. +%define bpftoolversion %specrpmversion +%else %define bpftoolversion %%SPECBPFTOOLVERSION%% +%endif
%package -n bpftool Summary: Inspection and simple manipulation of eBPF programs and maps
-- https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2907
From: Justin M. Forbes jforbes@fedoraproject.org
Remove separate license tag for libperf
Signed-off-by: Justin M. Forbes jforbes@fedoraproject.org
diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template index blahblah..blahblah 100644 --- a/redhat/kernel.spec.template +++ b/redhat/kernel.spec.template @@ -1135,13 +1135,11 @@ This package provides debug information for the perf python bindings. %if %{with_libperf} %package -n libperf Summary: The perf library from kernel source -License: GPL-2.0-only AND (LGPL-2.1-only OR BSD-2-Clause) %description -n libperf This package contains the kernel source perf library.
%package -n libperf-devel Summary: Developement files for the perf library from kernel source -License: GPL-2.0-only AND (LGPL-2.1-only OR BSD-2-Clause) %description -n libperf-devel This package includes libraries and header files needed for development of applications which use perf library from kernel source.
-- https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2907
From: Justin M. Forbes jforbes@fedoraproject.org
Remove defines forcing tools on, they override cmdline
Signed-off-by: Justin M. Forbes jforbes@fedoraproject.org
diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template index blahblah..blahblah 100644 --- a/redhat/kernel.spec.template +++ b/redhat/kernel.spec.template @@ -301,11 +301,6 @@ Summary: The Linux kernel %define with_ipaclones 0 # no stablelist %define with_kernel_abi_stablelists 0 -# Fedora builds these separately -%define with_perf 1 -%define with_libperf 1 -%define with_tools 1 -%define with_bpftool 1 # No realtime fedora variants %define with_realtime 0 %define with_arm64_64k 0
-- https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2907
From: Scott Weaver on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2907#note_1754559...
I see now that if we want CKI to pass you'll have to rebase. It's missing `0b6eb15a24b2e ('gitlab-ci: merge ark-latest before building in MR pipelines')`. I'm not sure that's really required since we know why clang is failing. If we can get another ack we can just merge it IMHO. @hertonrk-rh or @jstancek could you take a look at this MR when you get time? Thanks!
From: Herton R. Krzesinski on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2907#note_1755476...
Sure I approved it. I think we want to resolve this thread as well. I'll leave that to any of you to resolve it.
kernel@lists.fedoraproject.org