Skip to content

Commit 17a57e1

Browse files
DLPX-99371: test_stbtrace_io failed because it stbtrace did not produce any output
PR URL: https://www.github.com/delphix/performance-diagnostics/pull/109
1 parent b04a67f commit 17a57e1

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

bpf/estat/backend-io.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,12 @@ typedef struct {
3030

3131
BPF_HASH(io_base_data, u64, io_data_t);
3232

33-
// @@ kprobe|blk_mq_start_request|disk_io_start
33+
// @@ raw_tracepoint|block_io_start|disk_io_start
3434
int
35-
disk_io_start(struct pt_regs *ctx, struct request *reqp)
35+
disk_io_start(struct bpf_raw_tracepoint_args *ctx)
3636
{
37+
struct request *reqp = (struct request *)ctx->args[0];
38+
3739
io_data_t data = {};
3840
struct gendisk *diskp = reqp->q->disk;
3941
data.ts = bpf_ktime_get_ns();
@@ -44,10 +46,12 @@ disk_io_start(struct pt_regs *ctx, struct request *reqp)
4446
return (0);
4547
}
4648

47-
// @@ kprobe|blk_account_io_done|disk_io_done
49+
// @@ raw_tracepoint|block_io_done|disk_io_done
4850
int
49-
disk_io_done(struct pt_regs *ctx, struct request *reqp)
51+
disk_io_done(struct bpf_raw_tracepoint_args *ctx)
5052
{
53+
struct request *reqp = (struct request *)ctx->args[0];
54+
5155
u64 ts = bpf_ktime_get_ns();
5256
io_data_t *data = io_base_data.lookup((u64 *) &reqp);
5357
struct bio *bp = reqp->bio;

bpf/stbtrace/io.st

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,10 @@ $hists:{hist|
6363
BPF_HASH($hist.name$, io_hist_key_t, u64);
6464
}$
6565

66-
int disk_io_start(struct pt_regs *ctx, struct request *reqp)
66+
int disk_io_start(struct bpf_raw_tracepoint_args *ctx)
6767
{
68+
struct request *reqp = (struct request *)ctx->args[0];
69+
6870
io_data_t data = {};
6971
struct gendisk *diskp = reqp->q->disk;
7072
data.ts = bpf_ktime_get_ns();
@@ -101,8 +103,10 @@ static int aggregate_data(io_data_t *data, u64 ts, char *opstr)
101103
return 0;
102104
}
103105

104-
int disk_io_done(struct pt_regs *ctx, struct request *reqp)
106+
int disk_io_done(struct bpf_raw_tracepoint_args *ctx)
105107
{
108+
struct request *reqp = (struct request *)ctx->args[0];
109+
106110
u64 ts = bpf_ktime_get_ns();
107111
io_data_t *data = io_base_data.lookup((u64 *) &reqp);
108112
struct bio *bp = reqp->bio;
@@ -126,10 +130,8 @@ int disk_io_done(struct pt_regs *ctx, struct request *reqp)
126130
""" # noqa: W293
127131
b = BPF(text=bpf_text)
128132

129-
if BPF.get_kprobe_functions(b'blk_start_request'):
130-
b.attach_kprobe(event="blk_start_request", fn_name="disk_io_start")
131-
b.attach_kprobe(event="blk_mq_start_request", fn_name="disk_io_start")
132-
b.attach_kprobe(event="blk_mq_end_request", fn_name="disk_io_done")
133+
b.attach_raw_tracepoint("block_io_start", fn_name="disk_io_start")
134+
b.attach_raw_tracepoint("block_io_done", fn_name="disk_io_done")
133135

134136

135137
helper = BCCHelper(b, BCCHelper.ANALYTICS_PRINT_MODE)

cmd/estat.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,8 @@ class Args:
440440
else:
441441
print("WARNING: {}: {} - not found"
442442
.format(probe_type, probe_spec[1]))
443+
elif probe_type == "raw_tracepoint":
444+
b.attach_raw_tracepoint(probe_spec[1], fn_name=probe_spec[2])
443445
elif probe_type == "kretprobe":
444446
b.attach_kretprobe(event=probe_spec[1], fn_name=probe_spec[2],
445447
maxactive=MAXACTIVE)

0 commit comments

Comments
 (0)