aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/perf/tests/openat-syscall-all-cpus.c9
-rw-r--r--tools/perf/tests/openat-syscall.c11
-rw-r--r--tools/perf/tests/parse-events.c16
-rw-r--r--tools/perf/util/probe-file.c14
4 files changed, 11 insertions, 39 deletions
diff --git a/tools/perf/tests/openat-syscall-all-cpus.c b/tools/perf/tests/openat-syscall-all-cpus.c
index a38adf94c731..495d8126b722 100644
--- a/tools/perf/tests/openat-syscall-all-cpus.c
+++ b/tools/perf/tests/openat-syscall-all-cpus.c
@@ -15,6 +15,7 @@ int test__openat_syscall_event_on_all_cpus(void)
15 cpu_set_t cpu_set; 15 cpu_set_t cpu_set;
16 struct thread_map *threads = thread_map__new(-1, getpid(), UINT_MAX); 16 struct thread_map *threads = thread_map__new(-1, getpid(), UINT_MAX);
17 char sbuf[STRERR_BUFSIZE]; 17 char sbuf[STRERR_BUFSIZE];
18 char errbuf[BUFSIZ];
18 19
19 if (threads == NULL) { 20 if (threads == NULL) {
20 pr_debug("thread_map__new\n"); 21 pr_debug("thread_map__new\n");
@@ -31,12 +32,8 @@ int test__openat_syscall_event_on_all_cpus(void)
31 32
32 evsel = perf_evsel__newtp("syscalls", "sys_enter_openat"); 33 evsel = perf_evsel__newtp("syscalls", "sys_enter_openat");
33 if (evsel == NULL) { 34 if (evsel == NULL) {
34 if (tracefs__configured()) 35 tracing_path__strerror_open_tp(errno, errbuf, sizeof(errbuf), "syscalls", "sys_enter_openat");
35 pr_debug("is tracefs mounted on /sys/kernel/tracing?\n"); 36 pr_err("%s\n", errbuf);
36 else if (debugfs__configured())
37 pr_debug("is debugfs mounted on /sys/kernel/debug?\n");
38 else
39 pr_debug("Neither tracefs or debugfs is enabled in this kernel\n");
40 goto out_thread_map_delete; 37 goto out_thread_map_delete;
41 } 38 }
42 39
diff --git a/tools/perf/tests/openat-syscall.c b/tools/perf/tests/openat-syscall.c
index 8048c7d7cd67..08ac9d94a050 100644
--- a/tools/perf/tests/openat-syscall.c
+++ b/tools/perf/tests/openat-syscall.c
@@ -1,4 +1,4 @@
1#include <api/fs/fs.h> 1#include <api/fs/tracing_path.h>
2#include "thread_map.h" 2#include "thread_map.h"
3#include "evsel.h" 3#include "evsel.h"
4#include "debug.h" 4#include "debug.h"
@@ -11,6 +11,7 @@ int test__openat_syscall_event(void)
11 unsigned int nr_openat_calls = 111, i; 11 unsigned int nr_openat_calls = 111, i;
12 struct thread_map *threads = thread_map__new(-1, getpid(), UINT_MAX); 12 struct thread_map *threads = thread_map__new(-1, getpid(), UINT_MAX);
13 char sbuf[STRERR_BUFSIZE]; 13 char sbuf[STRERR_BUFSIZE];
14 char errbuf[BUFSIZ];
14 15
15 if (threads == NULL) { 16 if (threads == NULL) {
16 pr_debug("thread_map__new\n"); 17 pr_debug("thread_map__new\n");
@@ -19,12 +20,8 @@ int test__openat_syscall_event(void)
19 20
20 evsel = perf_evsel__newtp("syscalls", "sys_enter_openat"); 21 evsel = perf_evsel__newtp("syscalls", "sys_enter_openat");
21 if (evsel == NULL) { 22 if (evsel == NULL) {
22 if (tracefs__configured()) 23 tracing_path__strerror_open_tp(errno, errbuf, sizeof(errbuf), "syscalls", "sys_enter_openat");
23 pr_debug("is tracefs mounted on /sys/kernel/tracing?\n"); 24 pr_err("%s\n", errbuf);
24 else if (debugfs__configured())
25 pr_debug("is debugfs mounted on /sys/kernel/debug?\n");
26 else
27 pr_debug("Neither tracefs or debugfs is enabled in this kernel\n");
28 goto out_thread_map_delete; 25 goto out_thread_map_delete;
29 } 26 }
30 27
diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c
index 91fbfd593c4a..3a2ebe666192 100644
--- a/tools/perf/tests/parse-events.c
+++ b/tools/perf/tests/parse-events.c
@@ -1261,23 +1261,11 @@ test__checkevent_breakpoint_len_rw_modifier(struct perf_evlist *evlist)
1261 1261
1262static int count_tracepoints(void) 1262static int count_tracepoints(void)
1263{ 1263{
1264 char events_path[PATH_MAX];
1265 struct dirent *events_ent; 1264 struct dirent *events_ent;
1266 const char *mountpoint;
1267 DIR *events_dir; 1265 DIR *events_dir;
1268 int cnt = 0; 1266 int cnt = 0;
1269 1267
1270 mountpoint = tracefs__mountpoint(); 1268 events_dir = opendir(tracing_events_path);
1271 if (mountpoint) {
1272 scnprintf(events_path, PATH_MAX, "%s/events",
1273 mountpoint);
1274 } else {
1275 mountpoint = debugfs__mountpoint();
1276 scnprintf(events_path, PATH_MAX, "%s/tracing/events",
1277 mountpoint);
1278 }
1279
1280 events_dir = opendir(events_path);
1281 1269
1282 TEST_ASSERT_VAL("Can't open events dir", events_dir); 1270 TEST_ASSERT_VAL("Can't open events dir", events_dir);
1283 1271
@@ -1294,7 +1282,7 @@ static int count_tracepoints(void)
1294 continue; 1282 continue;
1295 1283
1296 scnprintf(sys_path, PATH_MAX, "%s/%s", 1284 scnprintf(sys_path, PATH_MAX, "%s/%s",
1297 events_path, events_ent->d_name); 1285 tracing_events_path, events_ent->d_name);
1298 1286
1299 sys_dir = opendir(sys_path); 1287 sys_dir = opendir(sys_path);
1300 TEST_ASSERT_VAL("Can't open sys dir", sys_dir); 1288 TEST_ASSERT_VAL("Can't open sys dir", sys_dir);
diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c
index 499c83ccd44b..89dbeb92c68e 100644
--- a/tools/perf/util/probe-file.c
+++ b/tools/perf/util/probe-file.c
@@ -22,7 +22,7 @@
22#include "color.h" 22#include "color.h"
23#include "symbol.h" 23#include "symbol.h"
24#include "thread.h" 24#include "thread.h"
25#include <api/fs/fs.h> 25#include <api/fs/tracing_path.h>
26#include "probe-event.h" 26#include "probe-event.h"
27#include "probe-file.h" 27#include "probe-file.h"
28#include "session.h" 28#include "session.h"
@@ -72,21 +72,11 @@ static void print_both_open_warning(int kerr, int uerr)
72static int open_probe_events(const char *trace_file, bool readwrite) 72static int open_probe_events(const char *trace_file, bool readwrite)
73{ 73{
74 char buf[PATH_MAX]; 74 char buf[PATH_MAX];
75 const char *__debugfs;
76 const char *tracing_dir = ""; 75 const char *tracing_dir = "";
77 int ret; 76 int ret;
78 77
79 __debugfs = tracefs__mountpoint();
80 if (__debugfs == NULL) {
81 tracing_dir = "tracing/";
82
83 __debugfs = debugfs__mountpoint();
84 if (__debugfs == NULL)
85 return -ENOTSUP;
86 }
87
88 ret = e_snprintf(buf, PATH_MAX, "%s/%s%s", 78 ret = e_snprintf(buf, PATH_MAX, "%s/%s%s",
89 __debugfs, tracing_dir, trace_file); 79 tracing_path, tracing_dir, trace_file);
90 if (ret >= 0) { 80 if (ret >= 0) {
91 pr_debug("Opening %s write=%d\n", buf, readwrite); 81 pr_debug("Opening %s write=%d\n", buf, readwrite);
92 if (readwrite && !probe_event_dry_run) 82 if (readwrite && !probe_event_dry_run)