summaryrefslogtreecommitdiff
path: root/tools/perf/util/pfm.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/pfm.c')
-rw-r--r--tools/perf/util/pfm.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/tools/perf/util/pfm.c b/tools/perf/util/pfm.c
index 862e4a689868..d9043f4afbe7 100644
--- a/tools/perf/util/pfm.c
+++ b/tools/perf/util/pfm.c
@@ -15,6 +15,7 @@
#include "util/strbuf.h"
#include "util/thread_map.h"
+#include <errno.h>
#include <string.h>
#include <linux/kernel.h>
#include <perfmon/pfmlib_perf_event.h>
@@ -47,10 +48,6 @@ int parse_libpfm_events_option(const struct option *opt, const char *str,
p_orig = p = strdup(str);
if (!p)
return -1;
- /*
- * force loading of the PMU list
- */
- perf_pmus__scan(NULL);
for (q = p; strsep(&p, ",{}"); q = p) {
sep = p ? str + (p - p_orig - 1) : "";
@@ -145,7 +142,20 @@ static bool is_libpfm_event_supported(const char *name, struct perf_cpu_map *cpu
evsel->is_libpfm_event = true;
- if (evsel__open(evsel, cpus, threads) < 0)
+ ret = evsel__open(evsel, cpus, threads);
+ if (ret == -EACCES) {
+ /*
+ * This happens if the paranoid value
+ * /proc/sys/kernel/perf_event_paranoid is set to 2
+ * Re-run with exclude_kernel set; we don't do that
+ * by default as some ARM machines do not support it.
+ *
+ */
+ evsel->core.attr.exclude_kernel = 1;
+ ret = evsel__open(evsel, cpus, threads);
+
+ }
+ if (ret < 0)
result = false;
evsel__close(evsel);
@@ -220,7 +230,8 @@ print_libpfm_event(const struct print_callbacks *print_cb, void *print_state,
}
if (is_libpfm_event_supported(name, cpus, threads)) {
- print_cb->print_event(print_state, pinfo->name, topic,
+ print_cb->print_event(print_state, topic, pinfo->name,
+ /*pmu_type=*/PERF_TYPE_RAW,
name, info->equiv,
/*scale_unit=*/NULL,
/*deprecated=*/NULL, "PFM event",
@@ -254,8 +265,9 @@ print_libpfm_event(const struct print_callbacks *print_cb, void *print_state,
continue;
print_cb->print_event(print_state,
- pinfo->name,
topic,
+ pinfo->name,
+ /*pmu_type=*/PERF_TYPE_RAW,
name, /*alias=*/NULL,
/*scale_unit=*/NULL,
/*deprecated=*/NULL, "PFM event",