diff --git a/backport-fix-biosnoop-to-block-tracepoints.patch b/backport-fix-biosnoop-to-block-tracepoints.patch new file mode 100644 index 0000000000000000000000000000000000000000..614c4d6568464b1e0e4343d6eb170b7dd89e7d62 --- /dev/null +++ b/backport-fix-biosnoop-to-block-tracepoints.patch @@ -0,0 +1,74 @@ +diff -Nuar bpftrace-0.19.1/tools/biosnoop.bt bpftrace-0.19.1.new/tools/biosnoop.bt +--- bpftrace-0.19.1/tools/biosnoop.bt 2023-10-04 16:18:18.000000000 +0800 ++++ bpftrace-0.19.1.new/tools/biosnoop.bt 2024-05-30 23:23:45.817005781 +0800 +@@ -1,4 +1,4 @@ +-#!/usr/bin/env bpftrace ++#!/usr/bin/bpftrace + /* + * biosnoop.bt Block I/O tracing tool, showing per I/O latency. + * For Linux, uses bpftrace, eBPF. +@@ -7,6 +7,7 @@ + * + * This is a bpftrace version of the bcc tool of the same name. + * ++ * 10-Dec-2023 Costa Shulyupin Switched to block tracepoints. + * 15-Nov-2017 Brendan Gregg Created this. + */ + +@@ -17,32 +18,30 @@ + + BEGIN + { +- printf("%-12s %-7s %-16s %-6s %7s\n", "TIME(ms)", "DISK", "COMM", "PID", "LAT(ms)"); ++ printf("%-12s %-7s %-16s %-6s %7s\n", "TIME(ms)", "DEVICE", "COMM", "PID", "LAT(ms)"); + } + +-kprobe:blk_account_io_start, +-kprobe:__blk_account_io_start ++tracepoint:block:block_bio_queue + { +- @start[arg0] = nsecs; +- @iopid[arg0] = pid; +- @iocomm[arg0] = comm; +- @disk[arg0] = ((struct request *)arg0)->q->disk->disk_name; ++ @start[args.dev, args.sector] = nsecs; ++ @iopid[args.dev, args.sector] = pid; ++ @iocomm[args.dev, args.sector] = comm; + } + +-kprobe:blk_account_io_done, +-kprobe:__blk_account_io_done +-/@start[arg0] != 0 && @iopid[arg0] != 0 && @iocomm[arg0] != ""/ +- ++tracepoint:block:block_rq_complete, ++tracepoint:block:block_bio_complete ++/@start[args.dev, args.sector]/ + { +- $now = nsecs; +- printf("%-12u %-7s %-16s %-6d %7d\n", +- elapsed / 1e6, @disk[arg0], @iocomm[arg0], @iopid[arg0], +- ($now - @start[arg0]) / 1e6); +- +- delete(@start[arg0]); +- delete(@iopid[arg0]); +- delete(@iocomm[arg0]); +- delete(@disk[arg0]); ++ printf("%-12u %4d:%-2d %-16s %-6d %7d\n", ++ elapsed / 1e6, ++ // like MAJOR(dev), MINOR(dev): ++ args.dev >> 20, args.dev & 0xfffff, ++ @iocomm[args.dev, args.sector], ++ @iopid[args.dev, args.sector], ++ (nsecs - @start[args.dev, args.sector]) / 1e6); ++ delete(@start[args.dev, args.sector]); ++ delete(@iopid[args.dev, args.sector]); ++ delete(@iocomm[args.dev, args.sector]); + } + + END +@@ -50,5 +49,4 @@ + clear(@start); + clear(@iopid); + clear(@iocomm); +- clear(@disk); + } diff --git a/bpftrace.spec b/bpftrace.spec index 39fab9afacc165fbf097bb7e5be283cb24b680ca..9cb736217a18fc818838f6e5f6815aa6b12f5251 100644 --- a/bpftrace.spec +++ b/bpftrace.spec @@ -1,10 +1,11 @@ Name: bpftrace Version: 0.20.1 -Release: 1 +Release: 2 Summary: High-level tracing language for Linux eBPF License: ASL 2.0 URL: https://github.com/iovisor/bpftrace +Patch0001: backport-fix-biosnoop-to-block-tracepoints.patch Source0: %{url}/archive/refs/tags/%{name}-%{version}.tar.gz # Arches will be included as upstream support is added and dependencies are @@ -68,6 +69,10 @@ find %{buildroot}%{_datadir}/%{name}/tools -type f -exec \ %changelog +* Wed Feb 12 2025 changtao - 0.20.1-2 +- since functions blk_account_io_start and blk_account_io_done became static and can't be used as kprobes +- fix-biosnoop-to-block-tracepoints + * Mon Nov 04 2024 fu-shanqing - 0.20.1-1 - update to 0.20.1