Skip to content

Commit 258412a

Browse files
committed
DLPX-96701 estat commands are failing with redefinition and forward declaration errors
PR URL: https://www.github.com/delphix/performance-diagnostics/pull/115
1 parent 5e7a27b commit 258412a

7 files changed

Lines changed: 19 additions & 39 deletions

File tree

bpf/estat/nfs.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
* SPDX-License-Identifier: GPL-2.0-or-later
55
*/
66

7-
struct bpf_wq {
8-
__u64 __opaque[2];
9-
} __attribute__((aligned(8)));
10-
117
#include <uapi/linux/ptrace.h>
128
#include <linux/bpf_common.h>
139
#include <uapi/linux/bpf.h>

bpf/estat/zvol.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,6 @@ typedef struct {
4040
zvol_state_t *zv;
4141
} zvol_data_t;
4242

43-
typedef struct zv_request {
44-
zvol_state_t *zv;
45-
struct bio *bio;
46-
} zv_request_t;
47-
48-
4943
BPF_HASH(zvol_base_data, u32, zvol_data_t);
5044

5145
static inline bool equal_to_pool(char *str)

bpf/standalone/arc_prefetch.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,8 @@ class ArcLatencyIndex(BCCMapIndex):
270270
"-I/usr/src/zfs-" + KVER + "/include/",
271271
"-I/usr/src/zfs-" + KVER + "/include/spl/",
272272
"-I/usr/src/zfs-" + KVER + "/include/linux",
273+
"-D__KERNEL__",
274+
"-D_KERNEL",
273275
"-DNCOUNT_INDEX=" + str(len(ArcCountIndex)),
274276
"-DNAVERAGE_INDEX=" + str(len(ArcLatencyIndex))] \
275277
+ ArcCountIndex.getCDefinitions() \

bpf/standalone/txg.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,8 @@ def print_event(cpu, data, size):
349349
"-I/usr/src/zfs-" + KVER + "/include/",
350350
"-I/usr/src/zfs-" + KVER + "/include/spl",
351351
"-I/usr/src/zfs-" + KVER + "/include/",
352-
"-I/usr/src/zfs-" + KVER + "/include/linux"])
352+
"-I/usr/src/zfs-" + KVER + "/include/linux",
353+
"-D__KERNEL__", "-D_KERNEL"])
353354

354355
b.attach_kprobe(event="spa_sync", fn_name="spa_sync_entry")
355356
b.attach_kretprobe(event="spa_sync", fn_name="spa_sync_return")

bpf/standalone/zil.py

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
description='Collect zil latency statistics.',
4949
usage='estat zil [options]')
5050
parser.add_argument('-c', '--coll', type=int, action='store',
51-
dest='collection_sec',
51+
dest='collection_sec', default=60,
5252
help='The collection interval in seconds')
5353
parser.add_argument('-p', '--pool', type=str, action='store',
5454
dest='pool',
@@ -319,7 +319,8 @@
319319
"-include",
320320
"/usr/src/zfs-" + KVER + "/include/spl/sys/types.h",
321321
"-I/usr/src/zfs-" + KVER + "/include/",
322-
"-I/usr/src/zfs-" + KVER + "/include/spl"])
322+
"-I/usr/src/zfs-" + KVER + "/include/spl",
323+
"-D__KERNEL__", "-D_KERNEL"])
323324

324325
b.attach_kprobe(event="zfs_write", fn_name="zfs_write_entry")
325326
b.attach_kretprobe(event="zfs_write", fn_name="zfs_write_return")
@@ -337,8 +338,6 @@
337338
fn_name="zil_commit_waiter_return")
338339
b.attach_kretprobe(event="zio_alloc_zil",
339340
fn_name="zio_alloc_zil_return")
340-
b.attach_kprobe(event="zil_commit_waiter_skip",
341-
fn_name="zil_commit_waiter_skip_entry")
342341
b.attach_kprobe(event="zil_commit_writer_stall",
343342
fn_name="zil_commit_writer_stall_entry")
344343

@@ -354,25 +353,13 @@
354353
BCCHelper.COUNT_AGGREGATION, "count")
355354
call_count_helper.add_key_type("name")
356355

357-
if (not args.collection_sec):
358-
print(" Tracing enabled... Hit Ctrl-C to end.")
359-
360-
# Collect data for a collection interval if specified
361-
if (args.collection_sec):
362-
sleep(args.collection_sec)
363-
try:
364-
print("%-16s\n" % strftime("%D - %H:%M:%S %Z"))
365-
latency_helper.printall()
366-
call_count_helper.printall()
367-
exit(0)
368-
except Exception as e:
369-
print(str(e))
370-
exit(0)
371-
372-
# Collect data until keyborad interrupt with output for each second
356+
#
357+
# Collect data until keyborad interrupt
358+
#
359+
print(" Tracing enabled... Hit Ctrl-C to end.")
373360
while True:
374361
try:
375-
sleep(60)
362+
sleep(args.collection_sec)
376363
except KeyboardInterrupt:
377364
print("%-16s\n" % strftime("%D - %H:%M:%S %Z"))
378365
latency_helper.printall()

bpf/stbtrace/nfs.st

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ from bcchelper import BCCHelper # noqa: E402
2424
bpf_text = '#include "' + base_dir + 'lib/bcc_helper.h' + '"\n'
2525
bpf_text += """
2626

27-
struct bpf_wq {
28-
__u64 __opaque[2];
29-
} __attribute__((aligned(8)));
30-
3127
#include <uapi/linux/ptrace.h>
3228
#include <linux/bpf_common.h>
3329
#include <uapi/linux/bpf.h>

cmd/estat.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,10 @@ def die(*args, **kwargs):
110110
estat zil [POOL]
111111
Provides a breakdown of time spent doing ZIL-related activities, in
112112
particular the time spent allocating a block and time spent waiting for
113-
the write I/O to complete. If POOL is not specified, defaults to tracing
114-
the pool 'domain0'.
113+
the write I/O to complete.
114+
-h show txg help message and exit
115+
-c INTERVAL set the collection interval in seconds
116+
-p POOL set the pool to monitor (default: domain0)
115117
"""
116118

117119

@@ -406,7 +408,9 @@ class Args:
406408
"-include",
407409
"/usr/src/zfs-" + KVER + "/include/spl/sys/types.h",
408410
"-I/usr/src/zfs-" + KVER + "/include/",
409-
"-I/usr/src/zfs-" + KVER + "/include/spl"]
411+
"-I/usr/src/zfs-" + KVER + "/include/spl",
412+
"-D__KERNEL__",
413+
"-D_KERNEL"]
410414
if script_arg:
411415
cflags.append("-DOPTARG=\"" + script_arg + "\"")
412416

0 commit comments

Comments
 (0)