Misc fixes and enhancements
- Fix libbpf bio tools (RHEL-19368) - Add S390x support to libbpf-tools (RHEL-16325) - Power enhancements(RHEL-11477) Resolves: RHEL-19368 Resolves: RHEL-16325 Resolves: RHEL-11477 Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
This commit is contained in:
parent
13267d0b98
commit
9b78702a51
66
bcc-0.28.0-Adding-memory-zones-for-Power-server.patch
Normal file
66
bcc-0.28.0-Adding-memory-zones-for-Power-server.patch
Normal file
@ -0,0 +1,66 @@
|
||||
From 63808fbdcb70ce2e858db0a42e7e3eeec153d5b6 Mon Sep 17 00:00:00 2001
|
||||
From: Abhishek Dubey <adubey@linux.ibm.com>
|
||||
Date: Wed, 20 Sep 2023 10:37:38 -0400
|
||||
Subject: [PATCH 4/4] Adding memory zones for Power server
|
||||
|
||||
config PPC_BOOK3S_64 skips setting ZONE_DMA for
|
||||
server processor. NORMAL and MOVABLE zones are
|
||||
available on Power.
|
||||
|
||||
Signed-off-by: Abhishek Dubey <adubey@linux.ibm.com>
|
||||
---
|
||||
tools/compactsnoop.py | 28 +++++++++++++++++++---------
|
||||
1 file changed, 19 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/tools/compactsnoop.py b/tools/compactsnoop.py
|
||||
index 2b395dec..1a476aad 100755
|
||||
--- a/tools/compactsnoop.py
|
||||
+++ b/tools/compactsnoop.py
|
||||
@@ -260,11 +260,12 @@ TRACEPOINT_PROBE(compaction, mm_compaction_end)
|
||||
}
|
||||
"""
|
||||
|
||||
-if platform.machine() != 'x86_64':
|
||||
+if platform.machine() != 'x86_64' and platform.machine() != 'ppc64le':
|
||||
print("""
|
||||
- Currently only support x86_64 servers, if you want to use it on
|
||||
- other platforms, please refer include/linux/mmzone.h to modify
|
||||
- zone_idex_to_str to get the right zone type
|
||||
+ Currently only support x86_64 and power servers, if you want
|
||||
+ to use it on other platforms(including power embedded processors),
|
||||
+ please refer include/linux/mmzone.h to modify zone_idex_to_str to
|
||||
+ get the right zone type
|
||||
""")
|
||||
exit()
|
||||
|
||||
@@ -296,13 +297,22 @@ initial_ts = 0
|
||||
# from include/linux/mmzone.h
|
||||
# NOTICE: consider only x86_64 servers
|
||||
zone_type = {
|
||||
- 0: "ZONE_DMA",
|
||||
- 1: "ZONE_DMA32",
|
||||
- 2: "ZONE_NORMAL",
|
||||
+ 'x86_64':
|
||||
+ {
|
||||
+ 0: "ZONE_DMA",
|
||||
+ 1: "ZONE_DMA32",
|
||||
+ 2: "ZONE_NORMAL"
|
||||
+ },
|
||||
+ # Zones in Power server only
|
||||
+ 'ppc64le':
|
||||
+ {
|
||||
+ 0: "ZONE_NORMAL",
|
||||
+ 1: "ZONE_MOVABLE"
|
||||
+ }
|
||||
}
|
||||
|
||||
- if idx in zone_type:
|
||||
- return zone_type[idx]
|
||||
+ if idx in zone_type[platform.machine()]:
|
||||
+ return zone_type[platform.machine()][idx]
|
||||
else:
|
||||
return str(idx)
|
||||
|
||||
--
|
||||
2.43.0
|
||||
|
45
bcc-0.28.0-Fixing-pvalloc-memleak-test.patch
Normal file
45
bcc-0.28.0-Fixing-pvalloc-memleak-test.patch
Normal file
@ -0,0 +1,45 @@
|
||||
From e6493835a28c08c45fd374e70dba7aa66f700d08 Mon Sep 17 00:00:00 2001
|
||||
From: Abhishek Dubey <adubey@linux.ibm.com>
|
||||
Date: Tue, 14 Nov 2023 03:54:19 -0500
|
||||
Subject: [PATCH 2/4] Fixing pvalloc memleak test
|
||||
|
||||
Request to allocate 30K bytes using pvalloc(), results
|
||||
in allocating 3*64Kb(on 64Kb pagesize system). The assertion
|
||||
expects leak to be 30Kb, whereas leaked memory is much more
|
||||
due to pvalloc's implementation for power.
|
||||
|
||||
Signed-off-by: Abhishek Dubey <adubey@linux.ibm.com>
|
||||
---
|
||||
tests/python/test_tools_memleak.py | 9 ++++++++-
|
||||
1 file changed, 8 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tests/python/test_tools_memleak.py b/tests/python/test_tools_memleak.py
|
||||
index cae7e35d..4e921a0c 100755
|
||||
--- a/tests/python/test_tools_memleak.py
|
||||
+++ b/tests/python/test_tools_memleak.py
|
||||
@@ -3,6 +3,7 @@
|
||||
from unittest import main, skipUnless, TestCase
|
||||
from utils import kernel_version_ge
|
||||
import os
|
||||
+import platform
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
@@ -102,7 +103,13 @@ TOOLS_DIR = "/bcc/tools/"
|
||||
self.assertEqual(cfg.leaking_amount, self.run_leaker("memalign"))
|
||||
|
||||
def test_pvalloc(self):
|
||||
- self.assertEqual(cfg.leaking_amount, self.run_leaker("pvalloc"))
|
||||
+ # pvalloc's implementation for power invokes mmap(), which adjusts the
|
||||
+ # allocated size to meet pvalloc's constraints. Actual leaked memory
|
||||
+ # could be more than requested, hence assertLessEqual.
|
||||
+ if platform.machine() == 'ppc64le':
|
||||
+ self.assertLessEqual(cfg.leaking_amount, self.run_leaker("pvalloc"))
|
||||
+ else:
|
||||
+ self.assertEqual(cfg.leaking_amount, self.run_leaker("pvalloc"))
|
||||
|
||||
def test_aligned_alloc(self):
|
||||
self.assertEqual(cfg.leaking_amount, self.run_leaker("aligned_alloc"))
|
||||
--
|
||||
2.43.0
|
||||
|
41
bcc-0.28.0-Skipping-USDT-tests-for-Power-processor.patch
Normal file
41
bcc-0.28.0-Skipping-USDT-tests-for-Power-processor.patch
Normal file
@ -0,0 +1,41 @@
|
||||
From a5d86850e3bfeaa23ef4c82dccb9288a2cd42a27 Mon Sep 17 00:00:00 2001
|
||||
From: Abhishek Dubey <adubey@linux.ibm.com>
|
||||
Date: Mon, 11 Sep 2023 05:10:36 -0400
|
||||
Subject: [PATCH 3/4] Skipping USDT tests for Power processor
|
||||
|
||||
Support for Power processor in folly package is absent,
|
||||
so skipping USDT tests having dependency on folly.
|
||||
|
||||
Signed-off-by: Abhishek Dubey <adubey@linux.ibm.com>
|
||||
---
|
||||
tests/python/CMakeLists.txt | 14 ++++++++------
|
||||
1 file changed, 8 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/tests/python/CMakeLists.txt b/tests/python/CMakeLists.txt
|
||||
index a42a16ce..81a547f0 100644
|
||||
--- a/tests/python/CMakeLists.txt
|
||||
+++ b/tests/python/CMakeLists.txt
|
||||
@@ -71,12 +71,14 @@ add_test(NAME py_test_tools_smoke WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMAND ${TEST_WRAPPER} py_test_tools_smoke sudo ${CMAKE_CURRENT_SOURCE_DIR}/test_tools_smoke.py)
|
||||
add_test(NAME py_test_tools_memleak WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMAND ${TEST_WRAPPER} py_test_tools_memleak sudo ${CMAKE_CURRENT_SOURCE_DIR}/test_tools_memleak.py)
|
||||
-add_test(NAME py_test_usdt WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
- COMMAND ${TEST_WRAPPER} py_test_usdt sudo ${CMAKE_CURRENT_SOURCE_DIR}/test_usdt.py)
|
||||
-add_test(NAME py_test_usdt2 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
- COMMAND ${TEST_WRAPPER} py_test_usdt2 sudo ${CMAKE_CURRENT_SOURCE_DIR}/test_usdt2.py)
|
||||
-add_test(NAME py_test_usdt3 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
- COMMAND ${TEST_WRAPPER} py_test_usdt3 sudo ${CMAKE_CURRENT_SOURCE_DIR}/test_usdt3.py)
|
||||
+if(NOT(CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64le" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64"))
|
||||
+ add_test(NAME py_test_usdt WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
+ COMMAND ${TEST_WRAPPER} py_test_usdt sudo ${CMAKE_CURRENT_SOURCE_DIR}/test_usdt.py)
|
||||
+ add_test(NAME py_test_usdt2 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
+ COMMAND ${TEST_WRAPPER} py_test_usdt2 sudo ${CMAKE_CURRENT_SOURCE_DIR}/test_usdt2.py)
|
||||
+ add_test(NAME py_test_usdt3 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
+ COMMAND ${TEST_WRAPPER} py_test_usdt3 sudo ${CMAKE_CURRENT_SOURCE_DIR}/test_usdt3.py)
|
||||
+endif()
|
||||
add_test(NAME py_test_license WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMAND ${TEST_WRAPPER} py_test_license sudo ${CMAKE_CURRENT_SOURCE_DIR}/test_license.py)
|
||||
add_test(NAME py_test_free_bcc_memory WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
--
|
||||
2.43.0
|
||||
|
120974
bcc-0.28.0-libbpf-tools-Add-s390x-support.patch
Normal file
120974
bcc-0.28.0-libbpf-tools-Add-s390x-support.patch
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,476 @@
|
||||
From 60860bf3a400dcf72b4026fb2973803cfb12ccf1 Mon Sep 17 00:00:00 2001
|
||||
From: mickey_zhu <mickey_zhu@realsil.com.cn>
|
||||
Date: Tue, 27 Jun 2023 16:32:44 +0800
|
||||
Subject: [PATCH] libbpf-tools: add block_io_{start,done} tracepoints support
|
||||
to bio tools
|
||||
|
||||
Some bio tools fail to kprobe blk_account_io_{start,done} after v5.17,
|
||||
because they become inlined, see [0]. To fix this issue, tracepoints
|
||||
blick_io_{start,done} are introcuded in kernel, see[1].
|
||||
|
||||
Update related bio tools to support new tracepoints, and also simplify
|
||||
attach.
|
||||
|
||||
[0] Kernel commit 450b7879e345 (block: move blk_account_io_{start,done} to blk-mq.c)
|
||||
[1] Kernel commit 5a80bd075f3b (block: introduce block_io_start/block_io_done tracepoints)
|
||||
|
||||
Change-Id: I62b957abd7ce2901eb114bd57c78938e4f083e4d
|
||||
Signed-off-by: Mickey Zhu <mickey_zhu@realsil.com.cn>
|
||||
---
|
||||
libbpf-tools/biosnoop.bpf.c | 9 ++++
|
||||
libbpf-tools/biosnoop.c | 78 +++++++++++++--------------------
|
||||
libbpf-tools/biostacks.bpf.c | 46 +++++++++++++------
|
||||
libbpf-tools/biostacks.c | 85 +++++++++++++++++++++---------------
|
||||
libbpf-tools/biotop.bpf.c | 44 +++++++++++++++++--
|
||||
libbpf-tools/biotop.c | 59 ++++++++++++++++---------
|
||||
6 files changed, 199 insertions(+), 122 deletions(-)
|
||||
|
||||
diff --git a/libbpf-tools/biosnoop.bpf.c b/libbpf-tools/biosnoop.bpf.c
|
||||
index b791555f..fcc5c5ce 100644
|
||||
--- a/libbpf-tools/biosnoop.bpf.c
|
||||
+++ b/libbpf-tools/biosnoop.bpf.c
|
||||
@@ -76,6 +76,15 @@ int BPF_PROG(blk_account_io_start, struct request *rq)
|
||||
return trace_pid(rq);
|
||||
}
|
||||
|
||||
+SEC("tp_btf/block_io_start")
|
||||
+int BPF_PROG(block_io_start, struct request *rq)
|
||||
+{
|
||||
+ if (filter_cg && !bpf_current_task_under_cgroup(&cgroup_map, 0))
|
||||
+ return 0;
|
||||
+
|
||||
+ return trace_pid(rq);
|
||||
+}
|
||||
+
|
||||
SEC("kprobe/blk_account_io_merge_bio")
|
||||
int BPF_KPROBE(blk_account_io_merge_bio, struct request *rq)
|
||||
{
|
||||
diff --git a/libbpf-tools/biosnoop.c b/libbpf-tools/biosnoop.c
|
||||
index 21773729..f9468900 100644
|
||||
--- a/libbpf-tools/biosnoop.c
|
||||
+++ b/libbpf-tools/biosnoop.c
|
||||
@@ -212,6 +212,16 @@ void handle_lost_events(void *ctx, int cpu, __u64 lost_cnt)
|
||||
fprintf(stderr, "lost %llu events on CPU #%d\n", lost_cnt, cpu);
|
||||
}
|
||||
|
||||
+static void blk_account_io_set_attach_target(struct biosnoop_bpf *obj)
|
||||
+{
|
||||
+ if (fentry_can_attach("blk_account_io_start", NULL))
|
||||
+ bpf_program__set_attach_target(obj->progs.blk_account_io_start,
|
||||
+ 0, "blk_account_io_start");
|
||||
+ else
|
||||
+ bpf_program__set_attach_target(obj->progs.blk_account_io_start,
|
||||
+ 0, "__blk_account_io_start");
|
||||
+}
|
||||
+
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
const struct partition *partition;
|
||||
@@ -260,12 +270,23 @@ int main(int argc, char **argv)
|
||||
obj->rodata->filter_cg = env.cg;
|
||||
obj->rodata->min_ns = env.min_lat_ms * 1000000;
|
||||
|
||||
- if (fentry_can_attach("blk_account_io_start", NULL))
|
||||
- bpf_program__set_attach_target(obj->progs.blk_account_io_start, 0,
|
||||
- "blk_account_io_start");
|
||||
- else
|
||||
- bpf_program__set_attach_target(obj->progs.blk_account_io_start, 0,
|
||||
- "__blk_account_io_start");
|
||||
+ if (tracepoint_exists("block", "block_io_start"))
|
||||
+ bpf_program__set_autoload(obj->progs.blk_account_io_start, false);
|
||||
+ else {
|
||||
+ bpf_program__set_autoload(obj->progs.block_io_start, false);
|
||||
+ blk_account_io_set_attach_target(obj);
|
||||
+ }
|
||||
+
|
||||
+ ksyms = ksyms__load();
|
||||
+ if (!ksyms) {
|
||||
+ fprintf(stderr, "failed to load kallsyms\n");
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+ if (!ksyms__get_symbol(ksyms, "blk_account_io_merge_bio"))
|
||||
+ bpf_program__set_autoload(obj->progs.blk_account_io_merge_bio, false);
|
||||
+
|
||||
+ if (!env.queued)
|
||||
+ bpf_program__set_autoload(obj->progs.block_rq_insert, false);
|
||||
|
||||
err = biosnoop_bpf__load(obj);
|
||||
if (err) {
|
||||
@@ -288,48 +309,9 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
- obj->links.blk_account_io_start = bpf_program__attach(obj->progs.blk_account_io_start);
|
||||
- if (!obj->links.blk_account_io_start) {
|
||||
- err = -errno;
|
||||
- fprintf(stderr, "failed to attach blk_account_io_start: %s\n",
|
||||
- strerror(-err));
|
||||
- goto cleanup;
|
||||
- }
|
||||
- ksyms = ksyms__load();
|
||||
- if (!ksyms) {
|
||||
- err = -ENOMEM;
|
||||
- fprintf(stderr, "failed to load kallsyms\n");
|
||||
- goto cleanup;
|
||||
- }
|
||||
- if (ksyms__get_symbol(ksyms, "blk_account_io_merge_bio")) {
|
||||
- obj->links.blk_account_io_merge_bio =
|
||||
- bpf_program__attach(obj->progs.blk_account_io_merge_bio);
|
||||
- if (!obj->links.blk_account_io_merge_bio) {
|
||||
- err = -errno;
|
||||
- fprintf(stderr, "failed to attach blk_account_io_merge_bio: %s\n",
|
||||
- strerror(-err));
|
||||
- goto cleanup;
|
||||
- }
|
||||
- }
|
||||
- if (env.queued) {
|
||||
- obj->links.block_rq_insert =
|
||||
- bpf_program__attach(obj->progs.block_rq_insert);
|
||||
- if (!obj->links.block_rq_insert) {
|
||||
- err = -errno;
|
||||
- fprintf(stderr, "failed to attach block_rq_insert: %s\n", strerror(-err));
|
||||
- goto cleanup;
|
||||
- }
|
||||
- }
|
||||
- obj->links.block_rq_issue = bpf_program__attach(obj->progs.block_rq_issue);
|
||||
- if (!obj->links.block_rq_issue) {
|
||||
- err = -errno;
|
||||
- fprintf(stderr, "failed to attach block_rq_issue: %s\n", strerror(-err));
|
||||
- goto cleanup;
|
||||
- }
|
||||
- obj->links.block_rq_complete = bpf_program__attach(obj->progs.block_rq_complete);
|
||||
- if (!obj->links.block_rq_complete) {
|
||||
- err = -errno;
|
||||
- fprintf(stderr, "failed to attach block_rq_complete: %s\n", strerror(-err));
|
||||
+ err = biosnoop_bpf__attach(obj);
|
||||
+ if (err) {
|
||||
+ fprintf(stderr, "failed to attach BPF programs: %d\n", err);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
diff --git a/libbpf-tools/biostacks.bpf.c b/libbpf-tools/biostacks.bpf.c
|
||||
index c3950910..0ca69880 100644
|
||||
--- a/libbpf-tools/biostacks.bpf.c
|
||||
+++ b/libbpf-tools/biostacks.bpf.c
|
||||
@@ -67,20 +67,8 @@ int trace_start(void *ctx, struct request *rq, bool merge_bio)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-SEC("fentry/blk_account_io_start")
|
||||
-int BPF_PROG(blk_account_io_start, struct request *rq)
|
||||
-{
|
||||
- return trace_start(ctx, rq, false);
|
||||
-}
|
||||
-
|
||||
-SEC("kprobe/blk_account_io_merge_bio")
|
||||
-int BPF_KPROBE(blk_account_io_merge_bio, struct request *rq)
|
||||
-{
|
||||
- return trace_start(ctx, rq, true);
|
||||
-}
|
||||
-
|
||||
-SEC("fentry/blk_account_io_done")
|
||||
-int BPF_PROG(blk_account_io_done, struct request *rq)
|
||||
+static __always_inline
|
||||
+int trace_done(void *ctx, struct request *rq)
|
||||
{
|
||||
u64 slot, ts = bpf_ktime_get_ns();
|
||||
struct internal_rqinfo *i_rqinfop;
|
||||
@@ -110,4 +98,34 @@ int BPF_PROG(blk_account_io_done, struct request *rq)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+SEC("kprobe/blk_account_io_merge_bio")
|
||||
+int BPF_KPROBE(blk_account_io_merge_bio, struct request *rq)
|
||||
+{
|
||||
+ return trace_start(ctx, rq, true);
|
||||
+}
|
||||
+
|
||||
+SEC("fentry/blk_account_io_start")
|
||||
+int BPF_PROG(blk_account_io_start, struct request *rq)
|
||||
+{
|
||||
+ return trace_start(ctx, rq, false);
|
||||
+}
|
||||
+
|
||||
+SEC("fentry/blk_account_io_done")
|
||||
+int BPF_PROG(blk_account_io_done, struct request *rq)
|
||||
+{
|
||||
+ return trace_done(ctx, rq);
|
||||
+}
|
||||
+
|
||||
+SEC("tp_btf/block_io_start")
|
||||
+int BPF_PROG(block_io_start, struct request *rq)
|
||||
+{
|
||||
+ return trace_start(ctx, rq, false);
|
||||
+}
|
||||
+
|
||||
+SEC("tp_btf/block_io_done")
|
||||
+int BPF_PROG(block_io_done, struct request *rq)
|
||||
+{
|
||||
+ return trace_done(ctx, rq);
|
||||
+}
|
||||
+
|
||||
char LICENSE[] SEC("license") = "GPL";
|
||||
diff --git a/libbpf-tools/biostacks.c b/libbpf-tools/biostacks.c
|
||||
index e1878d1f..e7875f76 100644
|
||||
--- a/libbpf-tools/biostacks.c
|
||||
+++ b/libbpf-tools/biostacks.c
|
||||
@@ -128,6 +128,39 @@ void print_map(struct ksyms *ksyms, struct partitions *partitions, int fd)
|
||||
return;
|
||||
}
|
||||
|
||||
+static bool has_block_io_tracepoints(void)
|
||||
+{
|
||||
+ return tracepoint_exists("block", "block_io_start") &&
|
||||
+ tracepoint_exists("block", "block_io_done");
|
||||
+}
|
||||
+
|
||||
+static void disable_block_io_tracepoints(struct biostacks_bpf *obj)
|
||||
+{
|
||||
+ bpf_program__set_autoload(obj->progs.block_io_start, false);
|
||||
+ bpf_program__set_autoload(obj->progs.block_io_done, false);
|
||||
+}
|
||||
+
|
||||
+static void disable_blk_account_io_fentry(struct biostacks_bpf *obj)
|
||||
+{
|
||||
+ bpf_program__set_autoload(obj->progs.blk_account_io_start, false);
|
||||
+ bpf_program__set_autoload(obj->progs.blk_account_io_done, false);
|
||||
+}
|
||||
+
|
||||
+static void blk_account_io_set_attach_target(struct biostacks_bpf *obj)
|
||||
+{
|
||||
+ if (fentry_can_attach("blk_account_io_start", NULL)) {
|
||||
+ bpf_program__set_attach_target(obj->progs.blk_account_io_start,
|
||||
+ 0, "blk_account_io_start");
|
||||
+ bpf_program__set_attach_target(obj->progs.blk_account_io_done,
|
||||
+ 0, "blk_account_io_done");
|
||||
+ } else {
|
||||
+ bpf_program__set_attach_target(obj->progs.blk_account_io_start,
|
||||
+ 0, "__blk_account_io_start");
|
||||
+ bpf_program__set_attach_target(obj->progs.blk_account_io_done,
|
||||
+ 0, "__blk_account_io_done");
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct partitions *partitions = NULL;
|
||||
@@ -172,50 +205,30 @@ int main(int argc, char **argv)
|
||||
|
||||
obj->rodata->targ_ms = env.milliseconds;
|
||||
|
||||
- if (fentry_can_attach("blk_account_io_start", NULL)) {
|
||||
- bpf_program__set_attach_target(obj->progs.blk_account_io_start, 0,
|
||||
- "blk_account_io_start");
|
||||
- bpf_program__set_attach_target(obj->progs.blk_account_io_done, 0,
|
||||
- "blk_account_io_done");
|
||||
- } else {
|
||||
- bpf_program__set_attach_target(obj->progs.blk_account_io_start, 0,
|
||||
- "__blk_account_io_start");
|
||||
- bpf_program__set_attach_target(obj->progs.blk_account_io_done, 0,
|
||||
- "__blk_account_io_done");
|
||||
- }
|
||||
-
|
||||
- err = biostacks_bpf__load(obj);
|
||||
- if (err) {
|
||||
- fprintf(stderr, "failed to load BPF object: %d\n", err);
|
||||
- goto cleanup;
|
||||
+ if (has_block_io_tracepoints())
|
||||
+ disable_blk_account_io_fentry(obj);
|
||||
+ else {
|
||||
+ disable_block_io_tracepoints(obj);
|
||||
+ blk_account_io_set_attach_target(obj);
|
||||
}
|
||||
|
||||
- obj->links.blk_account_io_start = bpf_program__attach(obj->progs.blk_account_io_start);
|
||||
- if (!obj->links.blk_account_io_start) {
|
||||
- err = -errno;
|
||||
- fprintf(stderr, "failed to attach blk_account_io_start: %s\n", strerror(-err));
|
||||
- goto cleanup;
|
||||
- }
|
||||
ksyms = ksyms__load();
|
||||
if (!ksyms) {
|
||||
fprintf(stderr, "failed to load kallsyms\n");
|
||||
goto cleanup;
|
||||
}
|
||||
- if (ksyms__get_symbol(ksyms, "blk_account_io_merge_bio")) {
|
||||
- obj->links.blk_account_io_merge_bio =
|
||||
- bpf_program__attach(obj->progs.blk_account_io_merge_bio);
|
||||
- if (!obj->links.blk_account_io_merge_bio) {
|
||||
- err = -errno;
|
||||
- fprintf(stderr, "failed to attach blk_account_io_merge_bio: %s\n",
|
||||
- strerror(-err));
|
||||
- goto cleanup;
|
||||
- }
|
||||
+ if (!ksyms__get_symbol(ksyms, "blk_account_io_merge_bio"))
|
||||
+ bpf_program__set_autoload(obj->progs.blk_account_io_merge_bio, false);
|
||||
+
|
||||
+ err = biostacks_bpf__load(obj);
|
||||
+ if (err) {
|
||||
+ fprintf(stderr, "failed to load BPF object: %d\n", err);
|
||||
+ goto cleanup;
|
||||
}
|
||||
- obj->links.blk_account_io_done = bpf_program__attach(obj->progs.blk_account_io_done);
|
||||
- if (!obj->links.blk_account_io_done) {
|
||||
- err = -errno;
|
||||
- fprintf(stderr, "failed to attach blk_account_io_done: %s\n",
|
||||
- strerror(-err));
|
||||
+
|
||||
+ err = biostacks_bpf__attach(obj);
|
||||
+ if (err) {
|
||||
+ fprintf(stderr, "failed to attach BPF programs: %d\n", err);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
diff --git a/libbpf-tools/biotop.bpf.c b/libbpf-tools/biotop.bpf.c
|
||||
index 226e32d3..07631378 100644
|
||||
--- a/libbpf-tools/biotop.bpf.c
|
||||
+++ b/libbpf-tools/biotop.bpf.c
|
||||
@@ -30,8 +30,8 @@ struct {
|
||||
__type(value, struct val_t);
|
||||
} counts SEC(".maps");
|
||||
|
||||
-SEC("kprobe")
|
||||
-int BPF_KPROBE(blk_account_io_start, struct request *req)
|
||||
+static __always_inline
|
||||
+int trace_start(struct request *req)
|
||||
{
|
||||
struct who_t who = {};
|
||||
|
||||
@@ -56,8 +56,8 @@ int BPF_KPROBE(blk_mq_start_request, struct request *req)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-SEC("kprobe")
|
||||
-int BPF_KPROBE(blk_account_io_done, struct request *req, u64 now)
|
||||
+static __always_inline
|
||||
+int trace_done(struct request *req)
|
||||
{
|
||||
struct val_t *valp, zero = {};
|
||||
struct info_t info = {};
|
||||
@@ -103,4 +103,40 @@ int BPF_KPROBE(blk_account_io_done, struct request *req, u64 now)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+SEC("kprobe/blk_account_io_start")
|
||||
+int BPF_KPROBE(blk_account_io_start, struct request *req)
|
||||
+{
|
||||
+ return trace_start(req);
|
||||
+}
|
||||
+
|
||||
+SEC("kprobe/blk_account_io_done")
|
||||
+int BPF_KPROBE(blk_account_io_done, struct request *req)
|
||||
+{
|
||||
+ return trace_done(req);
|
||||
+}
|
||||
+
|
||||
+SEC("kprobe/__blk_account_io_start")
|
||||
+int BPF_KPROBE(__blk_account_io_start, struct request *req)
|
||||
+{
|
||||
+ return trace_start(req);
|
||||
+}
|
||||
+
|
||||
+SEC("kprobe/__blk_account_io_done")
|
||||
+int BPF_KPROBE(__blk_account_io_done, struct request *req)
|
||||
+{
|
||||
+ return trace_done(req);
|
||||
+}
|
||||
+
|
||||
+SEC("tp_btf/block_io_start")
|
||||
+int BPF_PROG(block_io_start, struct request *req)
|
||||
+{
|
||||
+ return trace_start(req);
|
||||
+}
|
||||
+
|
||||
+SEC("tp_btf/block_io_done")
|
||||
+int BPF_PROG(block_io_done, struct request *req)
|
||||
+{
|
||||
+ return trace_done(req);
|
||||
+}
|
||||
+
|
||||
char LICENSE[] SEC("license") = "GPL";
|
||||
diff --git a/libbpf-tools/biotop.c b/libbpf-tools/biotop.c
|
||||
index 75484281..5b3a7cf3 100644
|
||||
--- a/libbpf-tools/biotop.c
|
||||
+++ b/libbpf-tools/biotop.c
|
||||
@@ -354,6 +354,38 @@ static int print_stat(struct biotop_bpf *obj)
|
||||
return err;
|
||||
}
|
||||
|
||||
+static bool has_block_io_tracepoints(void)
|
||||
+{
|
||||
+ return tracepoint_exists("block", "block_io_start") &&
|
||||
+ tracepoint_exists("block", "block_io_done");
|
||||
+}
|
||||
+
|
||||
+static void disable_block_io_tracepoints(struct biotop_bpf *obj)
|
||||
+{
|
||||
+ bpf_program__set_autoload(obj->progs.block_io_start, false);
|
||||
+ bpf_program__set_autoload(obj->progs.block_io_done, false);
|
||||
+}
|
||||
+
|
||||
+static void disable_blk_account_io_kprobes(struct biotop_bpf *obj)
|
||||
+{
|
||||
+ bpf_program__set_autoload(obj->progs.blk_account_io_start, false);
|
||||
+ bpf_program__set_autoload(obj->progs.blk_account_io_done, false);
|
||||
+ bpf_program__set_autoload(obj->progs.__blk_account_io_start, false);
|
||||
+ bpf_program__set_autoload(obj->progs.__blk_account_io_done, false);
|
||||
+}
|
||||
+
|
||||
+static void blk_account_io_set_autoload(struct biotop_bpf *obj,
|
||||
+ struct ksyms *ksyms)
|
||||
+{
|
||||
+ if (!ksyms__get_symbol(ksyms, "__blk_account_io_start")) {
|
||||
+ bpf_program__set_autoload(obj->progs.__blk_account_io_start, false);
|
||||
+ bpf_program__set_autoload(obj->progs.__blk_account_io_done, false);
|
||||
+ } else {
|
||||
+ bpf_program__set_autoload(obj->progs.blk_account_io_start, false);
|
||||
+ bpf_program__set_autoload(obj->progs.blk_account_io_done, false);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
static const struct argp argp = {
|
||||
@@ -386,32 +418,19 @@ int main(int argc, char **argv)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
+ if (has_block_io_tracepoints())
|
||||
+ disable_blk_account_io_kprobes(obj);
|
||||
+ else {
|
||||
+ disable_block_io_tracepoints(obj);
|
||||
+ blk_account_io_set_autoload(obj, ksyms);
|
||||
+ }
|
||||
+
|
||||
err = biotop_bpf__load(obj);
|
||||
if (err) {
|
||||
warn("failed to load BPF object: %d\n", err);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
- if (ksyms__get_symbol(ksyms, "__blk_account_io_start"))
|
||||
- obj->links.blk_account_io_start = bpf_program__attach_kprobe(obj->progs.blk_account_io_start, false, "__blk_account_io_start");
|
||||
- else
|
||||
- obj->links.blk_account_io_start = bpf_program__attach_kprobe(obj->progs.blk_account_io_start, false, "blk_account_io_start");
|
||||
-
|
||||
- if (!obj->links.blk_account_io_start) {
|
||||
- warn("failed to load attach blk_account_io_start\n");
|
||||
- goto cleanup;
|
||||
- }
|
||||
-
|
||||
- if (ksyms__get_symbol(ksyms, "__blk_account_io_done"))
|
||||
- obj->links.blk_account_io_done = bpf_program__attach_kprobe(obj->progs.blk_account_io_done, false, "__blk_account_io_done");
|
||||
- else
|
||||
- obj->links.blk_account_io_done = bpf_program__attach_kprobe(obj->progs.blk_account_io_done, false, "blk_account_io_done");
|
||||
-
|
||||
- if (!obj->links.blk_account_io_done) {
|
||||
- warn("failed to load attach blk_account_io_done\n");
|
||||
- goto cleanup;
|
||||
- }
|
||||
-
|
||||
err = biotop_bpf__attach(obj);
|
||||
if (err) {
|
||||
warn("failed to attach BPF programs: %d\n", err);
|
||||
--
|
||||
2.41.0
|
||||
|
14
bcc.spec
14
bcc.spec
@ -10,7 +10,7 @@
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%ifarch x86_64 ppc64 ppc64le aarch64
|
||||
%ifarch x86_64 ppc64 ppc64le aarch64 s390x
|
||||
%bcond_without libbpf_tools
|
||||
%else
|
||||
%bcond_with libbpf_tools
|
||||
@ -25,7 +25,7 @@
|
||||
|
||||
Name: bcc
|
||||
Version: 0.28.0
|
||||
Release: 4%{?dist}
|
||||
Release: 5%{?dist}
|
||||
Summary: BPF Compiler Collection (BCC)
|
||||
License: ASL 2.0
|
||||
URL: https://github.com/iovisor/bcc
|
||||
@ -34,6 +34,11 @@ Patch0: %%{name}-%%{version}-tools-tcpstates-fix-context-ptr-modified-er
|
||||
Patch1: %%{name}-%%{version}-tools-tcpstates-fix-IPv6-journal.patch
|
||||
Patch2: %%{name}-%%{version}-tools-Add-support-for-the-new-block_io_-tracepoints.patch
|
||||
Patch3: %%{name}-%%{version}-tools-trace-don-t-raise-an-exception-in-a-ctype-call.patch
|
||||
Patch4: %%{name}-%%{version}-libbpf-tools-add-block_io_-start-done-tracepoints-su.patch
|
||||
Patch5: %%{name}-%%{version}-libbpf-tools-Add-s390x-support.patch
|
||||
Patch6: %%{name}-%%{version}-Fixing-pvalloc-memleak-test.patch
|
||||
Patch7: %%{name}-%%{version}-Skipping-USDT-tests-for-Power-processor.patch
|
||||
Patch8: %%{name}-%%{version}-Adding-memory-zones-for-Power-server.patch
|
||||
|
||||
# Arches will be included as upstream support is added and dependencies are
|
||||
# satisfied in the respective arches
|
||||
@ -257,6 +262,11 @@ cp -a libbpf-tools/tmp-install/bin/* %{buildroot}/%{_sbindir}/
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Wed Dec 13 2023 Jerome Marchand <jmarchan@redhat.com> - 0.28.0-5
|
||||
- Fix libbpf bio tools (RHEL-19368)
|
||||
- Add S390x support to libbpf-tools (RHEL-16325)
|
||||
- Power enhancements(RHEL-11477)
|
||||
|
||||
* Tue Nov 21 2023 Jerome Marchand <jmarchan@redhat.com> - 0.28.0-4
|
||||
- Rebuild with LLVM 17 in the side tag (RHEL-10591)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user