|
@@ -1091,12 +1091,12 @@ int is_valid_tracepoint(const char *event_string)
|
|
|
static bool is_event_supported(u8 type, unsigned config)
|
|
|
{
|
|
|
bool ret = true;
|
|
|
+ int open_return;
|
|
|
struct perf_evsel *evsel;
|
|
|
struct perf_event_attr attr = {
|
|
|
.type = type,
|
|
|
.config = config,
|
|
|
.disabled = 1,
|
|
|
- .exclude_kernel = 1,
|
|
|
};
|
|
|
struct {
|
|
|
struct thread_map map;
|
|
@@ -1108,7 +1108,20 @@ static bool is_event_supported(u8 type, unsigned config)
|
|
|
|
|
|
evsel = perf_evsel__new(&attr);
|
|
|
if (evsel) {
|
|
|
- ret = perf_evsel__open(evsel, NULL, &tmap.map) >= 0;
|
|
|
+ open_return = perf_evsel__open(evsel, NULL, &tmap.map);
|
|
|
+ ret = open_return >= 0;
|
|
|
+
|
|
|
+ if (open_return == -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->attr.exclude_kernel = 1;
|
|
|
+ ret = perf_evsel__open(evsel, NULL, &tmap.map) >= 0;
|
|
|
+ }
|
|
|
perf_evsel__delete(evsel);
|
|
|
}
|
|
|
|