@@ -1085,6 +1093,8 @@ static int __perf_evsel__open(struct per
}
fallback_missing_features:
+ if (perf_missing_features.clockid)
+ evsel->attr.use_clockid = 0;
if (perf_missing_features.cloexec)
flags &= ~(unsigned long)PERF_FLAG_FD_CLOEXEC;
if (perf_missing_features.mmap2)
@@ -1122,6 +1132,16 @@ static int __perf_evsel__open(struct per
goto try_fallback;
}
set_rlimit = NO_CHANGE;
+
+ /*
+ * If we succeeded but had to kill clockid, fail and
+ * have perf_evsel__open_strerror() print us a nice
+ * error.
+ */
+ if (perf_missing_features.clockid) {
+ err = -EINVAL;
+ goto out_close;
+ }
}
}
@@ -1155,7 +1175,10 @@ static int __perf_evsel__open(struct per
if (err != -EINVAL || cpu > 0 || thread > 0)
goto out_close;
- if (!perf_missing_features.cloexec && (flags & PERF_FLAG_FD_CLOEXEC)) {
+ if (!perf_missing_features.clockid && evsel->attr.use_clockid) {
+ perf_missing_features.clockid = true;
+ goto fallback_missing_features;
+ } else if (!perf_missing_features.cloexec && (flags & PERF_FLAG_FD_CLOEXEC)) {
perf_missing_features.cloexec = true;
goto fallback_missing_features;
} else if (!perf_missing_features.mmap2 && evsel->attr.mmap2) {
@@ -2158,6 +2188,12 @@ int perf_evsel__open_strerror(struct per
"The PMU counters are busy/taken by another profiler.\n"
"We found oprofile daemon running, please stop it and try again.");
break;
+
+ case EINVAL:
+ if (perf_missing_features.clockid)
+ return scnprintf(msg, size, "%s", "clockid not supported.");
+ break;
+
default:
break;
}