Package: bpfcc-tools
Version: 0.18.0+ds-2
Severity: normal
Dear Maintainer,
Pretty simple - it looks like the internal field that biosnoop-bpfcc reads
to get the size of the IO started being cleared on IO completion at some point,
so it prints as always 0 now.
Upstream fixed this by stashing the size and timestamp before the IO starts;
since
that's really the only delta between the two, I'd probably just take that
wholesale (the
patch attached is a delta between what's currently in 0.18.0 and git master).
(Don't mind the debsums error, I went and tinkered with my copy to try a couple
of
solutions; it's broken on unmodified biosnoop.)
- Rich
-- System Information:
Debian Release: 11.1
APT prefers stable-updates
APT policy: (1000, 'stable-updates'), (1000, 'stable-security'), (1000,
'stable'), (901, 'proposed-updates'), (900, 'oldstable-debug'), (900,
'testing'), (800, 'unstable-debug'), (500, 'stable-debug'), (500,
'proposed-updates-debug'), (500, 'oldstable-proposed-updates-debug'), (1,
'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 5.10.0-9-amd64 (SMP w/16 CPU threads)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE,
TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages bpfcc-tools depends on:
ii python3 3.9.2-3
ii python3-bpfcc0.18.0+ds-2
ii python3-netaddr 0.7.19-5
bpfcc-tools recommends no packages.
bpfcc-tools suggests no packages.
-- no debconf information
-- debsums errors found:
debsums: changed file /usr/sbin/biosnoop-bpfcc (from bpfcc-tools package)
--- tools/biosnoop.py.old 2021-10-21 09:38:53.626276801 -0400
+++ tools/biosnoop.py 2021-10-21 09:39:03.354295218 -0400
@@ -39,6 +39,12 @@
#include
#include
+// for saving the timestamp and __data_len of each request
+struct start_req_t {
+u64 ts;
+u64 data_len;
+};
+
struct val_t {
u64 ts;
u32 pid;
@@ -57,7 +63,7 @@
char name[TASK_COMM_LEN];
};
-BPF_HASH(start, struct request *);
+BPF_HASH(start, struct request *, struct start_req_t);
BPF_HASH(infobyreq, struct request *, struct val_t);
BPF_PERF_OUTPUT(events);
@@ -80,42 +86,43 @@
// time block I/O
int trace_req_start(struct pt_regs *ctx, struct request *req)
{
-u64 ts;
-ts = bpf_ktime_get_ns();
-start.update(&req, &ts);
+struct start_req_t start_req = {
+.ts = bpf_ktime_get_ns(),
+.data_len = req->__data_len
+};
+start.update(&req, &start_req);
return 0;
}
// output
int trace_req_completion(struct pt_regs *ctx, struct request *req)
{
-u64 *tsp;
+struct start_req_t *startp;
struct val_t *valp;
struct data_t data = {};
u64 ts;
// fetch timestamp and calculate delta
-tsp = start.lookup(&req);
-if (tsp == 0) {
+startp = start.lookup(&req);
+if (startp == 0) {
// missed tracing issue
return 0;
}
ts = bpf_ktime_get_ns();
-data.delta = ts - *tsp;
+data.delta = ts - startp->ts;
data.ts = ts / 1000;
data.qdelta = 0;
valp = infobyreq.lookup(&req);
+data.len = startp->data_len;
if (valp == 0) {
-data.len = req->__data_len;
data.name[0] = '?';
data.name[1] = 0;
} else {
if (##QUEUE##) {
-data.qdelta = *tsp - valp->ts;
+data.qdelta = startp->ts - valp->ts;
}
data.pid = valp->pid;
-data.len = req->__data_len;
data.sector = req->__sector;
bpf_probe_read_kernel(&data.name, sizeof(data.name), valp->name);
struct gendisk *rq_disk = req->rq_disk;