Blob Blame History Raw
From 6476a7e81eba04a729380b813d6555cdca2acb1a Mon Sep 17 00:00:00 2001
From: Marko Myllynen <myllynen@redhat.com>
Date: Thu, 5 Jul 2018 08:59:35 +0300
Subject: [PATCH] pmdabcc: fix ext4dist/xfsdist for RHEL 7 kernel

RHEL 7 kernel is unlike Fedora / upstream kernels, apply the
corresponding change done in latest RHEL 7 bcc as well.
---
 src/pmdas/bcc/modules/fs/ext4dist.bpf    | 1 +
 src/pmdas/bcc/modules/fs/ext4dist.python | 8 ++++----
 src/pmdas/bcc/modules/fs/xfsdist.bpf     | 1 +
 src/pmdas/bcc/modules/fs/xfsdist.python  | 8 ++++----
 4 files changed, 10 insertions(+), 8 deletions(-)

diff -Naurp pcp-4.3.0.orig/src/pmdas/bcc/modules/fs/ext4dist.bpf pcp-4.3.0/src/pmdas/bcc/modules/fs/ext4dist.bpf
--- pcp-4.3.0.orig/src/pmdas/bcc/modules/fs/ext4dist.bpf	2018-05-28 11:27:04.000000000 +1000
+++ pcp-4.3.0/src/pmdas/bcc/modules/fs/ext4dist.bpf	2019-01-29 13:00:29.057576352 +1100
@@ -3,6 +3,7 @@
 
 #include <uapi/linux/ptrace.h>
 #include <linux/fs.h>
+#include <linux/aio.h>
 #include <linux/sched.h>
 
 #define OP_NAME_LEN 8
diff -Naurp pcp-4.3.0.orig/src/pmdas/bcc/modules/fs/ext4dist.python pcp-4.3.0/src/pmdas/bcc/modules/fs/ext4dist.python
--- pcp-4.3.0.orig/src/pmdas/bcc/modules/fs/ext4dist.python	2018-09-18 16:41:15.000000000 +1000
+++ pcp-4.3.0/src/pmdas/bcc/modules/fs/ext4dist.python	2019-01-29 13:03:26.656105696 +1100
@@ -121,16 +121,12 @@ class PCPBCCModule(PCPBCCBase):
             self.reset_cache()
             self.bpf = BPF(text=bpf_text)
             # Compat: bcc < 0.6.0 (first check)
-            if 'get_kprobe_functions' in dir(self.bpf) and \
-               self.get_kprobe_functions(b"ext4_file_read_iter"):
-                self.bpf.attach_kprobe(event="ext4_file_read_iter", fn_name="trace_entry")
-            else:
-                self.bpf.attach_kprobe(event="generic_file_read_iter", fn_name="trace_read_entry")
-            self.bpf.attach_kprobe(event="ext4_file_write_iter", fn_name="trace_entry")
+            self.bpf.attach_kprobe(event="generic_file_aio_read", fn_name="trace_read_entry")
+            self.bpf.attach_kprobe(event="ext4_file_write", fn_name="trace_entry")
             self.bpf.attach_kprobe(event="ext4_file_open", fn_name="trace_entry")
             self.bpf.attach_kprobe(event="ext4_sync_file", fn_name="trace_entry")
-            self.bpf.attach_kretprobe(event="generic_file_read_iter", fn_name="trace_read_return")
-            self.bpf.attach_kretprobe(event="ext4_file_write_iter", fn_name="trace_write_return")
+            self.bpf.attach_kretprobe(event="generic_file_aio_read", fn_name="trace_read_return")
+            self.bpf.attach_kretprobe(event="ext4_file_write", fn_name="trace_write_return")
             self.bpf.attach_kretprobe(event="ext4_file_open", fn_name="trace_open_return")
             self.bpf.attach_kretprobe(event="ext4_sync_file", fn_name="trace_fsync_return")
             self.log("Compiled.")
diff -Naurp pcp-4.3.0.orig/src/pmdas/bcc/modules/fs/xfsdist.bpf pcp-4.3.0/src/pmdas/bcc/modules/fs/xfsdist.bpf
--- pcp-4.3.0.orig/src/pmdas/bcc/modules/fs/xfsdist.bpf	2018-06-19 09:19:05.000000000 +1000
+++ pcp-4.3.0/src/pmdas/bcc/modules/fs/xfsdist.bpf	2019-01-29 13:00:29.060576310 +1100
@@ -3,6 +3,7 @@
 
 #include <uapi/linux/ptrace.h>
 #include <linux/fs.h>
+#include <linux/aio.h>
 #include <linux/sched.h>
 
 #define OP_NAME_LEN 8
diff -Naurp pcp-4.3.0.orig/src/pmdas/bcc/modules/fs/xfsdist.python pcp-4.3.0/src/pmdas/bcc/modules/fs/xfsdist.python
--- pcp-4.3.0.orig/src/pmdas/bcc/modules/fs/xfsdist.python	2018-09-18 16:41:15.000000000 +1000
+++ pcp-4.3.0/src/pmdas/bcc/modules/fs/xfsdist.python	2019-01-29 13:00:29.061576296 +1100
@@ -102,12 +102,12 @@ class PCPBCCModule(PCPBCCBase):
 
             self.reset_cache()
             self.bpf = BPF(text=bpf_text)
-            self.bpf.attach_kprobe(event="xfs_file_read_iter", fn_name="trace_entry")
-            self.bpf.attach_kprobe(event="xfs_file_write_iter", fn_name="trace_entry")
+            self.bpf.attach_kprobe(event="xfs_file_aio_read", fn_name="trace_entry")
+            self.bpf.attach_kprobe(event="xfs_file_aio_write", fn_name="trace_entry")
             self.bpf.attach_kprobe(event="xfs_file_open", fn_name="trace_entry")
             self.bpf.attach_kprobe(event="xfs_file_fsync", fn_name="trace_entry")
-            self.bpf.attach_kretprobe(event="xfs_file_read_iter", fn_name="trace_read_return")
-            self.bpf.attach_kretprobe(event="xfs_file_write_iter", fn_name="trace_write_return")
+            self.bpf.attach_kretprobe(event="xfs_file_aio_read", fn_name="trace_read_return")
+            self.bpf.attach_kretprobe(event="xfs_file_aio_write", fn_name="trace_write_return")
             self.bpf.attach_kretprobe(event="xfs_file_open", fn_name="trace_open_return")
             self.bpf.attach_kretprobe(event="xfs_file_fsync", fn_name="trace_fsync_return")
             self.log("Compiled.")