diff options
author | Steven Rostedt (Red Hat) <rostedt@goodmis.org> | 2015-02-02 14:35:07 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-02-11 10:37:08 -0500 |
commit | 23773ca18b399051eb94f98b689cf7a9173c795b (patch) | |
tree | 17629936892375049fd68b096389e8c24bc07a4a /tools/perf/util/probe-event.c | |
parent | dd6dda27a8be563eaebb3f38b1d1d50920bb7991 (diff) |
perf tools: Make perf aware of tracefs
As tracefs may be mounted instead of debugfs to get to the event
directories, have perf know about tracefs, and use that file system over
debugfs if it is present.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/20150202193553.340946602@goodmis.org
[ Fixed up error messages about tracefs pointed out by Namhyung ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/probe-event.c')
-rw-r--r-- | tools/perf/util/probe-event.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 919937eb0be2..9dfbed96bf39 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include "symbol.h" | 41 | #include "symbol.h" |
42 | #include "thread.h" | 42 | #include "thread.h" |
43 | #include <api/fs/debugfs.h> | 43 | #include <api/fs/debugfs.h> |
44 | #include <api/fs/tracefs.h> | ||
44 | #include "trace-event.h" /* For __maybe_unused */ | 45 | #include "trace-event.h" /* For __maybe_unused */ |
45 | #include "probe-event.h" | 46 | #include "probe-event.h" |
46 | #include "probe-finder.h" | 47 | #include "probe-finder.h" |
@@ -1805,7 +1806,7 @@ static void print_open_warning(int err, bool is_kprobe) | |||
1805 | " - please rebuild kernel with %s.\n", | 1806 | " - please rebuild kernel with %s.\n", |
1806 | is_kprobe ? 'k' : 'u', config); | 1807 | is_kprobe ? 'k' : 'u', config); |
1807 | } else if (err == -ENOTSUP) | 1808 | } else if (err == -ENOTSUP) |
1808 | pr_warning("Debugfs is not mounted.\n"); | 1809 | pr_warning("Tracefs or debugfs is not mounted.\n"); |
1809 | else | 1810 | else |
1810 | pr_warning("Failed to open %cprobe_events: %s\n", | 1811 | pr_warning("Failed to open %cprobe_events: %s\n", |
1811 | is_kprobe ? 'k' : 'u', | 1812 | is_kprobe ? 'k' : 'u', |
@@ -1816,7 +1817,7 @@ static void print_both_open_warning(int kerr, int uerr) | |||
1816 | { | 1817 | { |
1817 | /* Both kprobes and uprobes are disabled, warn it. */ | 1818 | /* Both kprobes and uprobes are disabled, warn it. */ |
1818 | if (kerr == -ENOTSUP && uerr == -ENOTSUP) | 1819 | if (kerr == -ENOTSUP && uerr == -ENOTSUP) |
1819 | pr_warning("Debugfs is not mounted.\n"); | 1820 | pr_warning("Tracefs or debugfs is not mounted.\n"); |
1820 | else if (kerr == -ENOENT && uerr == -ENOENT) | 1821 | else if (kerr == -ENOENT && uerr == -ENOENT) |
1821 | pr_warning("Please rebuild kernel with CONFIG_KPROBE_EVENTS " | 1822 | pr_warning("Please rebuild kernel with CONFIG_KPROBE_EVENTS " |
1822 | "or/and CONFIG_UPROBE_EVENTS.\n"); | 1823 | "or/and CONFIG_UPROBE_EVENTS.\n"); |
@@ -1833,13 +1834,20 @@ static int open_probe_events(const char *trace_file, bool readwrite) | |||
1833 | { | 1834 | { |
1834 | char buf[PATH_MAX]; | 1835 | char buf[PATH_MAX]; |
1835 | const char *__debugfs; | 1836 | const char *__debugfs; |
1837 | const char *tracing_dir = ""; | ||
1836 | int ret; | 1838 | int ret; |
1837 | 1839 | ||
1838 | __debugfs = debugfs_find_mountpoint(); | 1840 | __debugfs = tracefs_find_mountpoint(); |
1839 | if (__debugfs == NULL) | 1841 | if (__debugfs == NULL) { |
1840 | return -ENOTSUP; | 1842 | tracing_dir = "tracing/"; |
1841 | 1843 | ||
1842 | ret = e_snprintf(buf, PATH_MAX, "%s/%s", __debugfs, trace_file); | 1844 | __debugfs = debugfs_find_mountpoint(); |
1845 | if (__debugfs == NULL) | ||
1846 | return -ENOTSUP; | ||
1847 | } | ||
1848 | |||
1849 | ret = e_snprintf(buf, PATH_MAX, "%s/%s%s", | ||
1850 | __debugfs, tracing_dir, trace_file); | ||
1843 | if (ret >= 0) { | 1851 | if (ret >= 0) { |
1844 | pr_debug("Opening %s write=%d\n", buf, readwrite); | 1852 | pr_debug("Opening %s write=%d\n", buf, readwrite); |
1845 | if (readwrite && !probe_event_dry_run) | 1853 | if (readwrite && !probe_event_dry_run) |
@@ -1855,12 +1863,12 @@ static int open_probe_events(const char *trace_file, bool readwrite) | |||
1855 | 1863 | ||
1856 | static int open_kprobe_events(bool readwrite) | 1864 | static int open_kprobe_events(bool readwrite) |
1857 | { | 1865 | { |
1858 | return open_probe_events("tracing/kprobe_events", readwrite); | 1866 | return open_probe_events("kprobe_events", readwrite); |
1859 | } | 1867 | } |
1860 | 1868 | ||
1861 | static int open_uprobe_events(bool readwrite) | 1869 | static int open_uprobe_events(bool readwrite) |
1862 | { | 1870 | { |
1863 | return open_probe_events("tracing/uprobe_events", readwrite); | 1871 | return open_probe_events("uprobe_events", readwrite); |
1864 | } | 1872 | } |
1865 | 1873 | ||
1866 | /* Get raw string list of current kprobe_events or uprobe_events */ | 1874 | /* Get raw string list of current kprobe_events or uprobe_events */ |