Skip to content

Commit

Permalink
biolatpcts: Build fixes on recent kernels
Browse files Browse the repository at this point in the history
* `struct request` definition recently moved from blkdev.h to blk-mq.h
  breaking both tools/biolatpcts and examples/tracing/biolatpcts. Fix them
  by also including blk-mq.h.

* blk_account_io_done() got split into two parts - inline condition checks
  and the actual accounting with the latter now done in
  __blk_account_io_done(). The kprobe attachment needs to be conditionalized
  to work across the change. tools/biolatpcts was already updated but
  examples/tracing/biolatpcts wasn't. Fix it.

Signed-off-by: Tejun Heo <[email protected]>
  • Loading branch information
htejun committed Jan 27, 2022
1 parent b1d8796 commit 11614bc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion examples/tracing/biolatpcts.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

bpf_source = """
#include <linux/blk_types.h>
#include <linux/blk-mq.h>
#include <linux/blkdev.h>
#include <linux/time64.h>
Expand Down Expand Up @@ -45,7 +46,10 @@
"""

bpf = BPF(text=bpf_source)
bpf.attach_kprobe(event='blk_account_io_done', fn_name='kprobe_blk_account_io_done')
if BPF.get_kprobe_functions(b'__blk_account_io_done'):
bpf.attach_kprobe(event="__blk_account_io_done", fn_name="kprobe_blk_account_io_done")
else:
bpf.attach_kprobe(event="blk_account_io_done", fn_name="kprobe_blk_account_io_done")

cur_lat_100ms = bpf['lat_100ms']
cur_lat_1ms = bpf['lat_1ms']
Expand Down
1 change: 1 addition & 0 deletions tools/biolatpcts.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
bpf_source = """
#include <linux/blk_types.h>
#include <linux/blkdev.h>
#include <linux/blk-mq.h>
#include <linux/time64.h>
BPF_PERCPU_ARRAY(rwdf_100ms, u64, 400);
Expand Down

0 comments on commit 11614bc

Please sign in to comment.