import bcc-0.16.0-3.el8
This commit is contained in:
parent
e84e0b70f8
commit
c0796499e8
@ -0,0 +1,39 @@
|
||||
From fe1f2189326a54e3496b2fcfdc1b08839f3165b4 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Rank <dwrank@gmail.com>
|
||||
Date: Sun, 27 Sep 2020 16:55:22 -0700
|
||||
Subject: [PATCH] slabratetop: Add memcg_cache_params struct def
|
||||
|
||||
struct memcg_cache_params moved from include/linux/slab.h to
|
||||
mm/slab.h in kernel v5.4, causing a compiler error when including
|
||||
slub_def.h or slab_def.h in slabratetop's bpf program.
|
||||
|
||||
It has been removed completely from kernel version 5.9.
|
||||
|
||||
Add an empty memcg_cache_params struct in slabratetop's bpf
|
||||
program so it will compile with kernel versions 5.4 to 5.8.
|
||||
---
|
||||
tools/slabratetop.py | 8 +++++++-
|
||||
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tools/slabratetop.py b/tools/slabratetop.py
|
||||
index 066f79d6..182dbd1d 100755
|
||||
--- a/tools/slabratetop.py
|
||||
+++ b/tools/slabratetop.py
|
||||
@@ -62,7 +62,13 @@ loadavg = "/proc/loadavg"
|
||||
bpf_text = """
|
||||
#include <uapi/linux/ptrace.h>
|
||||
#include <linux/mm.h>
|
||||
-#include <linux/slab.h>
|
||||
+
|
||||
+// memcg_cache_params is a part of kmem_cache, but is not publicly exposed in
|
||||
+// kernel versions 5.4 to 5.8. Define an empty struct for it here to allow the
|
||||
+// bpf program to compile. It has been completely removed in kernel version
|
||||
+// 5.9, but it does not hurt to have it here for versions 5.4 to 5.8.
|
||||
+struct memcg_cache_params {};
|
||||
+
|
||||
#ifdef CONFIG_SLUB
|
||||
#include <linux/slub_def.h>
|
||||
#else
|
||||
--
|
||||
2.29.2
|
||||
|
121
SOURCES/bcc-0.16.0-sync-with-libbpf-repo.patch
Normal file
121
SOURCES/bcc-0.16.0-sync-with-libbpf-repo.patch
Normal file
@ -0,0 +1,121 @@
|
||||
From da9ec2b1673ddf6b956304dca6ed6918d89d4631 Mon Sep 17 00:00:00 2001
|
||||
From: Yonghong Song <yhs@fb.com>
|
||||
Date: Sat, 22 Aug 2020 15:19:46 -0700
|
||||
Subject: [PATCH] sync with libbpf repo
|
||||
|
||||
sync with latest libbpf repo.
|
||||
|
||||
Strut definition for btf_ext_header is defined in libbpf/src/btf.h
|
||||
previously and used by bcc. Now, the struct is moved to
|
||||
libbpf/src/libbpf_internal.h and not available to bcc.
|
||||
We do not want to include libbpf/src/libbpf_internal.h as
|
||||
it is really libbpf internal. Let us define bcc version
|
||||
of btf_ext_header with struct name bcc_btf_ext_header.
|
||||
The new name is to avoid conflict when compiling with
|
||||
old libbpf package.
|
||||
|
||||
Signed-off-by: Yonghong Song <yhs@fb.com>
|
||||
---
|
||||
src/cc/bcc_btf.cc | 2 +-
|
||||
src/cc/bcc_btf.h | 17 +++++++++++++++++
|
||||
src/cc/compat/linux/virtual_bpf.h | 17 ++++++++++++-----
|
||||
4 files changed, 31 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/src/cc/bcc_btf.cc b/src/cc/bcc_btf.cc
|
||||
index e220f117..1056950c 100644
|
||||
--- a/src/cc/bcc_btf.cc
|
||||
+++ b/src/cc/bcc_btf.cc
|
||||
@@ -185,7 +185,7 @@ void BTF::adjust(uint8_t *btf_sec, uintptr_t btf_sec_size,
|
||||
}
|
||||
|
||||
struct btf_header *hdr = (struct btf_header *)btf_sec;
|
||||
- struct btf_ext_header *ehdr = (struct btf_ext_header *)btf_ext_sec;
|
||||
+ struct bcc_btf_ext_header *ehdr = (struct bcc_btf_ext_header *)btf_ext_sec;
|
||||
|
||||
// Fixup btf for old kernels or kernel requirements.
|
||||
fixup_btf(btf_sec + hdr->hdr_len + hdr->type_off, hdr->type_len,
|
||||
diff --git a/src/cc/bcc_btf.h b/src/cc/bcc_btf.h
|
||||
index 438c1f73..75b47cc3 100644
|
||||
--- a/src/cc/bcc_btf.h
|
||||
+++ b/src/cc/bcc_btf.h
|
||||
@@ -45,6 +45,23 @@ class BTFStringTable {
|
||||
};
|
||||
|
||||
class BTF {
|
||||
+ struct bcc_btf_ext_header {
|
||||
+ uint16_t magic;
|
||||
+ uint8_t version;
|
||||
+ uint8_t flags;
|
||||
+ uint32_t hdr_len;
|
||||
+
|
||||
+ /* All offsets are in bytes relative to the end of this header */
|
||||
+ uint32_t func_info_off;
|
||||
+ uint32_t func_info_len;
|
||||
+ uint32_t line_info_off;
|
||||
+ uint32_t line_info_len;
|
||||
+
|
||||
+ /* optional part of .BTF.ext header */
|
||||
+ uint32_t core_relo_off;
|
||||
+ uint32_t core_relo_len;
|
||||
+};
|
||||
+
|
||||
public:
|
||||
BTF(bool debug, sec_map_def §ions);
|
||||
~BTF();
|
||||
diff --git a/src/cc/compat/linux/virtual_bpf.h b/src/cc/compat/linux/virtual_bpf.h
|
||||
index 38262630..0387b970 100644
|
||||
--- a/src/cc/compat/linux/virtual_bpf.h
|
||||
+++ b/src/cc/compat/linux/virtual_bpf.h
|
||||
@@ -768,7 +768,7 @@ union bpf_attr {
|
||||
*
|
||||
* Also, note that **bpf_trace_printk**\ () is slow, and should
|
||||
* only be used for debugging purposes. For this reason, a notice
|
||||
- * bloc (spanning several lines) is printed to kernel logs and
|
||||
+ * block (spanning several lines) is printed to kernel logs and
|
||||
* states that the helper should not be used "for production use"
|
||||
* the first time this helper is used (or more precisely, when
|
||||
* **trace_printk**\ () buffers are allocated). For passing values
|
||||
@@ -1034,14 +1034,14 @@ union bpf_attr {
|
||||
*
|
||||
* int ret;
|
||||
* struct bpf_tunnel_key key = {};
|
||||
- *
|
||||
+ *
|
||||
* ret = bpf_skb_get_tunnel_key(skb, &key, sizeof(key), 0);
|
||||
* if (ret < 0)
|
||||
* return TC_ACT_SHOT; // drop packet
|
||||
- *
|
||||
+ *
|
||||
* if (key.remote_ipv4 != 0x0a000001)
|
||||
* return TC_ACT_SHOT; // drop packet
|
||||
- *
|
||||
+ *
|
||||
* return TC_ACT_OK; // accept packet
|
||||
*
|
||||
* This interface can also be used with all encapsulation devices
|
||||
@@ -1148,7 +1148,7 @@ union bpf_attr {
|
||||
* Description
|
||||
* Retrieve the realm or the route, that is to say the
|
||||
* **tclassid** field of the destination for the *skb*. The
|
||||
- * indentifier retrieved is a user-provided tag, similar to the
|
||||
+ * identifier retrieved is a user-provided tag, similar to the
|
||||
* one used with the net_cls cgroup (see description for
|
||||
* **bpf_get_cgroup_classid**\ () helper), but here this tag is
|
||||
* held by a route (a destination entry), not by a task.
|
||||
@@ -4072,6 +4072,13 @@ struct bpf_link_info {
|
||||
__u64 cgroup_id;
|
||||
__u32 attach_type;
|
||||
} cgroup;
|
||||
+ struct {
|
||||
+ __aligned_u64 target_name; /* in/out: target_name buffer ptr */
|
||||
+ __u32 target_name_len; /* in/out: target_name buffer len */
|
||||
+ union {
|
||||
+ __u32 map_id;
|
||||
+ } map;
|
||||
+ } iter;
|
||||
struct {
|
||||
__u32 netns_ino;
|
||||
__u32 attach_type;
|
||||
--
|
||||
2.29.2
|
||||
|
@ -0,0 +1,42 @@
|
||||
From 33393d3008969e43d26f0e4b3e71198130f9f44d Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Marchand <jmarchan@redhat.com>
|
||||
Date: Thu, 18 Feb 2021 11:33:20 +0100
|
||||
Subject: [PATCH] tools: include kasan header in slabtoprate
|
||||
|
||||
slabtoprate fails on 5.10 kernels because of a missing kasan_reset_tag
|
||||
declaration. We need to include the kasan header file.
|
||||
|
||||
Fixes the following error:
|
||||
In file included from /virtual/main.c:12:
|
||||
include/linux/slub_def.h:181:27: warning: implicit declaration of function 'kasan_reset_tag' is invalid in C99 [-Wimplicit-function-declaration]
|
||||
return reciprocal_divide(kasan_reset_tag(obj) - addr,
|
||||
^
|
||||
include/linux/slub_def.h:181:48: error: invalid operands to binary expression ('int' and 'void *')
|
||||
return reciprocal_divide(kasan_reset_tag(obj) - addr,
|
||||
~~~~~~~~~~~~~~~~~~~~ ^ ~~~~
|
||||
1 warning and 1 error generated.
|
||||
Traceback (most recent call last):
|
||||
File "/usr/share/bcc/tools/slabratetop", line 115, in <module>
|
||||
b = BPF(text=bpf_text)
|
||||
File "/usr/lib/python3.9/site-packages/bcc/__init__.py", line 364, in __init__
|
||||
raise Exception("Failed to compile BPF module %s" % (src_file or "<text>"))
|
||||
Exception: Failed to compile BPF module <text>
|
||||
---
|
||||
tools/slabratetop.py | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/tools/slabratetop.py b/tools/slabratetop.py
|
||||
index 182dbd1d..75280c6d 100755
|
||||
--- a/tools/slabratetop.py
|
||||
+++ b/tools/slabratetop.py
|
||||
@@ -62,6 +62,7 @@ loadavg = "/proc/loadavg"
|
||||
bpf_text = """
|
||||
#include <uapi/linux/ptrace.h>
|
||||
#include <linux/mm.h>
|
||||
+#include <linux/kasan.h>
|
||||
|
||||
// memcg_cache_params is a part of kmem_cache, but is not publicly exposed in
|
||||
// kernel versions 5.4 to 5.8. Define an empty struct for it here to allow the
|
||||
--
|
||||
2.29.2
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
Name: bcc
|
||||
Version: 0.16.0
|
||||
Release: 2%{?dist}
|
||||
Release: 3%{?dist}
|
||||
Summary: BPF Compiler Collection (BCC)
|
||||
License: ASL 2.0
|
||||
URL: https://github.com/iovisor/bcc
|
||||
@ -18,6 +18,9 @@ Source0: %{url}/releases/download/v%{version}/%{name}-src-with-submodule.
|
||||
#Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
|
||||
Patch0: %{name}-%{version}-Manpages-remove-unstable-statement.patch
|
||||
Patch1: %{name}-%{version}-tools-tcptracer-fix-alignement-in-tcp_ipv6_event_t.patch
|
||||
Patch2: %{name}-%{version}-sync-with-libbpf-repo.patch
|
||||
Patch3: %{name}-%{version}-slabratetop-Add-memcg_cache_params-struct-def.patch
|
||||
Patch4: %{name}-%{version}-tools-include-kasan-header-in-slabtoprate.patch
|
||||
|
||||
# Arches will be included as upstream support is added and dependencies are
|
||||
# satisfied in the respective arches
|
||||
@ -215,6 +218,10 @@ done
|
||||
|
||||
|
||||
%changelog
|
||||
* Mon Feb 22 2021 Jerome Marchand <jmarchan@redhat.com> - 0.16.0-3
|
||||
- Fix slabratetop header issues
|
||||
- Rebuild with latest libbpf
|
||||
|
||||
* Fri Jan 22 2021 Jerome Marchand <jmarchan@redhat.com> - 0.16.0-2
|
||||
- Build with libbpf package
|
||||
- spec file cleanups
|
||||
|
Loading…
Reference in New Issue
Block a user