From 38160c6c7d2ea1090a4070570a875f8d8d78849d Mon Sep 17 00:00:00 2001 From: Francis Laniel Date: Tue, 11 Oct 2022 12:03:40 +0200 Subject: [PATCH] libbpf-tools: Use raw_tp rather than tp_btf for biolatency. tp_btf were added in kernel 5.5, by using raw_tp we enable this tool to be used on older kernels [1]. Signed-off-by: Francis Laniel [1] https://github.com/torvalds/linux/commit/ac4414b5ca47 --- libbpf-tools/biolatency.bpf.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libbpf-tools/biolatency.bpf.c b/libbpf-tools/biolatency.bpf.c index bab62b1d76b5..3dbc4a7e11ef 100644 --- a/libbpf-tools/biolatency.bpf.c +++ b/libbpf-tools/biolatency.bpf.c @@ -46,7 +46,7 @@ struct { static __always_inline int trace_rq_start(struct request *rq, int issue) { - if (issue && targ_queued && BPF_CORE_READ(rq->q, elevator)) + if (issue && targ_queued && BPF_CORE_READ(rq, q, elevator)) return 0; u64 ts = bpf_ktime_get_ns(); @@ -64,7 +64,7 @@ int trace_rq_start(struct request *rq, int issue) return 0; } -SEC("tp_btf/block_rq_insert") +SEC("raw_tp/block_rq_insert") int block_rq_insert(u64 *ctx) { if (filter_cg && !bpf_current_task_under_cgroup(&cgroup_map, 0)) @@ -81,7 +81,7 @@ int block_rq_insert(u64 *ctx) return trace_rq_start((void *)ctx[0], false); } -SEC("tp_btf/block_rq_issue") +SEC("raw_tp/block_rq_issue") int block_rq_issue(u64 *ctx) { if (filter_cg && !bpf_current_task_under_cgroup(&cgroup_map, 0)) @@ -98,7 +98,7 @@ int block_rq_issue(u64 *ctx) return trace_rq_start((void *)ctx[0], true); } -SEC("tp_btf/block_rq_complete") +SEC("raw_tp/block_rq_complete") int BPF_PROG(block_rq_complete, struct request *rq, int error, unsigned int nr_bytes) { @@ -124,7 +124,7 @@ int BPF_PROG(block_rq_complete, struct request *rq, int error, BPF_CORE_READ(disk, first_minor)) : 0; } if (targ_per_flag) - hkey.cmd_flags = rq->cmd_flags; + hkey.cmd_flags = BPF_CORE_READ(rq, cmd_flags); histp = bpf_map_lookup_elem(&hists, &hkey); if (!histp) {