From 64c73a9b3d86be6a7ffbd2a64ec0d1a55c22350a Mon Sep 17 00:00:00 2001 From: Jerome Marchand Date: Mon, 19 May 2025 14:47:15 +0200 Subject: [PATCH] Rebase bcc to version 0.34.0 Rebase bcc to the lastest version. Also fixes the following issue: - Rebase to the latest version (RHEL-78921) - Rebuild with LLVM 20 (RHEL-81772) - Silence warning of trace tools (RHEL-68952) - Fix bpf-runqlen (RHEL-91190) - Fix sslsniff and sofdsnoop (RHEL-58348) - Fix slabratetop (RHEL-58810) - Fix funclatency funcslower and gethostlatency on s390x (RHEL-68947) - Fix bpf-klockstat on aarch64 and ppc64 (RHEL-83001) - Remove unsupported bpf-bcachefs* and bpf-zfs* tools (RHEL-75529) - Fix multiples ppc64 tools (RHEL-58147) Resolves: RHEL-78921 Resolves: RHEL-81772 Resolves: RHEL-68952 Resolves: RHEL-91190 Resolves: RHEL-58348 Resolves: RHEL-58810 Resolves: RHEL-68947 Resolves: RHEL-83001 Resolves: RHEL-75529 Resolves: RHEL-75529 Signed-off-by: Jerome Marchand --- .gitignore | 1 + ...s-fix-alignment-in-tp_args-for-bio-t.patch | 0 ...-0.34.0-Revert-Fix-bashreadline-4903.patch | 0 ...NFIG_CC_IS_CLANG-in-KBuildHelper-get.patch | 43 ++++++++++++ ...oop-Fix-biosnoop-pattern-option-5304.patch | 70 +++++++++++++++++++ bcc.spec | 20 +++++- sources | 2 +- 7 files changed, 133 insertions(+), 3 deletions(-) rename bcc-0.32.0-RHEL-Centos-tools-fix-alignment-in-tp_args-for-bio-t.patch => bcc-0.34.0-RHEL-Centos-tools-fix-alignment-in-tp_args-for-bio-t.patch (100%) rename bcc-0.32.0-Revert-Fix-bashreadline-4903.patch => bcc-0.34.0-Revert-Fix-bashreadline-4903.patch (100%) create mode 100644 bcc-0.34.0-clang-Define-DCONFIG_CC_IS_CLANG-in-KBuildHelper-get.patch create mode 100644 bcc-0.34.0-tools-biosnoop-Fix-biosnoop-pattern-option-5304.patch diff --git a/.gitignore b/.gitignore index 4c49ada..689000a 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,4 @@ /bcc-0.29.1.tar.gz /bcc-0.30.0.tar.gz /bcc-0.32.0.tar.gz +/bcc-0.34.0.tar.gz diff --git a/bcc-0.32.0-RHEL-Centos-tools-fix-alignment-in-tp_args-for-bio-t.patch b/bcc-0.34.0-RHEL-Centos-tools-fix-alignment-in-tp_args-for-bio-t.patch similarity index 100% rename from bcc-0.32.0-RHEL-Centos-tools-fix-alignment-in-tp_args-for-bio-t.patch rename to bcc-0.34.0-RHEL-Centos-tools-fix-alignment-in-tp_args-for-bio-t.patch diff --git a/bcc-0.32.0-Revert-Fix-bashreadline-4903.patch b/bcc-0.34.0-Revert-Fix-bashreadline-4903.patch similarity index 100% rename from bcc-0.32.0-Revert-Fix-bashreadline-4903.patch rename to bcc-0.34.0-Revert-Fix-bashreadline-4903.patch diff --git a/bcc-0.34.0-clang-Define-DCONFIG_CC_IS_CLANG-in-KBuildHelper-get.patch b/bcc-0.34.0-clang-Define-DCONFIG_CC_IS_CLANG-in-KBuildHelper-get.patch new file mode 100644 index 0000000..aed697e --- /dev/null +++ b/bcc-0.34.0-clang-Define-DCONFIG_CC_IS_CLANG-in-KBuildHelper-get.patch @@ -0,0 +1,43 @@ +From 1e2fc8bc2edc48354123633343afd1737b2325df Mon Sep 17 00:00:00 2001 +From: Jerome Marchand +Date: Sun, 18 May 2025 04:17:34 +0200 +Subject: [PATCH 2/2] clang: Define DCONFIG_CC_IS_CLANG in + KBuildHelper::get_flags() (#5172) (#5293) + +On powerpc, many tools fail with an "invalid output constraint '=YZ<>' +in asm" error. This come from the following code in +arch/powerpc/include/asm/asm-compat.h: + +Because CONFIG_CC_IS_CLANG is not defined in the headers, we end up +using a constraint that is not understoog by clang. + +Defining CONFIG_CC_IS_CLANG in KBuildHelper::get_flags() fixes this +error and possibly other similar error. + +Suggested-by: Shung-Hsi Yu +Signed-off-by: Jerome Marchand +--- + src/cc/frontends/clang/kbuild_helper.cc | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/src/cc/frontends/clang/kbuild_helper.cc b/src/cc/frontends/clang/kbuild_helper.cc +index 5d3ad9c2..4f09a398 100644 +--- a/src/cc/frontends/clang/kbuild_helper.cc ++++ b/src/cc/frontends/clang/kbuild_helper.cc +@@ -137,6 +137,13 @@ int KBuildHelper::get_flags(const char *uname_machine, vector *cflags) { + cflags->push_back("-Wno-pointer-sign"); + cflags->push_back("-fno-stack-protector"); + ++ /* ++ * kernel is usually build with gcc and the kernel devel header ++ * reflects that fact. However we build with clang and this must be ++ * set to avoid some compilation errors ++ */ ++ cflags->push_back("-DCONFIG_CC_IS_CLANG"); ++ + return 0; + } + +-- +2.49.0 + diff --git a/bcc-0.34.0-tools-biosnoop-Fix-biosnoop-pattern-option-5304.patch b/bcc-0.34.0-tools-biosnoop-Fix-biosnoop-pattern-option-5304.patch new file mode 100644 index 0000000..0534dcf --- /dev/null +++ b/bcc-0.34.0-tools-biosnoop-Fix-biosnoop-pattern-option-5304.patch @@ -0,0 +1,70 @@ +From c0ab4f7f6ab177cf4a55f59d98c2d4fb9d258106 Mon Sep 17 00:00:00 2001 +From: Jerome Marchand +Date: Sun, 18 May 2025 01:12:30 +0200 +Subject: [PATCH 1/2] tools/biosnoop: Fix biosnoop pattern option (#5304) + +The code to support the block_io tracepoints failed to update some +code that is used with the -P option. That code changed the second +argument of __trace_req_completion from 'req' to 'key', but in the +"#ifdef INCLUDE_PATTERN" block, the use of 'req' remained unchanged. +Of course, 'key' should be use here too. + +Also remove the commented out line of code related to rq_disk. + +It fixes the following error: +$ biosnoop -P +/virtual/main.c:213:24: error: use of undeclared identifier 'req' + 213 | data.pattern = req->__sector == *sector ? SEQUENTIAL : RANDOM; + | ^ +/virtual/main.c:216:19: error: use of undeclared identifier 'req' + 216 | last_sector = req->__sector + data.len / 512; + | ^ +2 errors generated. +Traceback (most recent call last): + File "/usr/share/bcc/tools/biosnoop", line 335, in + b = BPF(text=bpf_text) + File "/usr/lib/python3.13/site-packages/bcc/__init__.py", line 505, in __init__ + raise Exception("Failed to compile BPF module %s" % (src_file or "")) +Exception: Failed to compile BPF module + +Signed-off-by: Jerome Marchand +--- + tools/biosnoop.py | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/tools/biosnoop.py b/tools/biosnoop.py +index d386a7cf..eee10e53 100755 +--- a/tools/biosnoop.py ++++ b/tools/biosnoop.py +@@ -218,7 +218,6 @@ static int __trace_req_completion(void *ctx, struct hash_key key) + struct start_req_t *startp; + struct val_t *valp; + struct data_t data = {}; +- //struct gendisk *rq_disk; + u64 ts; + + // fetch timestamp and calculate delta +@@ -228,7 +227,6 @@ static int __trace_req_completion(void *ctx, struct hash_key key) + return 0; + } + ts = bpf_ktime_get_ns(); +- //rq_disk = req->__RQ_DISK__; + data.delta = ts - startp->ts; + data.ts = ts / 1000; + data.qdelta = 0; +@@ -260,10 +258,10 @@ static int __trace_req_completion(void *ctx, struct hash_key key) + + sector = last_sectors.lookup(§or_key); + if (sector != 0) { +- data.pattern = req->__sector == *sector ? SEQUENTIAL : RANDOM; ++ data.pattern = key.sector == *sector ? SEQUENTIAL : RANDOM; + } + +- last_sector = req->__sector + data.len / 512; ++ last_sector = key.sector + data.len / 512; + last_sectors.update(§or_key, &last_sector); + #endif + +-- +2.49.0 + diff --git a/bcc.spec b/bcc.spec index ea24a90..7f6240e 100644 --- a/bcc.spec +++ b/bcc.spec @@ -24,7 +24,7 @@ Name: bcc -Version: 0.32.0 +Version: 0.34.0 Release: 1%{?dist} Summary: BPF Compiler Collection (BCC) License: Apache-2.0 @@ -32,6 +32,8 @@ URL: https://github.com/iovisor/bcc Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz Patch0: %%{name}-%%{version}-Revert-Fix-bashreadline-4903.patch Patch1: %%{name}-%%{version}-RHEL-Centos-tools-fix-alignment-in-tp_args-for-bio-t.patch +Patch2: %%{name}-%%{version}-tools-biosnoop-Fix-biosnoop-pattern-option-5304.patch +Patch3: %%{name}-%%{version}-clang-Define-DCONFIG_CC_IS_CLANG-in-KBuildHelper-get.patch # Arches will be included as upstream support is added and dependencies are # satisfied in the respective arches @@ -255,13 +257,27 @@ cp -a libbpf-tools/tmp-install/bin/* %{buildroot}/%{_sbindir}/ %ifarch s390x %exclude %{_sbindir}/bpf-numamove %endif -# RHEL doesn't provide btrfs or f2fs +# RHEL doesn't provide btrfs, f2fs, bcachefs or zfs %exclude %{_sbindir}/bpf-btrfs* %exclude %{_sbindir}/bpf-f2fs* +%exclude %{_sbindir}/bpf-bcachefs* +%exclude %{_sbindir}/bpf-zfs* %{_sbindir}/bpf-* %endif %changelog +* Mon May 19 2025 Jerome Marchand - 0.34.0-1 +- Rebase to the latest version (RHEL-78921) +- Rebuild with LLVM 20 (RHEL-81772) +- Silence warning of trace tools (RHEL-68952) +- Fix bpf-runqlen (RHEL-91190) +- Fix sslsniff and sofdsnoop (RHEL-58348) +- Fix slabratetop (RHEL-58810) +- Fix funclatency funcslower and gethostlatency on s390x (RHEL-68947) +- Fix bpf-klockstat on aarch64 and ppc64 (RHEL-83001) +- Remove unsupported bpf-bcachefs* and bpf-zfs* tools (RHEL-75529) +- Fix multiples ppc64 tools (RHEL-58147) + * Tue Jan 14 2025 Jerome Marchand - 0.32.0-1 - Rebase to the latest version (RHEL-63886) diff --git a/sources b/sources index 4a05c93..c410e48 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (bcc-0.32.0.tar.gz) = 3612580976f9c91a52c49bc83abdbaccc9a066c30a7f178997cb91910307e48743d831ec028e0099e776250770b55e8fc8c937bcc9b1e36fbec88370376d1df4 +SHA512 (bcc-0.34.0.tar.gz) = 0bcc00f2f94d2b835a0e421a029d30030324a839070c14da7fe56cd11ce246b7655dae42facb802d79c40325d5b98d5648b34189026c98cdcc6a1f094f795391