|
|
ddf812 |
From 2ada4cee035c4d07391faa870a5df1874d657b65 Mon Sep 17 00:00:00 2001
|
|
|
afd259 |
From: Tejun Heo <tj@kernel.org>
|
|
|
afd259 |
Date: Thu, 27 Jan 2022 06:25:31 -1000
|
|
|
ddf812 |
Subject: [PATCH 2/3] biolatpcts: Build fixes on recent kernels
|
|
|
afd259 |
|
|
|
afd259 |
* `struct request` definition recently moved from blkdev.h to blk-mq.h
|
|
|
afd259 |
breaking both tools/biolatpcts and examples/tracing/biolatpcts. Fix them
|
|
|
afd259 |
by also including blk-mq.h.
|
|
|
afd259 |
|
|
|
afd259 |
* blk_account_io_done() got split into two parts - inline condition checks
|
|
|
afd259 |
and the actual accounting with the latter now done in
|
|
|
afd259 |
__blk_account_io_done(). The kprobe attachment needs to be conditionalized
|
|
|
afd259 |
to work across the change. tools/biolatpcts was already updated but
|
|
|
afd259 |
examples/tracing/biolatpcts wasn't. Fix it.
|
|
|
afd259 |
|
|
|
afd259 |
Signed-off-by: Tejun Heo <tj@kernel.org>
|
|
|
afd259 |
---
|
|
|
afd259 |
examples/tracing/biolatpcts.py | 6 +++++-
|
|
|
afd259 |
tools/biolatpcts.py | 1 +
|
|
|
afd259 |
2 files changed, 6 insertions(+), 1 deletion(-)
|
|
|
afd259 |
|
|
|
afd259 |
diff --git a/examples/tracing/biolatpcts.py b/examples/tracing/biolatpcts.py
|
|
|
afd259 |
index c9bb834e..68a59516 100755
|
|
|
afd259 |
--- a/examples/tracing/biolatpcts.py
|
|
|
afd259 |
+++ b/examples/tracing/biolatpcts.py
|
|
|
afd259 |
@@ -11,6 +11,7 @@ from time import sleep
|
|
|
afd259 |
|
|
|
afd259 |
bpf_source = """
|
|
|
afd259 |
#include <linux/blk_types.h>
|
|
|
afd259 |
+#include <linux/blk-mq.h>
|
|
|
afd259 |
#include <linux/blkdev.h>
|
|
|
afd259 |
#include <linux/time64.h>
|
|
|
afd259 |
|
|
|
afd259 |
@@ -45,7 +46,10 @@ void kprobe_blk_account_io_done(struct pt_regs *ctx, struct request *rq, u64 now
|
|
|
afd259 |
"""
|
|
|
afd259 |
|
|
|
afd259 |
bpf = BPF(text=bpf_source)
|
|
|
afd259 |
-bpf.attach_kprobe(event='blk_account_io_done', fn_name='kprobe_blk_account_io_done')
|
|
|
afd259 |
+if BPF.get_kprobe_functions(b'__blk_account_io_done'):
|
|
|
afd259 |
+ bpf.attach_kprobe(event="__blk_account_io_done", fn_name="kprobe_blk_account_io_done")
|
|
|
afd259 |
+else:
|
|
|
afd259 |
+ bpf.attach_kprobe(event="blk_account_io_done", fn_name="kprobe_blk_account_io_done")
|
|
|
afd259 |
|
|
|
afd259 |
cur_lat_100ms = bpf['lat_100ms']
|
|
|
afd259 |
cur_lat_1ms = bpf['lat_1ms']
|
|
|
afd259 |
diff --git a/tools/biolatpcts.py b/tools/biolatpcts.py
|
|
|
afd259 |
index a2f59592..0f334419 100755
|
|
|
afd259 |
--- a/tools/biolatpcts.py
|
|
|
afd259 |
+++ b/tools/biolatpcts.py
|
|
|
afd259 |
@@ -56,6 +56,7 @@ parser.add_argument('--verbose', '-v', action='count', default = 0)
|
|
|
afd259 |
bpf_source = """
|
|
|
afd259 |
#include <linux/blk_types.h>
|
|
|
afd259 |
#include <linux/blkdev.h>
|
|
|
afd259 |
+#include <linux/blk-mq.h>
|
|
|
afd259 |
#include <linux/time64.h>
|
|
|
afd259 |
|
|
|
afd259 |
BPF_PERCPU_ARRAY(rwdf_100ms, u64, 400);
|
|
|
afd259 |
--
|
|
|
afd259 |
2.35.1
|
|
|
afd259 |
|